diff options
| author | triethyl <triethylammonium@pm.me> | 2025-09-16 10:24:20 -0400 |
|---|---|---|
| committer | triethyl <triethylammonium@pm.me> | 2025-09-16 10:24:20 -0400 |
| commit | 33707edbeb8a7227e529e51436b9545cd86d8c2f (patch) | |
| tree | a03b12cb9ebaf5385632879487236ef4ab01aaae /pkgs | |
| parent | f93f626d04970ab6f3db7744e65ab70d88ecb12e (diff) | |
neovim: fixed markdown, zoxide, completion, and auto-session
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/custom-neovim/config/lua/keymaps.lua | 23 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/auto-session.lua | 10 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/completion.lua | 7 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/markdown.lua | 43 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/markview.lua | 8 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/zoxide.lua | 6 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/winbar.lua | 3 | ||||
| -rw-r--r-- | pkgs/custom-neovim/default.nix | 134 | ||||
| -rw-r--r-- | pkgs/custom-neovim/todo.md | 7 |
9 files changed, 149 insertions, 92 deletions
diff --git a/pkgs/custom-neovim/config/lua/keymaps.lua b/pkgs/custom-neovim/config/lua/keymaps.lua index fd3bb15..6831834 100644 --- a/pkgs/custom-neovim/config/lua/keymaps.lua +++ b/pkgs/custom-neovim/config/lua/keymaps.lua @@ -39,9 +39,12 @@ mapkey("n", "<leader>tc", "Close current tab", ":tabclose<cr>") mapkey("n", "<leader>w", "Manage sessions", "") mapkey("n", "<leader>ww", "Open a session", ":Autosession search<cr>", "mini.pick") mapkey("n", "<leader>wd", "Delete a session", ":Autosession delete<cr>", "mini.pick") +mapkey("n", "<leader>wr", "Restore last session", ":SessionRestore<cr>") +mapkey("n", "<leader>wp", "Purge orphaned sessions", ":SessionPurgeOrphaned<cr>") +mapkey("n", "<leader>ws", "Save session", ":SessionSave<cr>") -- Terminal -mapkey("n", "<leader>c", "Open terminal", ":botright terminal<cr>") +mapkey("n", "<leader>n", "Open terminal", ":botright terminal<cr>") -- Markview mapkey("n", "<leader>v", "Toggle markview", ":Markview<cr>", "markview.nvim") @@ -49,9 +52,17 @@ mapkey("n", "<leader>v", "Toggle markview", ":Markview<cr>", "markview.nvim") -- Toggle spellcheck mapkey("n", "zq", "Toggle spellcheck", ":set spell!<cr>") --- Really delete -mapkey({"n", "v"}, "<leader>d", "Really delete", [["_d]]) -mapkey({"n", "v"}, "<leader>x", "Really delete character", [["_x]]) +-- Spelling suggestions +mapkey("n", "z=", "Pick spelling suggestions", ":Pick spellsuggest<cr>") + +-- Do operations without yanking +mapkey({"n", "v"}, "<leader>d", "Fully delete", [["_d]]) +mapkey({"n", "v"}, "<leader>D", "Fully delete line", [["_D]]) +mapkey({"n", "v"}, "<leader>x", "Fully delete character", [["_x]]) +mapkey({"n", "v"}, "<leader>X", "Fully delete previous character", [["_X]]) +mapkey({"n", "v"}, "<leader>c", "Fully change", [["_c]]) +mapkey({"n", "v"}, "<leader>C", "Fully change line", [["_C]]) +mapkey({"v"}, "<leader>p", "Fully put", [[P]]) -- Paste on newline mapkey("n", "<leader>p", "Paste on newline", ":pu<cr>") @@ -59,8 +70,8 @@ mapkey("n", "<leader>p", "Paste on newline", ":pu<cr>") -- Visual Movement Keys mapkey({"n", "v"}, "j", "Go down visually", "gj") mapkey({"n", "v"}, "k", "Go up visually", "gk") -mapkey({"n", "v"}, "<down>", "Go down visually", "gj") -mapkey({"n", "v"}, "<up>", "Go up visually", "gk") +mapkey({"n", "v"}, "<down>", "Go down visually", "g<down>") +mapkey({"n", "v"}, "<up>", "Go up visually", "g<up>") -- Falling key mapkey("n", "<leader>u", "Make it rain", ":CellularAutomaton make_it_rain<cr>", "cellular-automaton.nvim") diff --git a/pkgs/custom-neovim/config/lua/plugins/auto-session.lua b/pkgs/custom-neovim/config/lua/plugins/auto-session.lua index b5a7a07..efbd416 100644 --- a/pkgs/custom-neovim/config/lua/plugins/auto-session.lua +++ b/pkgs/custom-neovim/config/lua/plugins/auto-session.lua @@ -2,6 +2,14 @@ return { "auto-session", lazy = false, after = function () - require("auto-session").setup() + vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions" + require("auto-session").setup { + suppressed_dirs = { + "~/", + "/", + }, + auto_restore_last_session = true, + cwd_change_handling = true, + } end } diff --git a/pkgs/custom-neovim/config/lua/plugins/completion.lua b/pkgs/custom-neovim/config/lua/plugins/completion.lua index 3228662..678b3e2 100644 --- a/pkgs/custom-neovim/config/lua/plugins/completion.lua +++ b/pkgs/custom-neovim/config/lua/plugins/completion.lua @@ -13,11 +13,12 @@ return { require("blink.cmp").setup { snippets = { preset = 'luasnip' }, sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, + default = { 'lsp', 'path', 'snippets'}, }, cmdline = { - keymap = { preset = 'inherit' }, - completion = { menu = { auto_show = true } }, + keymap = { preset = 'none' }, + -- keymap = { preset = 'inherit' }, + -- completion = { menu = { auto_show = true } }, }, } end, diff --git a/pkgs/custom-neovim/config/lua/plugins/markdown.lua b/pkgs/custom-neovim/config/lua/plugins/markdown.lua index 56f5e18..a8baf81 100644 --- a/pkgs/custom-neovim/config/lua/plugins/markdown.lua +++ b/pkgs/custom-neovim/config/lua/plugins/markdown.lua @@ -7,7 +7,15 @@ return { vim.cmd.packadd "mini.icons" end, after = function () - require('render-markdown').setup({}) + require('render-markdown').setup({ + completions = { lsp = { enabled = true } }, + heading = { border = true }, + indent = { enabled = true }, + pipe_table = { + preset = "round", + border_enabled = true, + }, + }) end }, { @@ -15,25 +23,30 @@ return { lazy = true, ft = "markdown", after = function () - require("markdown").setup {} + require("markdown").setup { + on_attach = function(bufnr) + -- Create keymap function + local mapkey = function(mode, key, desc, action, plugin) + local keymapper = plugin and require("lz.n").keymap(plugin).set or vim.keymap.set + keymapper(mode, key, action, {noremap = true, silent = true, desc = desc, buffer = bufnr}) + end + + mapkey({"n", "v"}, "<leader>m", "Manage markdown", "") + mapkey("n", "<leader>mo", "Create list item below", ":MDListItemBelow<cr>") + mapkey("n", "<leader>mO", "Create list item above", ":MDListItemAbove<cr>") + mapkey("n", "<leader>mr", "Reset list numbering", ":MDResetListNumbering<cr>") + mapkey("n", "<leader>mt", "Toggle table mode", ":Mtm<cr>") + mapkey({"n", "v"}, "<leader>mm", "Toggle checkbox", ":MDTaskToggle<cr>") + end, + } end }, { - "peek.nvim", + "markdown-table-mode.nvim", lazy = true, ft = "markdown", - after = function() - require("peek").setup() - vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) - vim.api.nvim_create_user_command("PeekClose", require("peek").close, {}) - end, - }, - { - "vim-table-mode", - lazy = true, - ft = "markdown", - before = function () - vim.g.table_mode_corner = '|' + after = function () + require('markdown-table-mode').setup() end }, } diff --git a/pkgs/custom-neovim/config/lua/plugins/markview.lua b/pkgs/custom-neovim/config/lua/plugins/markview.lua index b2f3775..0832390 100644 --- a/pkgs/custom-neovim/config/lua/plugins/markview.lua +++ b/pkgs/custom-neovim/config/lua/plugins/markview.lua @@ -1,5 +1,13 @@ return { "markview.nvim", + enabled = false, lazy = false, priority = 45, -- Load before treesitter. + after = function () + require("markview").setup { + preview = { + hybrid_modes = {"n"}, + }, + } + end } diff --git a/pkgs/custom-neovim/config/lua/plugins/zoxide.lua b/pkgs/custom-neovim/config/lua/plugins/zoxide.lua index c705705..433313e 100644 --- a/pkgs/custom-neovim/config/lua/plugins/zoxide.lua +++ b/pkgs/custom-neovim/config/lua/plugins/zoxide.lua @@ -9,7 +9,7 @@ return { "Lzi", "Tzi", }, - -- after = function () - -- require("zoxide") - -- end + before = function () + vim.g.zoxide_use_select = 1 + end } diff --git a/pkgs/custom-neovim/config/lua/winbar.lua b/pkgs/custom-neovim/config/lua/winbar.lua index 1e68c9d..8750ce4 100644 --- a/pkgs/custom-neovim/config/lua/winbar.lua +++ b/pkgs/custom-neovim/config/lua/winbar.lua @@ -156,7 +156,7 @@ local gaps = " " -- Process and apply statusline. Winbar_builder = function () - --get a table of all the winbar strings + -- get a table of all the winbar strings local winbar_strings = winbar() -- Remove empty strings to prevent concat issues @@ -170,4 +170,5 @@ Winbar_builder = function () return table.concat(winbar_strings, gaps) end +-- Set winbar vim.o.winbar = "%{%v:lua.Winbar_builder()%}" diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index abaf554..fc99a7d 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -1,70 +1,88 @@ { pkgs, inputs, -}: -inputs.mnw.lib.wrap pkgs { - neovim = pkgs.neovim-unwrapped; - plugins = with pkgs.vimPlugins; { - dev.config = { - pure = ./config; - impure = "/home/culsans/Sync/setup/pkgs/custom-neovim/config"; +}: let + # Get the markdown table mode plugin + markdown-table-mode-nvim-git = pkgs.vimUtils.buildVimPlugin { + name = "markdown-table-mode.nvim"; + version = "git"; + src = pkgs.fetchFromGitHub { + owner = "Kicamon"; + repo = "markdown-table-mode.nvim"; + rev = "bb1ea9b76c1b29e15e14806fdfbb2319df5c06f1"; + sha256 = "sha256-Pwsp9QQiADvzMjn2jSiQ/MPVCYjVnugKu55gbjvlYDk="; }; - start = [ - # Not lazy loaded. + }; +in + inputs.mnw.lib.wrap pkgs { + neovim = pkgs.neovim-unwrapped; + plugins = with pkgs.vimPlugins; { + dev.config = { + pure = ./config; + impure = "/home/culsans/Sync/setup/pkgs/custom-neovim/config"; + }; + start = [ + lz-n # Lazy loader + ]; + opt = [ + # Can be lazy loaded. - lz-n # Lazy loader - ]; - opt = [ - # Can be lazy loaded. + # UI Plugins + nvim-treesitter.withAllGrammars # All treesitter grammars + mini-clue + mini-pick + mini-files + mini-extra + mini-icons + plenary-nvim # UI library + actions-preview-nvim # Preview lsp actions - # UI Plugins - nvim-treesitter.withAllGrammars # All treesitter grammars - mini-clue - mini-pick - mini-files - mini-extra - plenary-nvim # UI library - markview-nvim # Previews for markdown and more - actions-preview-nvim # Preview lsp actions + # Completion Plugins + blink-cmp + luasnip + friendly-snippets - # Completion Plugins - blink-cmp - luasnip - friendly-snippets + # Utility Plugins + mini-pairs + comment-nvim + auto-session + zoxide-vim + vim-nix # Indentation for nix files + calendar-vim - # Utility Plugins - mini-pairs - comment-nvim - auto-session - zoxide-vim - vim-nix # Indentation for nix files - calendar-vim + # Git Plugins + mini-git + mini-diff + neogit - # Git Plugins - mini-git - mini-diff - neogit + # Markdown Plugns + render-markdown-nvim + markdown-nvim + markdown-table-mode-nvim-git - # Misc Plugins - presence-nvim # Discord RPC for nvim. - cellular-automaton-nvim # Fun useless plugin. + # Misc Plugins + presence-nvim # Discord RPC for nvim. + cellular-automaton-nvim # Fun useless plugin. - # Colorschemes - mini-base16 - nightfox-nvim - vim-gruvbox8 - ]; - }; - luaFiles = [./config/init.lua]; - extraBinPath = with pkgs; [ - # LSP Servers - lua-language-server - marksman - nixd + # Colorschemes + mini-base16 + nightfox-nvim + vim-gruvbox8 + ]; + }; + luaFiles = [./config/init.lua]; + extraBinPath = with pkgs; [ + # LSP Servers + lua-language-server + marksman + nixd + + # Extra Utils + ripgrep + gcc + fd - # Extra Utils - ripgrep - gcc - fd - ]; -} + # Misc Dependencies + python312Packages.pylatexenc + ]; + } diff --git a/pkgs/custom-neovim/todo.md b/pkgs/custom-neovim/todo.md index e630051..1ee9878 100644 --- a/pkgs/custom-neovim/todo.md +++ b/pkgs/custom-neovim/todo.md @@ -1,14 +1,11 @@ # Todo -- Make mini pick buffer list show modified status -- research nvim exrc for project specific config (also use to make lua ls stop showing warnings in nvim config) -- add markdown keybinds only in markdown files -- make markdown preview show current line in normal mode - make normal keybinds override calendar keybinds +- add box drawing and special comments plugin +- make <esc> hide lsp hover from K ## Eventually if Possible - Make blink.cmp not work in comments. - Make statusline progress component work in neovide. - Make custom carbon colorscheme. - |
