diff --git a/nix/home-manager/modules/packages/neovim.nix b/nix/home-manager/modules/packages/neovim.nix index cbd84ec..f2c44fa 100644 --- a/nix/home-manager/modules/packages/neovim.nix +++ b/nix/home-manager/modules/packages/neovim.nix @@ -16,6 +16,9 @@ onedark.enable = true; }; plugins = { + fugitive = { + enable = true; + }; lsp = { enable = true; servers = { @@ -26,6 +29,33 @@ rust-analyzer.enable = true; }; }; + mini = { + enable = true; + ai.enable = true; + align.enable = true; + animate.enable = true; + comment.enable = true; + completion.enable = true; + indentscope.enable = true; + jump.enable = true; + jump2d = { + enable = true; + extraConfig = { + mappings.start_jumping = "a"; + }; + }; + splitjoin.enable = true; + surround.enable = true; + }; + project-nvim = { + enable = true; + }; + telescope = { + enable = true; + extraLua = { + post = builtins.readFile ./neovim/telescope.lua; + }; + }; treesitter = { enable = true; indent = true; @@ -34,46 +64,32 @@ enable = true; }; }; - mini = { - enable = true; - ai.enable = true; - align.enable = true; - animate.enable = true; - comment.enable = true; - jump.enable = true; - jump2d = { - enable = true; - extraConfig = { - mappings.start_jumping = "a"; - }; - }; - surround.enable = true; - }; - fugitive = { - enable = true; - }; undotree = { enable = true; }; which-key = { enable = true; - }; - project-nvim = { - enable = true; + groups = { + normal = { + "f" = "Telescope - Find"; + "r" = "View registers"; + "p" = "Telescope - LSP"; + }; + }; }; }; extraPlugins = ( with pkgs.vimPlugins; [ - vim-ReplaceWithRegister - ctrlp-vim - vim-dispatch-neovim - vim-bbye editorconfig-nvim + leap-nvim + telescope-zf-native-nvim + vim-ReplaceWithRegister + vim-bbye + vim-dispatch-neovim vim-expand-region vim-signify vim-terraform - leap-nvim ] ) ++ (with pkgs.vimExtraPlugins; [ @@ -83,18 +99,23 @@ normal = { "u" = { action = "vim.cmd.UndotreeToggle"; + desc = "Toggle undotree"; }; "h" = { action = "function() vim.api.nvim_command('wincmd h') end"; + desc = "Cursor - Window left"; }; "j" = { action = "function() vim.api.nvim_command('wincmd j') end"; + desc = "Cursor - Window down"; }; "k" = { action = "function() vim.api.nvim_command('wincmd k') end"; + desc = "Cursor - Window up"; }; "l" = { action = "function() vim.api.nvim_command('wincmd l') end"; + desc = "Cursor - Window right"; }; "" = { action = "''"; @@ -104,6 +125,7 @@ }; "n" = { action = "function() vim.api.nvim_command('nohl') end"; + desc = "nohl"; }; }; visual = { diff --git a/nix/home-manager/modules/packages/neovim/core.lua b/nix/home-manager/modules/packages/neovim/core.lua index e44b3ad..558347b 100644 --- a/nix/home-manager/modules/packages/neovim/core.lua +++ b/nix/home-manager/modules/packages/neovim/core.lua @@ -27,8 +27,3 @@ vim.o.wildmode = "list:longest,full" vim.api.nvim_create_autocmd('TextYankPost', { callback = function() vim.highlight.on_yank() end }) - --- Ctrlp -vim.g.ctrlp_map = "p" -vim.g.ctrlp_cmd = "CtrlPMixed" -vim.g.ctrlp_user_command = "rg --files %s" diff --git a/nix/home-manager/modules/packages/neovim/telescope.lua b/nix/home-manager/modules/packages/neovim/telescope.lua new file mode 100644 index 0000000..f251858 --- /dev/null +++ b/nix/home-manager/modules/packages/neovim/telescope.lua @@ -0,0 +1,20 @@ +require("telescope").load_extension("zf-native") + +local builtin = require('telescope.builtin') + +-- greps +vim.keymap.set("n", 'ff', builtin.find_files, {desc = 'Find Files'}) +vim.keymap.set("n", 'fg', builtin.live_grep, {desc = 'Live Grep'}) +vim.keymap.set("n", 'fb', builtin.buffers, {desc = 'Buffers'}) + +-- register reading +vim.keymap.set("n", 'r', builtin.registers, {desc = 'View registers'}) + +-- lsp stuff +vim.keymap.set('n', 'pr', builtin.lsp_references, {desc = 'References'}) +vim.keymap.set('n', 'pi', builtin.lsp_implementations, {desc = 'Implementations'}) +vim.keymap.set('n', 'pd', builtin.lsp_definitions, {desc = 'Definitions'}) +vim.keymap.set('n', 'ps', builtin.lsp_document_symbols, {desc = 'Document Symbols'}) +vim.keymap.set('n', 'pws', builtin.lsp_workspace_symbols, {desc = 'Workspace Symbols'}) +vim.keymap.set('n', 'pwd', builtin.lsp_dynamic_workspace_symbols, {desc = 'Dynamic Workspace Symbols'}) +