Skip to content

Commit

Permalink
nvim: update completion/LSP tooling/config
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Apr 1, 2024
1 parent 41c1a05 commit b5eb2ad
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
34 changes: 31 additions & 3 deletions modules/home-manager/terminal_environment/neovim/config-lua.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,24 @@
-- Language server config
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
lspconfig.marksman.setup { capabilities = capabilities }
lspconfig.nixd.setup { capabilities = capabilities }
lspconfig.rust_analyzer.setup { capabilities = capabilities }
lspconfig.yamlls.setup {
capabilities = capabilities,
settings = {
yaml = {
schemas = {
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
},
},
},
}
vim.keymap.set('n', '<space>df', vim.diagnostic.open_float)
vim.keymap.set('n', '<space>dl', vim.diagnostic.setloclist)
Expand All @@ -14,7 +29,7 @@
callback = function(ev)
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<Leader>R', vim.lsp.buf.rename, opts)
vim.keymap.set('n', 'cr', vim.lsp.buf.rename, opts)
end,
})
Expand All @@ -28,6 +43,19 @@
end
cmp.setup({
formatting = {
format = function(entry, vim_item)
vim_item.kind = string.format('[%s]', vim_item.kind)
vim_item.menu = ({
nvim_lsp = "[LSP]",
vsnip = "[Snip]",
buffer = "[Buffer]",
path = "[Path]",
calc = "[Calc]",
})[entry.source.name]
return vim_item
end
},
completion = {
autocomplete = false,
},
Expand Down Expand Up @@ -63,9 +91,9 @@
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'path' },
}, {
{ name = 'buffer' },
{ name = 'path' },
{ name = 'calc' },
})
})
Expand Down
5 changes: 4 additions & 1 deletion modules/home-manager/terminal_environment/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@

extraPackages = with pkgs; [
universal-ctags

# Language servers
marksman
nixd
nodejs-slim
yaml-language-server
];
};
}
4 changes: 3 additions & 1 deletion modules/home-manager/terminal_environment/neovim/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
vimPlugins.nvim-cmp
vimPlugins.vim-vsnip
vimPlugins.cmp-vsnip
vimPlugins.cmp-calc
vimPlugins.cmp-buffer
vimPlugins.cmp-nvim-lsp
vimPlugins.cmp-path

Expand Down Expand Up @@ -59,7 +61,7 @@
# Query and insert unicode characters
vimPlugins.unicode-vim

# Icons (e.g. file types)for other plugins
# Icons (e.g. file types) for other plugins
vimPlugins.nvim-web-devicons

# Syntax highlighting
Expand Down

0 comments on commit b5eb2ad

Please sign in to comment.