nvim: update

This commit is contained in:
2023-10-05 16:50:56 +03:00
parent a051a78f5d
commit c99f49cb98
5 changed files with 64 additions and 47 deletions

View File

@@ -50,8 +50,8 @@ map('v', '<', '<gv')
map('v', '>', '>gv')
-- vim-easy-align
map('x', 'ga', ':EasyAlign<CR>') -- TODO: this should allow for gaip, but does not
map('v', 'ga', ':EasyAlign<CR>')
vim.keymap.set("n", "ga", "<Plug>(EasyAlign)")
vim.keymap.set("x", "ga", "<Plug>(EasyAlign)")
-- nvim-tree.lua
nmap('<leader>n', ':NvimTreeToggle<CR>')

View 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(),
}
})

View File

@@ -70,8 +70,9 @@ packer.startup(function()
-- Vimscript
use { 'junegunn/vim-easy-align',
opt = true,
cmd = { 'EasyAlign' }
-- opt = false,
-- event = { 'BufRead', 'BufNewFile' },
-- cmd = { 'EasyAlign' }
}
use 'christoomey/vim-tmux-navigator'
@@ -97,7 +98,7 @@ packer.startup(function()
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v2.x',
branch = 'v3.x',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'}, -- Required
@@ -132,5 +133,6 @@ packer.startup(function()
end)
require('plugins.lsp')
require('plugins.cmp')
require('plugins.comment')
require('plugins.gitsigns')

View File

@@ -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.default_keymaps({buffer = bufnr})
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
-- (Optional) Configure lua language server for neovim
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = {},
handlers = { lsp_zero.default_setup },
})
lsp.setup()
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(),
lspconfig.solargraph.setup({
-- there's a very weird problem with mason-provided solargraph
-- so instead I'm using the one from asdf
cmd = { os.getenv( "HOME" ) .. "/.asdf/shims/solargraph", 'stdio' },
settings = {
solargraph = {
autoformat = true,
completion = true,
diagnostic = true,
folding = true,
references = true,
rename = true,
symbols = true
}
}
})
lspconfig.lua_ls.setup(lsp_zero.nvim_lua_ls())
lsp_zero.setup()