Set up completion/LSP properly

This commit is contained in:
Trevor Vallender 2023-04-01 20:32:16 +01:00
parent 68c2e73575
commit 4c9b323ba5
2 changed files with 46 additions and 17 deletions

View File

@ -74,22 +74,27 @@
programs.neovim = {
enable = true;
plugins = with pkgs.vimPlugins; [
telescope-nvim
gruvbox-nvim
nvim-treesitter.withAllGrammars
nvim-web-devicons
nvim-tree-lua
vim-fugitive
git-messenger-vim
nvim-lspconfig
nvim-cmp
cmp-treesitter
cmp-path
cmp-nvim-lsp
cmp-buffer
hologram-nvim
cmp-path
cmp-treesitter
cmp-vsnip
friendly-snippets # Collection of predefined snippets
fugitive-gitlab-vim
git-messenger-vim
gruvbox-nvim
hologram-nvim # For images inside kitty
nvim-cmp
nvim-dap
nvim-dap-ui
nvim-lspconfig
nvim-treesitter.withAllGrammars
nvim-tree-lua
nvim-web-devicons
telescope-nvim
vim-fugitive
vim-rhubarb # GitHub support for fugitive
vim-vsnip
vim-vsnip-integ
vimwiki
];
};

View File

@ -17,6 +17,9 @@ require("gruvbox").setup({
})
vim.cmd([[colorscheme gruvbox]])
-- Git
vim.g.fugitive_gitlab_domains = {'https://git.foxsoft.co.uk'}
-- Strip trailing spaces
vim.api.nvim_create_autocmd({"BufWritePre"}, {
pattern = { "*" },
@ -42,11 +45,32 @@ require'nvim-treesitter.configs'.setup {
}
-- Completion and LSP
require'cmp'.setup {
sources = {
{ name = 'nvim_lsp' }
}
local cmp = require'cmp'
cmp.setup {
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
{ name = 'path' },
{ name = 'treesitter' },
})
}
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require'lspconfig'.solargraph.setup {}
-- Vimwiki