From f42c1c8fdf09f0b6c43c92f15cf0d1f7356dfb0f Mon Sep 17 00:00:00 2001 From: jasmine Date: Thu, 26 Jun 2025 11:03:40 +0800 Subject: [PATCH 1/4] refactor + add some QoL plugins --- config/default.nix | 35 ++++++----- config/keymaps.nix | 29 ++++++++- .../plugins/{utils => cmp}/copilot-chat.nix | 0 config/plugins/collections/mini.nix | 19 ++++++ config/plugins/collections/snacks.nix | 41 +++++++++++++ config/plugins/editor/buffers.nix | 59 ------------------- config/plugins/editor/mini.nix | 31 ---------- config/plugins/editor/treesitter.nix | 21 ------- config/plugins/lsp/lsp.nix | 4 +- .../{utils => notes}/markdown-preview.nix | 0 .../{utils => notes}/render-markdown.nix | 0 .../{utils => notes}/todo-comments.nix | 0 config/plugins/ui/nvim-tree.nix | 4 +- config/plugins/ui/whichkey.nix | 3 + config/plugins/utils/vimwiki.nix | 5 -- 15 files changed, 113 insertions(+), 138 deletions(-) rename config/plugins/{utils => cmp}/copilot-chat.nix (100%) create mode 100644 config/plugins/collections/mini.nix create mode 100644 config/plugins/collections/snacks.nix delete mode 100644 config/plugins/editor/buffers.nix delete mode 100644 config/plugins/editor/mini.nix rename config/plugins/{utils => notes}/markdown-preview.nix (100%) rename config/plugins/{utils => notes}/render-markdown.nix (100%) rename config/plugins/{utils => notes}/todo-comments.nix (100%) delete mode 100644 config/plugins/utils/vimwiki.nix diff --git a/config/default.nix b/config/default.nix index 848ef95..7145931 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,54 +1,57 @@ {...}: { imports = [ - # General configuration. + # General Configuration ./keymaps.nix ./options.nix - # Themes + # Themes & Appearance ./plugins/themes/default.nix - # Completion + # Plugin Collections + ./plugins/collections/mini.nix + ./plugins/collections/snacks.nix + + # Completion & AI Assistancee ./plugins/cmp/cmp.nix ./plugins/cmp/copilot.nix + ./plugins/cmp/copilot-chat.nix - # Debug Adapter Protocol + # Debugging (DAP) ./plugins/dap/dap.nix ./plugins/dap/dap-ui.nix ./plugins/dap/dap-virtual-text.nix ./plugins/dap/dap-python.nix - # Editor plugins and configurations - ./plugins/editor/buffers.nix + # Editor Enhancements ./plugins/editor/commentary.nix ./plugins/editor/harpoon.nix - ./plugins/editor/mini.nix ./plugins/editor/sessions.nix ./plugins/editor/smart-splits.nix ./plugins/editor/surround.nix ./plugins/editor/treesitter.nix - # UI plugins + # User Interface Plugins ./plugins/ui/lualine.nix ./plugins/ui/nvim-tree.nix ./plugins/ui/web-devicons.nix ./plugins/ui/whichkey.nix - # LSP and formatting + # LSP and Formatting ./plugins/lsp/conform.nix ./plugins/lsp/lsp.nix - # Git + # Git Integration ./plugins/git/fugitive.nix ./plugins/git/gitsigns.nix - # Utils - ./plugins/utils/copilot-chat.nix - ./plugins/utils/markdown-preview.nix - ./plugins/utils/render-markdown.nix + # Markdown, Notes & Productivity + ./plugins/notes/markdown-preview.nix + ./plugins/notes/render-markdown.nix + ./plugins/notes/todo-comments.nix + + # Utilities ./plugins/utils/oil.nix ./plugins/utils/telescope.nix - ./plugins/utils/todo-comments.nix ./plugins/utils/vimtex.nix - ./plugins/utils/vimwiki.nix ]; } diff --git a/config/keymaps.nix b/config/keymaps.nix index 0bbc0f0..b9256dd 100644 --- a/config/keymaps.nix +++ b/config/keymaps.nix @@ -11,7 +11,7 @@ }; } - { # prefix: find + { mode = ["n"]; key = "f"; action = ""; @@ -19,5 +19,32 @@ desc = "+find"; }; } + + { + mode = ["n"]; + key = ""; + action = ""; + options = { + silent = true; + }; + } + + { + mode = ["n"]; + key = ""; + action = ""; + options = { + silent = true; + }; + } + + { + mode = ["n"]; + key = ""; + action = "zz"; + options = { + silent = true; + }; + } ]; } diff --git a/config/plugins/utils/copilot-chat.nix b/config/plugins/cmp/copilot-chat.nix similarity index 100% rename from config/plugins/utils/copilot-chat.nix rename to config/plugins/cmp/copilot-chat.nix diff --git a/config/plugins/collections/mini.nix b/config/plugins/collections/mini.nix new file mode 100644 index 0000000..2691f24 --- /dev/null +++ b/config/plugins/collections/mini.nix @@ -0,0 +1,19 @@ +{...}:{ + plugins.mini = { + enable = true; + + # Extend and create a/i textobjects. + modules.ai = { + # Number of lines within which textobject is searched + n_lines = 50; + + # How to search for object + search_method = "cover_or_next"; + }; + + # Go forward/backward with square brackets. + modules.bracketed = { }; + + modules.align = { }; + }; +} diff --git a/config/plugins/collections/snacks.nix b/config/plugins/collections/snacks.nix new file mode 100644 index 0000000..fa77338 --- /dev/null +++ b/config/plugins/collections/snacks.nix @@ -0,0 +1,41 @@ +{...}:{ + plugins.snacks = { + enable = true; + + settings = { + bufdelete = { + enabled = true; + }; + + scroll = { + enabled = true; + }; + }; + }; + + keymaps = [ + { + mode = ["n"]; + key = "q"; + action = { + __raw = "function() require('snacks').bufdelete() end"; + }; + options = { + desc = "Close current buffer"; + silent = true; + }; + } + + { + mode = ["n"]; + key = "Q"; + action = { + __raw = "function() require('snacks').bufdelete.other() end"; + }; + options = { + desc = "Close other buffers"; + silent = true; + }; + } + ]; +} diff --git a/config/plugins/editor/buffers.nix b/config/plugins/editor/buffers.nix deleted file mode 100644 index ccff402..0000000 --- a/config/plugins/editor/buffers.nix +++ /dev/null @@ -1,59 +0,0 @@ -{...}: { - plugins.bufdelete = { - enable = true; - }; - - keymaps = [ - { - # buffer prefix - mode = "n"; - key = "b"; - action = ""; - options = { - desc = "+buffer"; - }; - } - - { - # goto next buffer - mode = ["n"]; - key = "]b"; - action = ":bnext"; - options = { - silent = true; - }; - } - - { - # goto previous buffer - mode = ["n"]; - key = "[b"; - action = ":bprevious"; - options = { - silent = true; - }; - } - - { - # delete buffer - mode = ["n"]; - key = "bd"; - action = ":Bdelete"; - options = { - desc = "bdelete"; - silent = true; - }; - } - - { - # wipeout buffer - mode = ["n"]; - key = "bw"; - action = ":Bwipeout"; - options = { - desc = "bwipeout"; - silent = true; - }; - } - ]; -} diff --git a/config/plugins/editor/mini.nix b/config/plugins/editor/mini.nix deleted file mode 100644 index ebd2c40..0000000 --- a/config/plugins/editor/mini.nix +++ /dev/null @@ -1,31 +0,0 @@ -{...}:{ - plugins.mini = { - enable = true; - - # Extend and create a/i textobjects. - modules.ai = { - # Module mappings. - mappings = { - # Main textobject prefixes - around = "a"; - inside = "i"; - - # Next/last variants - around_next = "an"; - inside_next = "in"; - around_last = "al"; - inside_last = "il"; - - # Move cursor to corresponding edge of `a` textobject - goto_left = "g["; - goto_right = "g]"; - }; - - # Number of lines within which textobject is searched - n_lines = 50; - - # How to search for object - search_method = "cover_or_next"; - }; - }; -} diff --git a/config/plugins/editor/treesitter.nix b/config/plugins/editor/treesitter.nix index 67a5e4e..d9dba45 100644 --- a/config/plugins/editor/treesitter.nix +++ b/config/plugins/editor/treesitter.nix @@ -18,25 +18,4 @@ # Install all grammar packages. grammarPackages = pkgs.vimPlugins.nvim-treesitter.allGrammars; }; - - # Refactor modules for nvim-treesitter - plugins.treesitter-refactor = { - enable = true; - - # Highlights definitions and usages. - highlightDefinitions = { - enable = true; - }; - - # Provides "go to usage" - navigation = { - enable = true; - - # Go to the next / previous usage. - keymaps = { - gotoNextUsage = "]u"; - gotoPreviousUsage = "[u"; - }; - }; - }; } diff --git a/config/plugins/lsp/lsp.nix b/config/plugins/lsp/lsp.nix index 2a4c4f7..f7c02c8 100644 --- a/config/plugins/lsp/lsp.nix +++ b/config/plugins/lsp/lsp.nix @@ -49,8 +49,6 @@ # Configure keymaps for our diagnostics. diagnostic = { "d" = "open_float"; # Show diagnostics in floating window. - "[d" = "goto_prev"; # Jump to previous diagnostic. - "]d" = "goto_next"; # Jump to next diagnostic. }; # Configure keymaps for our lspbuf. lspBuf = { @@ -65,7 +63,7 @@ # Renames all references to the symbol under the cursor. "r" = { action = "rename"; - desc = "Rename"; + desc = "Rename reference"; }; }; diff --git a/config/plugins/utils/markdown-preview.nix b/config/plugins/notes/markdown-preview.nix similarity index 100% rename from config/plugins/utils/markdown-preview.nix rename to config/plugins/notes/markdown-preview.nix diff --git a/config/plugins/utils/render-markdown.nix b/config/plugins/notes/render-markdown.nix similarity index 100% rename from config/plugins/utils/render-markdown.nix rename to config/plugins/notes/render-markdown.nix diff --git a/config/plugins/utils/todo-comments.nix b/config/plugins/notes/todo-comments.nix similarity index 100% rename from config/plugins/utils/todo-comments.nix rename to config/plugins/notes/todo-comments.nix diff --git a/config/plugins/ui/nvim-tree.nix b/config/plugins/ui/nvim-tree.nix index 49535b5..d290274 100644 --- a/config/plugins/ui/nvim-tree.nix +++ b/config/plugins/ui/nvim-tree.nix @@ -31,7 +31,7 @@ key = "n"; action = "NvimTreeToggle"; options = { - desc = "Toggle NvimTree"; + desc = "Toggle file explorer"; }; } @@ -40,7 +40,7 @@ key = "e"; action = "NvimTreeFocus"; options = { - desc = "Focus NvimTree"; + desc = "Focus file explorer"; }; } ]; diff --git a/config/plugins/ui/whichkey.nix b/config/plugins/ui/whichkey.nix index 9558011..cc140b6 100644 --- a/config/plugins/ui/whichkey.nix +++ b/config/plugins/ui/whichkey.nix @@ -3,6 +3,9 @@ enable = true; settings = { preset = "modern"; + icons = { + mappings = false; + }; }; }; diff --git a/config/plugins/utils/vimwiki.nix b/config/plugins/utils/vimwiki.nix deleted file mode 100644 index 8244b61..0000000 --- a/config/plugins/utils/vimwiki.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - plugins.vimwiki = { - enable = true; - }; -} From e9e7399c049f74dc316c520cecd4c65b4135407d Mon Sep 17 00:00:00 2001 From: jasmine Date: Thu, 26 Jun 2025 19:26:50 +0800 Subject: [PATCH 2/4] Setup neorg plugin --- config/default.nix | 1 + config/options.nix | 5 +++- config/plugins/cmp/cmp.nix | 4 +++ config/plugins/notes/neorg.nix | 48 ++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 config/plugins/notes/neorg.nix diff --git a/config/default.nix b/config/default.nix index 7145931..100e0b3 100644 --- a/config/default.nix +++ b/config/default.nix @@ -46,6 +46,7 @@ # Markdown, Notes & Productivity ./plugins/notes/markdown-preview.nix + ./plugins/notes/neorg.nix ./plugins/notes/render-markdown.nix ./plugins/notes/todo-comments.nix diff --git a/config/options.nix b/config/options.nix index b2857ca..8fdd157 100644 --- a/config/options.nix +++ b/config/options.nix @@ -6,7 +6,6 @@ showmode = false; swapfile = false; clipboard = "unnamedplus"; - conceallevel = 1; updatetime=100; undofile = true; splitright = true; @@ -17,6 +16,10 @@ shiftwidth = 2; expandtab = true; + # Required for neorg + conceallevel = 2; + foldlevel = 99; + # Using this config for sessionoptions is recommended: sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"; }; diff --git a/config/plugins/cmp/cmp.nix b/config/plugins/cmp/cmp.nix index b6e472c..73a9348 100644 --- a/config/plugins/cmp/cmp.nix +++ b/config/plugins/cmp/cmp.nix @@ -27,6 +27,10 @@ { # VimTex name = "vimtex"; } + + { # Neorg + name = "neorg"; + } ]; # Key mappings for the completion menu. diff --git a/config/plugins/notes/neorg.nix b/config/plugins/notes/neorg.nix new file mode 100644 index 0000000..24dc837 --- /dev/null +++ b/config/plugins/notes/neorg.nix @@ -0,0 +1,48 @@ +{...}:{ + plugins.neorg = { + enable = true; + + # Settings for the Neorg plugin + settings = { + load = { + # Load the core modules for Neorg + "core.defaults" = { + __empty = null; + }; + + # Display markup as icons, not text + "core.concealer" = { + __empty = null; + }; + + # Handle collections of notes + "core.dirman" = { + config = { + workspaces = { + notes = "~/Notes"; + }; + default_workspace = "notes"; + }; + }; + + # Treesitter integration + "core.integrations.treesitter" = { + config = { + install_parsers = true; + configure_parsers = true; + }; + }; + + # Enable completions with nvim-cmp + "core.completion" = { + config = { + engine = "nvim-cmp"; + }; + }; + "core.integrations.nvim-cmp" = { + __empty = null; + }; + }; + }; + }; +} From 1ea8f940947d1d50097b2a1c27b98016630508d1 Mon Sep 17 00:00:00 2001 From: jasmine Date: Thu, 26 Jun 2025 19:27:16 +0800 Subject: [PATCH 3/4] fix multiplexer integration --- config/plugins/editor/smart-splits.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/plugins/editor/smart-splits.nix b/config/plugins/editor/smart-splits.nix index c87d280..e85b9cc 100644 --- a/config/plugins/editor/smart-splits.nix +++ b/config/plugins/editor/smart-splits.nix @@ -3,7 +3,7 @@ enable = true; settings = { - multiplexer_integration = "WezTerm"; + multiplexer_integration = "wezterm"; }; }; From 8e03a31999b3b4c124daa5a38ff8b89a472b254c Mon Sep 17 00:00:00 2001 From: jasmine Date: Thu, 26 Jun 2025 19:27:45 +0800 Subject: [PATCH 4/4] set backspace as local leader --- config/keymaps.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/keymaps.nix b/config/keymaps.nix index b9256dd..90d2d91 100644 --- a/config/keymaps.nix +++ b/config/keymaps.nix @@ -1,5 +1,8 @@ {...}: { globals.mapleader = " "; + globals.maplocalleader = { + __raw = "vim.api.nvim_replace_termcodes('', false, false, true)"; + }; keymaps = [ {