From fc677c62706531dab74f6363c93fa8d9993deb75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 5 Mar 2024 08:26:26 +0100 Subject: [PATCH] Improve neovim setup --- home/editor/neovim/default.nix | 6 ++++ home/editor/neovim/plugins.lua | 61 ++++++++++++++++++++++++---------- home/packages/default.nix | 7 +++- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/home/editor/neovim/default.nix b/home/editor/neovim/default.nix index dbdef48..6f1f28e 100644 --- a/home/editor/neovim/default.nix +++ b/home/editor/neovim/default.nix @@ -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 diff --git a/home/editor/neovim/plugins.lua b/home/editor/neovim/plugins.lua index 7aa36d9..dfbe7e5 100644 --- a/home/editor/neovim/plugins.lua +++ b/home/editor/neovim/plugins.lua @@ -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 - [''] = cmp.mapping.confirm({select = false}), - -- Ctrl+Space to open completion menu - [''] = cmp.mapping.complete(), - -- Move between snippet placeholders - [''] = cmp_action.luasnip_jump_forward(), - [''] = cmp_action.luasnip_jump_backward(), - -- Scroll in completion docs - [''] = cmp.mapping.scroll_docs(-4), - [''] = 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 + [''] = cmp.mapping.confirm({select = false}), + -- Ctrl+Space to open completion menu + [''] = cmp.mapping.complete(), + -- Move between snippet placeholders + [''] = cmp_action.luasnip_jump_forward(), + [''] = cmp_action.luasnip_jump_backward(), + -- Scroll in completion docs + [''] = cmp.mapping.scroll_docs(-4), + [''] = 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" diff --git a/home/packages/default.nix b/home/packages/default.nix index 0ec7c6c..9558850 100644 --- a/home/packages/default.nix +++ b/home/packages/default.nix @@ -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