diff --git a/modules/home/neovim/default.nix b/modules/home/neovim/default.nix index 137e4f9..d292341 100644 --- a/modules/home/neovim/default.nix +++ b/modules/home/neovim/default.nix @@ -16,7 +16,10 @@ defaultEditor = true; viAlias = true; vimAlias = true; - performance.byteCompileLua.enable = true; + performance = { + byteCompileLua.enable = true; + combinePlugins.enable = true; + }; colorschemes.everforest = { enable = true; diff --git a/modules/home/neovim/plugins/completion.nix b/modules/home/neovim/plugins/completion.nix index 68117aa..644c6cc 100644 --- a/modules/home/neovim/plugins/completion.nix +++ b/modules/home/neovim/plugins/completion.nix @@ -1,21 +1,35 @@ { pkgs, lib, ... }: +let + nodeBin = "${pkgs.nodejs}/bin/node"; +in { - programs.nixvim.plugins = { - lazydev.enable = true; - lspkind.enable = true; + programs.nixvim = { + extraPlugins = [ + pkgs.vimPlugins.copilot-lua + pkgs.vimPlugins.copilot-cmp + pkgs.vimPlugins.copilot-lsp + ]; - copilot-lua = { - enable = true; - settings = { - suggestion.enabled = false; - panel.enabled = false; - copilot_node_command = "${pkgs.nodejs}/bin/node"; - }; - }; + # copilot は node プロセスを起動するため、InsertEnter まで defer して起動時間を削減 + extraConfigLua = '' + vim.api.nvim_create_autocmd("InsertEnter", { + once = true, + callback = function() + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + copilot_node_command = "${nodeBin}", + }) + require("copilot_cmp").setup() + end, + }) + ''; - copilot-cmp.enable = true; + plugins = { + lazydev.enable = true; + lspkind.enable = true; - cmp = { + cmp = { enable = true; autoEnableSources = true; settings = { @@ -84,5 +98,6 @@ }; }; }; + }; }; } diff --git a/modules/home/neovim/plugins/editing.nix b/modules/home/neovim/plugins/editing.nix index a1032ff..6e941c6 100644 --- a/modules/home/neovim/plugins/editing.nix +++ b/modules/home/neovim/plugins/editing.nix @@ -12,7 +12,6 @@ in plugins = { treesitter = { enable = true; - folding.enable = true; settings = { auto_install = true; sync_install = false;