Improve neovim setup

This commit is contained in:
Torjus Håkestad 2024-03-05 08:26:26 +01:00
parent 13d8a1b162
commit fc677c6270
3 changed files with 55 additions and 19 deletions

View File

@ -14,8 +14,14 @@
lsp-zero-nvim
vim-floaterm
luasnip
cmp_luasnip
lualine-nvim
vim-sleuth
copilot-lua
copilot-cmp
cmp-cmdline
cmp-buffer
catppuccin-nvim
(nvim-treesitter.withPlugins (p: [
p.tree-sitter-yaml
p.tree-sitter-nix

View File

@ -19,24 +19,6 @@ require('lspconfig').gopls.setup({
}
})
-- Cmp
local cmp = require('cmp')
local cmp_action = lsp_zero.cmp_action()
cmp.setup({
mapping = cmp.mapping.preset.insert({
-- Enter to confirm completion
['<CR>'] = cmp.mapping.confirm({select = false}),
-- Ctrl+Space to open completion menu
['<C-Space>'] = cmp.mapping.complete(),
-- Move between snippet placeholders
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
-- Scroll in completion docs
['<C-k>'] = cmp.mapping.scroll_docs(-4),
['<C-j>'] = cmp.mapping.scroll_docs(4),
})
})
-- Telescope
require('telescope').setup({
@ -115,3 +97,46 @@ require('lualine').setup({
lualine_z = { 'location' }
}
})
-- Copilot
require('copilot').setup({
suggestions = { enabled = false },
panel = { enabled = false},
})
require('copilot_cmp').setup()
-- Cmp
local cmp = require('cmp')
local cmp_action = lsp_zero.cmp_action()
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
-- Enter to confirm completion
['<CR>'] = cmp.mapping.confirm({select = false}),
-- Ctrl+Space to open completion menu
['<C-Space>'] = cmp.mapping.complete(),
-- Move between snippet placeholders
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
-- Scroll in completion docs
['<C-k>'] = cmp.mapping.scroll_docs(-4),
['<C-j>'] = cmp.mapping.scroll_docs(4),
}),
sources = cmp.config.sources({
}, {
{ name = "copilot", group_index = 2 },
{ name = "luasnip" },
{ name = "buffer" },
})
})
-- Colorscheme
require('catppuccin').setup({
})
vim.cmd.colorscheme "catppuccin"

View File

@ -3,7 +3,7 @@
# Generic tools
age
alacritty
btop
unstable.btop
bzip2
croc
easyeffects
@ -49,6 +49,11 @@
delve
gopls
# js/ts
nodejs
nodePackages.pnpm
typescript
# Py stuff
python3
poetry