nvim: update
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
-- License: WTFPL
|
-- License: WTFPL
|
||||||
-- Description: Personal neovim configuration
|
-- Description: Personal neovim configuration
|
||||||
|
|
||||||
-- require('impatient') -- Should be at the top
|
vim.loader.enable()
|
||||||
|
|
||||||
require('filetypes')
|
require('filetypes')
|
||||||
require('builtins')
|
require('builtins')
|
||||||
require('plugins')
|
require('plugins')
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ map('x', 'ga', ':EasyAlign<CR>') -- TODO: this should allow for gaip, but does n
|
|||||||
map('v', 'ga', ':EasyAlign<CR>')
|
map('v', 'ga', ':EasyAlign<CR>')
|
||||||
|
|
||||||
-- nvim-tree.lua
|
-- nvim-tree.lua
|
||||||
-- nmap('<leader>n', ':NERDTreeToggle<CR>')
|
|
||||||
-- nmap('<leader>N', ':NERDTreeFind<CR>')
|
|
||||||
nmap('<leader>n', ':NvimTreeToggle<CR>')
|
nmap('<leader>n', ':NvimTreeToggle<CR>')
|
||||||
nmap('<leader>N', ':NvimTreeFindFile<CR>')
|
nmap('<leader>N', ':NvimTreeFindFile<CR>')
|
||||||
|
|
||||||
@@ -79,3 +77,9 @@ nmap('<C-f>', '<Plug>CtrlSFPrompt')
|
|||||||
|
|
||||||
-- trim whitespace
|
-- trim whitespace
|
||||||
nmap('<leader>W', ':TrimWhitespace<CR>')
|
nmap('<leader>W', ':TrimWhitespace<CR>')
|
||||||
|
|
||||||
|
|
||||||
|
-- EXPERIMENTAL:
|
||||||
|
-- nmap('<leader>x', ':!rm %<CR>')
|
||||||
|
nmap('<leader>x', ":call delete(expand('%')) | bdelete!<CR>")
|
||||||
|
nmap('<leader>q', ':copen<CR>')
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
local cmd, fn, opt, g = vim.cmd, vim.fn, vim.opt, vim.g
|
local cmd, fn, opt, g = vim.cmd, vim.fn, vim.opt, vim.g
|
||||||
|
|
||||||
|
vim.loader.enable()
|
||||||
|
|
||||||
cmd [[packadd packer.nvim]]
|
cmd [[packadd packer.nvim]]
|
||||||
local packer = require('packer')
|
local packer = require('packer')
|
||||||
local use = packer.use
|
local use = packer.use
|
||||||
@@ -15,9 +17,6 @@ local use = packer.use
|
|||||||
packer.startup(function()
|
packer.startup(function()
|
||||||
use { 'wbthomason/packer.nvim', opt = true }
|
use { 'wbthomason/packer.nvim', opt = true }
|
||||||
|
|
||||||
use 'lewis6991/impatient.nvim'
|
|
||||||
use 'nvim-lua/plenary.nvim'
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'shaunsingh/nord.nvim',
|
'shaunsingh/nord.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
@@ -50,11 +49,12 @@ packer.startup(function()
|
|||||||
use { 'nvim-tree/nvim-tree.lua',
|
use { 'nvim-tree/nvim-tree.lua',
|
||||||
config = function()
|
config = function()
|
||||||
require('plugins/nvim-tree').config()
|
require('plugins/nvim-tree').config()
|
||||||
end
|
end,
|
||||||
|
opt = true,
|
||||||
|
cmd = { 'NvimTreeToggle', 'NvimTreeFindFile' }
|
||||||
}
|
}
|
||||||
|
|
||||||
use 'numtostr/comment.nvim'
|
use 'numtostr/comment.nvim'
|
||||||
use 'ellisonleao/glow.nvim'
|
|
||||||
|
|
||||||
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = fn.executable "make" == 1 }
|
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = fn.executable "make" == 1 }
|
||||||
use { 'nvim-telescope/telescope.nvim',
|
use { 'nvim-telescope/telescope.nvim',
|
||||||
@@ -69,7 +69,11 @@ packer.startup(function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Vimscript
|
-- Vimscript
|
||||||
use 'junegunn/vim-easy-align'
|
use { 'junegunn/vim-easy-align',
|
||||||
|
opt = true,
|
||||||
|
cmd = { 'EasyAlign' }
|
||||||
|
}
|
||||||
|
|
||||||
use 'christoomey/vim-tmux-navigator'
|
use 'christoomey/vim-tmux-navigator'
|
||||||
use 'lewis6991/gitsigns.nvim'
|
use 'lewis6991/gitsigns.nvim'
|
||||||
|
|
||||||
@@ -89,9 +93,11 @@ packer.startup(function()
|
|||||||
|
|
||||||
use 'andrewradev/splitjoin.vim'
|
use 'andrewradev/splitjoin.vim'
|
||||||
|
|
||||||
|
use 'ggandor/leap.nvim'
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
branch = 'v1.x',
|
branch = 'v2.x',
|
||||||
requires = {
|
requires = {
|
||||||
-- LSP Support
|
-- LSP Support
|
||||||
{'neovim/nvim-lspconfig'}, -- Required
|
{'neovim/nvim-lspconfig'}, -- Required
|
||||||
|
|||||||
@@ -1,120 +1,29 @@
|
|||||||
-- local M = {}
|
local lsp = require('lsp-zero').preset({})
|
||||||
--
|
|
||||||
-- function M.config()
|
|
||||||
-- local lspconfig = require('lspconfig')
|
|
||||||
--
|
|
||||||
-- lspconfig.ansiblels.setup({})
|
|
||||||
-- lspconfig.bashls.setup({})
|
|
||||||
-- lspconfig.dockerls.setup({})
|
|
||||||
-- lspconfig.gopls.setup({})
|
|
||||||
-- lspconfig.jsonls.setup({})
|
|
||||||
-- lspconfig.solargraph.setup({})
|
|
||||||
--
|
|
||||||
-- -- local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
-- -- require('lspconfig')['solargraph'].setup({ capabilities = capabilities })
|
|
||||||
--
|
|
||||||
-- lspconfig.marksman.setup({})
|
|
||||||
-- lspconfig.terraformls.setup({})
|
|
||||||
-- lspconfig.vimls.setup({})
|
|
||||||
-- lspconfig.pylsp.setup({})
|
|
||||||
-- lspconfig.yamlls.setup({
|
|
||||||
-- settings = {
|
|
||||||
-- yaml = {
|
|
||||||
-- format = {
|
|
||||||
-- enable = true,
|
|
||||||
-- singleQuote = true
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- require("mason").setup({})
|
|
||||||
-- require("mason-lspconfig").setup()
|
|
||||||
-- require("mason-tool-installer").setup({
|
|
||||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim/blob/main/doc/server-mapping.md
|
|
||||||
-- ensure_installed = { "bash-language-server", "black", "dockerfile-language-server",
|
|
||||||
-- "isort", "json-lsp", "jsonlint", "lua-language-server", "marksman", "prettierd",
|
|
||||||
-- "python-lsp-server", "rubocop", "shfmt", "solargraph", "terraform-ls",
|
|
||||||
-- "vim-language-server", "yaml-language-server",
|
|
||||||
-- },
|
|
||||||
-- auto_update = true,
|
|
||||||
-- run_on_start = true
|
|
||||||
-- })
|
|
||||||
--
|
|
||||||
-- -- Provide settings that should only apply to the "sumneko_lua" server
|
|
||||||
-- local lua_runtime_path = vim.split(package.path, ';')
|
|
||||||
-- table.insert(lua_runtime_path, "lua/?.lua")
|
|
||||||
-- table.insert(lua_runtime_path, "lua/?/init.lua")
|
|
||||||
-- table.insert(lua_runtime_path, vim.fn.stdpath('config') .. "lua/?.lua")
|
|
||||||
--
|
|
||||||
-- lspconfig.sumneko_lua.setup({
|
|
||||||
-- settings = {
|
|
||||||
-- Lua = {
|
|
||||||
-- runtime = {
|
|
||||||
-- -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
|
||||||
-- version = 'LuaJIT',
|
|
||||||
-- -- Setup your lua path
|
|
||||||
-- path = lua_runtime_path,
|
|
||||||
-- },
|
|
||||||
-- format = {
|
|
||||||
-- enable = true,
|
|
||||||
-- defaultConfig = {
|
|
||||||
-- keep_one_space_between_table_and_bracket = "false",
|
|
||||||
-- }
|
|
||||||
-- },
|
|
||||||
-- diagnostics = {
|
|
||||||
-- -- Get the language server to recognize the `vim` global
|
|
||||||
-- globals = {'vim'},
|
|
||||||
-- ["codestyle-check"] = "Any",
|
|
||||||
-- },
|
|
||||||
-- -- Do not send telemetry data containing a randomized but unique identifier
|
|
||||||
-- telemetry = {
|
|
||||||
-- enable = false,
|
|
||||||
-- },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
-- })
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
lsp.on_attach(function(_, bufnr)
|
||||||
|
lsp.default_keymaps({buffer = bufnr})
|
||||||
-- local lsp = require('lsp-zero')
|
end)
|
||||||
|
|
||||||
-- lsp.preset('recommended')
|
|
||||||
-- lsp.set_preferences({
|
|
||||||
-- suggest_lsp_servers = true,
|
|
||||||
-- setup_servers_on_start = true,
|
|
||||||
-- set_lsp_keymaps = true,
|
|
||||||
-- configure_diagnostics = true,
|
|
||||||
-- cmp_capabilities = true,
|
|
||||||
-- manage_nvim_cmp = true,
|
|
||||||
-- call_servers = 'local',
|
|
||||||
-- sign_icons = {
|
|
||||||
-- error = 'E',
|
|
||||||
-- warn = 'W',
|
|
||||||
-- hint = 'H',
|
|
||||||
-- info = 'I'
|
|
||||||
-- }
|
|
||||||
-- })
|
|
||||||
|
|
||||||
local lsp = require('lsp-zero').preset({
|
|
||||||
name = 'minimal',
|
|
||||||
set_lsp_keymaps = true,
|
|
||||||
manage_nvim_cmp = true,
|
|
||||||
suggest_lsp_servers = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- (Optional) Configure lua language server for neovim
|
-- (Optional) Configure lua language server for neovim
|
||||||
-- lsp.nvim_workspace()
|
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
||||||
|
|
||||||
lsp.setup()
|
lsp.setup()
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local cmp_action = require('lsp-zero').cmp_action()
|
||||||
|
|
||||||
-- should be after setup
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = true,
|
cmp.setup({
|
||||||
signs = true,
|
sources = {
|
||||||
update_in_insert = false,
|
{name = 'path'},
|
||||||
underline = true,
|
{name = 'nvim_lsp'},
|
||||||
severity_sort = false,
|
{name = 'buffer', keyword_length = 3},
|
||||||
float = true,
|
{name = 'luasnip', keyword_length = 2},
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
-- `Enter` key to confirm completion
|
||||||
|
['<CR>'] = cmp.mapping.confirm({select = false}),
|
||||||
|
['<Tab>'] = cmp_action.luasnip_supertab(),
|
||||||
|
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ local M = {}
|
|||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
vim.keymap.set('n', '<leader>ff', function() require('telescope.builtin').find_files({ hidden = true }) end)
|
vim.keymap.set('n', '<leader>ff', function() require('telescope.builtin').find_files({ hidden = true }) end)
|
||||||
|
vim.keymap.set('n', '<leader>fo', function() require('telescope.builtin').find_files({ cwd = '~/Syncthing/Obsidian/Personal/', search_file = '*.md' }) end)
|
||||||
vim.keymap.set('n', '<leader>fh', function() require('telescope.builtin').help_tags() end)
|
vim.keymap.set('n', '<leader>fh', function() require('telescope.builtin').help_tags() end)
|
||||||
-- require('telescope.builtin').find_files({ hidden = true })
|
-- require('telescope.builtin').find_files({ hidden = true })
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ opt.list = true -- List mode
|
|||||||
opt.listchars = { trail = '·', tab = '->' }
|
opt.listchars = { trail = '·', tab = '->' }
|
||||||
opt.timeoutlen = 1000 -- Delay for mappings
|
opt.timeoutlen = 1000 -- Delay for mappings
|
||||||
opt.ttimeoutlen = 0 -- Delay between modes
|
opt.ttimeoutlen = 0 -- Delay between modes
|
||||||
opt.shellcmdflag = '-ilc' -- Enables aliases from .bashrc in :! commands
|
-- TODO: leads to "bash: no job control in this shell"
|
||||||
|
-- opt.shellcmdflag = '-ilc' -- Enables aliases from .bashrc in :! commands
|
||||||
opt.termguicolors = true -- 24-bit RGB color
|
opt.termguicolors = true -- 24-bit RGB color
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -129,15 +129,10 @@ _G.packer_plugins = {
|
|||||||
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||||
},
|
},
|
||||||
["glow.nvim"] = {
|
["leap.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/glow.nvim",
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/leap.nvim",
|
||||||
url = "https://github.com/ellisonleao/glow.nvim"
|
url = "https://github.com/ggandor/leap.nvim"
|
||||||
},
|
|
||||||
["impatient.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/impatient.nvim",
|
|
||||||
url = "https://github.com/lewis6991/impatient.nvim"
|
|
||||||
},
|
},
|
||||||
["lsp-zero.nvim"] = {
|
["lsp-zero.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
@@ -179,8 +174,12 @@ _G.packer_plugins = {
|
|||||||
url = "https://github.com/neovim/nvim-lspconfig"
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
},
|
},
|
||||||
["nvim-tree.lua"] = {
|
["nvim-tree.lua"] = {
|
||||||
loaded = true,
|
commands = { "NvimTreeToggle", "NvimTreeFindFile" },
|
||||||
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
config = { "\27LJ\2\n@\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\vconfig\22plugins/nvim-tree\frequire\0" },
|
||||||
|
loaded = false,
|
||||||
|
needs_bufread = false,
|
||||||
|
only_cond = false,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua",
|
||||||
url = "https://github.com/nvim-tree/nvim-tree.lua"
|
url = "https://github.com/nvim-tree/nvim-tree.lua"
|
||||||
},
|
},
|
||||||
["nvim-treesitter"] = {
|
["nvim-treesitter"] = {
|
||||||
@@ -242,8 +241,11 @@ _G.packer_plugins = {
|
|||||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
},
|
},
|
||||||
["vim-easy-align"] = {
|
["vim-easy-align"] = {
|
||||||
loaded = true,
|
commands = { "EasyAlign" },
|
||||||
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-easy-align",
|
loaded = false,
|
||||||
|
needs_bufread = false,
|
||||||
|
only_cond = false,
|
||||||
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/opt/vim-easy-align",
|
||||||
url = "https://github.com/junegunn/vim-easy-align"
|
url = "https://github.com/junegunn/vim-easy-align"
|
||||||
},
|
},
|
||||||
["vim-fugitive"] = {
|
["vim-fugitive"] = {
|
||||||
@@ -347,6 +349,20 @@ time([[Conditional loading of telescope-fzf-native.nvim]], false)
|
|||||||
|
|
||||||
-- Command lazy-loads
|
-- Command lazy-loads
|
||||||
time([[Defining lazy-load commands]], true)
|
time([[Defining lazy-load commands]], true)
|
||||||
|
pcall(vim.api.nvim_create_user_command, 'TSPlaygroundToggle', function(cmdargs)
|
||||||
|
require('packer.load')({'playground'}, { cmd = 'TSPlaygroundToggle', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
||||||
|
end,
|
||||||
|
{nargs = '*', range = true, bang = true, complete = function()
|
||||||
|
require('packer.load')({'playground'}, {}, _G.packer_plugins)
|
||||||
|
return vim.fn.getcompletion('TSPlaygroundToggle ', 'cmdline')
|
||||||
|
end})
|
||||||
|
pcall(vim.api.nvim_create_user_command, 'EasyAlign', function(cmdargs)
|
||||||
|
require('packer.load')({'vim-easy-align'}, { cmd = 'EasyAlign', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
||||||
|
end,
|
||||||
|
{nargs = '*', range = true, bang = true, complete = function()
|
||||||
|
require('packer.load')({'vim-easy-align'}, {}, _G.packer_plugins)
|
||||||
|
return vim.fn.getcompletion('EasyAlign ', 'cmdline')
|
||||||
|
end})
|
||||||
pcall(vim.api.nvim_create_user_command, 'StartupTime', function(cmdargs)
|
pcall(vim.api.nvim_create_user_command, 'StartupTime', function(cmdargs)
|
||||||
require('packer.load')({'vim-startuptime'}, { cmd = 'StartupTime', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
require('packer.load')({'vim-startuptime'}, { cmd = 'StartupTime', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
||||||
end,
|
end,
|
||||||
@@ -354,12 +370,19 @@ pcall(vim.api.nvim_create_user_command, 'StartupTime', function(cmdargs)
|
|||||||
require('packer.load')({'vim-startuptime'}, {}, _G.packer_plugins)
|
require('packer.load')({'vim-startuptime'}, {}, _G.packer_plugins)
|
||||||
return vim.fn.getcompletion('StartupTime ', 'cmdline')
|
return vim.fn.getcompletion('StartupTime ', 'cmdline')
|
||||||
end})
|
end})
|
||||||
pcall(vim.api.nvim_create_user_command, 'TSPlaygroundToggle', function(cmdargs)
|
pcall(vim.api.nvim_create_user_command, 'NvimTreeToggle', function(cmdargs)
|
||||||
require('packer.load')({'playground'}, { cmd = 'TSPlaygroundToggle', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
require('packer.load')({'nvim-tree.lua'}, { cmd = 'NvimTreeToggle', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
||||||
end,
|
end,
|
||||||
{nargs = '*', range = true, bang = true, complete = function()
|
{nargs = '*', range = true, bang = true, complete = function()
|
||||||
require('packer.load')({'playground'}, {}, _G.packer_plugins)
|
require('packer.load')({'nvim-tree.lua'}, {}, _G.packer_plugins)
|
||||||
return vim.fn.getcompletion('TSPlaygroundToggle ', 'cmdline')
|
return vim.fn.getcompletion('NvimTreeToggle ', 'cmdline')
|
||||||
|
end})
|
||||||
|
pcall(vim.api.nvim_create_user_command, 'NvimTreeFindFile', function(cmdargs)
|
||||||
|
require('packer.load')({'nvim-tree.lua'}, { cmd = 'NvimTreeFindFile', l1 = cmdargs.line1, l2 = cmdargs.line2, bang = cmdargs.bang, args = cmdargs.args, mods = cmdargs.mods }, _G.packer_plugins)
|
||||||
|
end,
|
||||||
|
{nargs = '*', range = true, bang = true, complete = function()
|
||||||
|
require('packer.load')({'nvim-tree.lua'}, {}, _G.packer_plugins)
|
||||||
|
return vim.fn.getcompletion('NvimTreeFindFile ', 'cmdline')
|
||||||
end})
|
end})
|
||||||
time([[Defining lazy-load commands]], false)
|
time([[Defining lazy-load commands]], false)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user