diff --git a/config.nix b/config.nix index e606821..cb63a39 100644 --- a/config.nix +++ b/config.nix @@ -4,6 +4,7 @@ ./plugins/theme.nix ./plugins/completion.nix ./plugins/lsp.nix + ./plugins/treesitter.nix ./plugins/formatter.nix ./plugins/statusline.nix ./plugins/git.nix diff --git a/flake.nix b/flake.nix index 8dd26ad..f82e19c 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' wrapProgram $out/bin/nvim \ - --prefix PATH : ${pkgs.lib.makeBinPath [pkgs.git pkgs.fzf pkgs.lazygit]} + --prefix PATH : ${pkgs.lib.makeBinPath [pkgs.git pkgs.lazygit]} ''; }; }; diff --git a/plugins/completion.nix b/plugins/completion.nix index 1481df6..b5a4ad5 100644 --- a/plugins/completion.nix +++ b/plugins/completion.nix @@ -1,29 +1,14 @@ {...}: { - vim = { - autocomplete.nvim-cmp = { - enable = true; - mappings = { - complete = ""; - close = ""; - scrollDocsUp = ""; - scrollDocsDown = ""; - confirm = ""; - next = ""; - previous = ""; - }; + vim.autocomplete.blink-cmp = { + enable = true; + mappings = { + complete = ""; + close = ""; + scrollDocsUp = ""; + scrollDocsDown = ""; + confirm = ""; + next = ""; + previous = ""; }; - - snippets.luasnip.enable = true; - - luaConfigRC.luasnip-keymaps = '' - vim.keymap.set({"i", "s"}, "", function() - local ls = require("luasnip") - if ls.expand_or_jumpable() then ls.expand_or_jump() end - end, {silent = true}) - vim.keymap.set({"i", "s"}, "", function() - local ls = require("luasnip") - if ls.jumpable(-1) then ls.jump(-1) end - end, {silent = true}) - ''; }; } diff --git a/plugins/editing.nix b/plugins/editing.nix index c416a0f..e57913d 100644 --- a/plugins/editing.nix +++ b/plugins/editing.nix @@ -1,6 +1,6 @@ {pkgs, ...}: { vim = { - autopairs.nvim-autopairs.enable = true; + mini.pairs.enable = true; comments.comment-nvim.enable = true; extraPlugins = with pkgs.vimPlugins; { diff --git a/plugins/git.nix b/plugins/git.nix index 8526dd6..4bdbf33 100644 --- a/plugins/git.nix +++ b/plugins/git.nix @@ -1,6 +1,3 @@ {...}: { - vim.git = { - gitsigns.enable = true; - vim-fugitive.enable = true; - }; + vim.git.gitsigns.enable = true; } diff --git a/plugins/lsp.nix b/plugins/lsp.nix index 5703359..ea68bab 100644 --- a/plugins/lsp.nix +++ b/plugins/lsp.nix @@ -51,10 +51,8 @@ }; keymaps = [ - {key = "ls"; mode = ["n"]; action = "FzfLua lsp_document_symbols"; desc = "Document Symbols";} - {key = "lS"; mode = ["n"]; action = "FzfLua lsp_live_workspace_symbols"; desc = "Workspace Symbols";} - {key = "la"; mode = ["n"]; lua = true; action = "function() vim.lsp.buf.code_action() end"; desc = "Code Actions";} - {key = "K"; mode = ["n"]; lua = true; action = "function() vim.lsp.buf.hover() end"; desc = "Hover Docs";} + {key = "ls"; mode = ["n"]; lua = true; action = "function() Snacks.picker.lsp_symbols() end"; desc = "Document Symbols";} + {key = "lS"; mode = ["n"]; lua = true; action = "function() Snacks.picker.lsp_workspace_symbols() end"; desc = "Workspace Symbols";} {key = "lR"; mode = ["n"]; action = "LspRestart"; desc = "Restart LSP";} ]; }; diff --git a/plugins/navigation.nix b/plugins/navigation.nix index def8fb3..0b36be1 100644 --- a/plugins/navigation.nix +++ b/plugins/navigation.nix @@ -5,16 +5,8 @@ package = harpoon2; setup = ''require("harpoon"):setup()''; }; - oil-nvim = { - package = oil-nvim; - setup = ''require("oil").setup({})''; - }; }; - fzf-lua = { - enable = true; - profile = "telescope"; - }; session.nvim-session-manager = { enable = true; @@ -30,16 +22,16 @@ {key = "3"; mode = ["n"]; lua = true; action = ''function() require("harpoon"):list():select(3) end''; desc = "Harpoon file 3";} {key = "4"; mode = ["n"]; lua = true; action = ''function() require("harpoon"):list():select(4) end''; desc = "Harpoon file 4";} - # Oil - {key = "-"; mode = ["n"]; lua = true; action = ''function() require("oil").open() end''; desc = "Open parent directory";} - {key = "-"; mode = ["n"]; lua = true; action = ''function() require("oil").open_float() end''; desc = "Open parent directory (float)";} + # Mini.files + {key = "-"; mode = ["n"]; lua = true; action = ''function() MiniFiles.open() end''; desc = "Open file explorer";} + {key = "-"; mode = ["n"]; lua = true; action = ''function() MiniFiles.open(vim.api.nvim_buf_get_name(0)) end''; desc = "Open file explorer (current file)";} - # FZF-lua - {key = "ff"; mode = ["n"]; action = "FzfLua files"; desc = "Find Files";} - {key = "fg"; mode = ["n"]; action = "FzfLua live_grep"; desc = "Live Grep";} - {key = "fb"; mode = ["n"]; action = "FzfLua buffers"; desc = "Buffer List";} - {key = "fh"; mode = ["n"]; action = "FzfLua help_tags"; desc = "Help Tags";} - {key = "fo"; mode = ["n"]; action = "FzfLua oldfiles"; desc = "Recent Files";} + # Snacks picker + {key = "ff"; mode = ["n"]; lua = true; action = "function() Snacks.picker.files() end"; desc = "Find Files";} + {key = "fg"; mode = ["n"]; lua = true; action = "function() Snacks.picker.grep() end"; desc = "Live Grep";} + {key = "fb"; mode = ["n"]; lua = true; action = "function() Snacks.picker.buffers() end"; desc = "Buffer List";} + {key = "fh"; mode = ["n"]; lua = true; action = "function() Snacks.picker.help() end"; desc = "Help Tags";} + {key = "fo"; mode = ["n"]; lua = true; action = "function() Snacks.picker.recent() end"; desc = "Recent Files";} {key = "fn"; mode = ["n"]; action = "Noice"; desc = "Notifications";} # Sessions diff --git a/plugins/snacks.nix b/plugins/snacks.nix index e316619..0481258 100644 --- a/plugins/snacks.nix +++ b/plugins/snacks.nix @@ -5,19 +5,20 @@ input.enable = true; lazygit.enable = true; rename.enable = true; + picker.enable = true; + scroll.enable = true; dashboard = { enable = true; sections = [ {section = "header";} {section = "keys"; gap = 1; padding = 1;} - {section = "startup";} ]; preset.keys = [ {icon = " "; key = "e"; action = ":ene | startinsert"; desc = "New file";} - {icon = " "; key = ",ff"; action = ":FzfLua files"; desc = "Find file";} - {icon = " "; key = ",fo"; action = ":FzfLua oldfiles"; desc = "Recently opened";} - {icon = " "; key = ",fg"; action = ":FzfLua live_grep"; desc = "Find word";} + {icon = " "; key = ",ff"; action = ":lua Snacks.picker.files()"; desc = "Find file";} + {icon = " "; key = ",fo"; action = ":lua Snacks.picker.recent()"; desc = "Recently opened";} + {icon = " "; key = ",fg"; action = ":lua Snacks.picker.grep()"; desc = "Find word";} {icon = " "; key = ",fp"; action = ":SessionManager load_session"; desc = "Open session";} {icon = " "; key = "q"; action = ":qa"; desc = "Quit";} ]; diff --git a/plugins/treesitter.nix b/plugins/treesitter.nix new file mode 100644 index 0000000..8fddb0c --- /dev/null +++ b/plugins/treesitter.nix @@ -0,0 +1,27 @@ +{...}: { + vim.treesitter.textobjects = { + enable = true; + setupOpts = { + select = { + enable = true; + lookahead = true; + keymaps = { + "af" = "@function.outer"; + "if" = "@function.inner"; + "ac" = "@class.outer"; + "ic" = "@class.inner"; + "aa" = "@parameter.outer"; + "ia" = "@parameter.inner"; + }; + }; + move = { + enable = true; + set_jumps = true; + goto_next_start."]f" = "@function.outer"; + goto_previous_start."[f" = "@function.outer"; + goto_next_end."]F" = "@function.outer"; + goto_previous_end."[F" = "@function.outer"; + }; + }; + }; +} diff --git a/plugins/ui.nix b/plugins/ui.nix index cebc981..7cb41a9 100644 --- a/plugins/ui.nix +++ b/plugins/ui.nix @@ -1,10 +1,10 @@ {...}: { vim = { - visuals.indent-blankline.enable = true; - mini = { icons.enable = true; surround.enable = true; + indentscope.enable = true; + files.enable = true; }; luaConfigRC.mini-icons-mock = ''