nvim: update
This commit is contained in:
@@ -50,8 +50,8 @@ map('v', '<', '<gv')
|
|||||||
map('v', '>', '>gv')
|
map('v', '>', '>gv')
|
||||||
|
|
||||||
-- vim-easy-align
|
-- vim-easy-align
|
||||||
map('x', 'ga', ':EasyAlign<CR>') -- TODO: this should allow for gaip, but does not
|
vim.keymap.set("n", "ga", "<Plug>(EasyAlign)")
|
||||||
map('v', 'ga', ':EasyAlign<CR>')
|
vim.keymap.set("x", "ga", "<Plug>(EasyAlign)")
|
||||||
|
|
||||||
-- nvim-tree.lua
|
-- nvim-tree.lua
|
||||||
nmap('<leader>n', ':NvimTreeToggle<CR>')
|
nmap('<leader>n', ':NvimTreeToggle<CR>')
|
||||||
|
|||||||
19
vim/.config/nvim/lua/plugins/cmp.lua
Normal file
19
vim/.config/nvim/lua/plugins/cmp.lua
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
local cmp = require('cmp')
|
||||||
|
local cmp_action = require('lsp-zero').cmp_action()
|
||||||
|
|
||||||
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
sources = {
|
||||||
|
{name = 'path'},
|
||||||
|
{name = 'nvim_lsp'},
|
||||||
|
{name = 'buffer', keyword_length = 3},
|
||||||
|
{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(),
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -70,8 +70,9 @@ packer.startup(function()
|
|||||||
|
|
||||||
-- Vimscript
|
-- Vimscript
|
||||||
use { 'junegunn/vim-easy-align',
|
use { 'junegunn/vim-easy-align',
|
||||||
opt = true,
|
-- opt = false,
|
||||||
cmd = { 'EasyAlign' }
|
-- event = { 'BufRead', 'BufNewFile' },
|
||||||
|
-- cmd = { 'EasyAlign' }
|
||||||
}
|
}
|
||||||
|
|
||||||
use 'christoomey/vim-tmux-navigator'
|
use 'christoomey/vim-tmux-navigator'
|
||||||
@@ -97,7 +98,7 @@ packer.startup(function()
|
|||||||
|
|
||||||
use {
|
use {
|
||||||
'VonHeikemen/lsp-zero.nvim',
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
branch = 'v2.x',
|
branch = 'v3.x',
|
||||||
requires = {
|
requires = {
|
||||||
-- LSP Support
|
-- LSP Support
|
||||||
{'neovim/nvim-lspconfig'}, -- Required
|
{'neovim/nvim-lspconfig'}, -- Required
|
||||||
@@ -132,5 +133,6 @@ packer.startup(function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
require('plugins.lsp')
|
require('plugins.lsp')
|
||||||
|
require('plugins.cmp')
|
||||||
require('plugins.comment')
|
require('plugins.comment')
|
||||||
require('plugins.gitsigns')
|
require('plugins.gitsigns')
|
||||||
|
|||||||
@@ -1,29 +1,35 @@
|
|||||||
local lsp = require('lsp-zero').preset({})
|
local lsp_zero = require('lsp-zero')
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
|
||||||
lsp.on_attach(function(_, bufnr)
|
lsp_zero.on_attach(function(client, bufnr)
|
||||||
lsp.default_keymaps({buffer = bufnr})
|
-- see :help lsp-zero-keybindings
|
||||||
|
-- to learn the available actions
|
||||||
|
lsp_zero.default_keymaps({buffer = bufnr})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- (Optional) Configure lua language server for neovim
|
require('mason').setup({})
|
||||||
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
require('mason-lspconfig').setup({
|
||||||
|
ensure_installed = {},
|
||||||
|
handlers = { lsp_zero.default_setup },
|
||||||
|
})
|
||||||
|
|
||||||
lsp.setup()
|
lspconfig.solargraph.setup({
|
||||||
local cmp = require('cmp')
|
-- there's a very weird problem with mason-provided solargraph
|
||||||
local cmp_action = require('lsp-zero').cmp_action()
|
-- so instead I'm using the one from asdf
|
||||||
|
cmd = { os.getenv( "HOME" ) .. "/.asdf/shims/solargraph", 'stdio' },
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
settings = {
|
||||||
|
solargraph = {
|
||||||
cmp.setup({
|
autoformat = true,
|
||||||
sources = {
|
completion = true,
|
||||||
{name = 'path'},
|
diagnostic = true,
|
||||||
{name = 'nvim_lsp'},
|
folding = true,
|
||||||
{name = 'buffer', keyword_length = 3},
|
references = true,
|
||||||
{name = 'luasnip', keyword_length = 2},
|
rename = true,
|
||||||
},
|
symbols = true
|
||||||
mapping = {
|
}
|
||||||
-- `Enter` key to confirm completion
|
|
||||||
['<CR>'] = cmp.mapping.confirm({select = false}),
|
|
||||||
['<Tab>'] = cmp_action.luasnip_supertab(),
|
|
||||||
['<S-Tab>'] = cmp_action.luasnip_shift_supertab(),
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
lspconfig.lua_ls.setup(lsp_zero.nvim_lua_ls())
|
||||||
|
|
||||||
|
lsp_zero.setup()
|
||||||
|
|||||||
@@ -241,11 +241,8 @@ _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"] = {
|
||||||
commands = { "EasyAlign" },
|
loaded = true,
|
||||||
loaded = false,
|
path = "/Users/madundead/.local/share/nvim/site/pack/packer/start/vim-easy-align",
|
||||||
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"] = {
|
||||||
@@ -356,20 +353,6 @@ pcall(vim.api.nvim_create_user_command, 'TSPlaygroundToggle', function(cmdargs)
|
|||||||
require('packer.load')({'playground'}, {}, _G.packer_plugins)
|
require('packer.load')({'playground'}, {}, _G.packer_plugins)
|
||||||
return vim.fn.getcompletion('TSPlaygroundToggle ', 'cmdline')
|
return vim.fn.getcompletion('TSPlaygroundToggle ', 'cmdline')
|
||||||
end})
|
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)
|
|
||||||
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,
|
|
||||||
{nargs = '*', range = true, bang = true, complete = function()
|
|
||||||
require('packer.load')({'vim-startuptime'}, {}, _G.packer_plugins)
|
|
||||||
return vim.fn.getcompletion('StartupTime ', 'cmdline')
|
|
||||||
end})
|
|
||||||
pcall(vim.api.nvim_create_user_command, 'NvimTreeToggle', function(cmdargs)
|
pcall(vim.api.nvim_create_user_command, 'NvimTreeToggle', function(cmdargs)
|
||||||
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)
|
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,
|
||||||
@@ -384,6 +367,13 @@ pcall(vim.api.nvim_create_user_command, 'NvimTreeFindFile', function(cmdargs)
|
|||||||
require('packer.load')({'nvim-tree.lua'}, {}, _G.packer_plugins)
|
require('packer.load')({'nvim-tree.lua'}, {}, _G.packer_plugins)
|
||||||
return vim.fn.getcompletion('NvimTreeFindFile ', 'cmdline')
|
return vim.fn.getcompletion('NvimTreeFindFile ', 'cmdline')
|
||||||
end})
|
end})
|
||||||
|
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)
|
||||||
|
end,
|
||||||
|
{nargs = '*', range = true, bang = true, complete = function()
|
||||||
|
require('packer.load')({'vim-startuptime'}, {}, _G.packer_plugins)
|
||||||
|
return vim.fn.getcompletion('StartupTime ', 'cmdline')
|
||||||
|
end})
|
||||||
time([[Defining lazy-load commands]], false)
|
time([[Defining lazy-load commands]], false)
|
||||||
|
|
||||||
vim.cmd [[augroup packer_load_aucmds]]
|
vim.cmd [[augroup packer_load_aucmds]]
|
||||||
|
|||||||
Reference in New Issue
Block a user