Skip to content

Commit

Permalink
nvim: Configure LSPs
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhoule committed Jan 26, 2022
1 parent 4dab672 commit c992426
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 0 additions & 1 deletion hm/tom/modules/nvim/init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ nmap <silent> <leader><space> <cmd>GFiles<ENTER>
nmap <silent> <leader>rg <cmd>Rg<ENTER>
nmap <silent> <leader>gr <cmd>Rg<ENTER>
nmap <silent> <leader>b <cmd>Buffers<Enter>
nmap <silent> <leader>f <cmd>Neoformat<Enter>
" TOML comments
autocmd BufNewFile,BufRead *.toml setlocal commentstring=#%s
18 changes: 14 additions & 4 deletions hm/tom/modules/nvim/nvim-lsp-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,24 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end

local default_flags = { debounce_text_changes = 150 }

nvim_lsp.rust_analyzer.setup {
on_attach = on_attach,
init_options = {
cargo = {
runBuildScripts = true,
},
},
flags = default_flags,
}

-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'rust_analyzer', 'zls' }
local servers = { 'zls' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
flags = default_flags,
}
end

0 comments on commit c992426

Please sign in to comment.