From 7cd9208cc33d63bb2d9f44c2b37a58159169d8ff Mon Sep 17 00:00:00 2001 From: Nicolai Van der Storm Date: Fri, 20 Oct 2023 11:51:46 +0200 Subject: [PATCH] adde Commenting pluging --- nix/users/base/neovim/default.nix | 5 +++ nix/users/base/neovim/plugins/comment.lua | 49 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 nix/users/base/neovim/plugins/comment.lua diff --git a/nix/users/base/neovim/default.nix b/nix/users/base/neovim/default.nix index 8072fd7..10bb7ed 100644 --- a/nix/users/base/neovim/default.nix +++ b/nix/users/base/neovim/default.nix @@ -81,6 +81,11 @@ plugin = vimPlugins.presence-nvim; config = toLuaFile ./plugins/presence.lua; } + + { + plugin = vimPlugins.comment-vim; + config = toLuaFile ./plugins/comment.lua; + } ]; diff --git a/nix/users/base/neovim/plugins/comment.lua b/nix/users/base/neovim/plugins/comment.lua new file mode 100644 index 0000000..c3fb129 --- /dev/null +++ b/nix/users/base/neovim/plugins/comment.lua @@ -0,0 +1,49 @@ +local status, plugin = pcall(require,'Comment') +if not status then + print('Error with plugin: ', plugin) + return +end + +plugin.setup({ + ---Add a space b/w comment and the line + padding = true, + ---Whether the cursor should stay at its position + sticky = true, + ---Lines to be ignored while (un)comment + ignore = nil, + ---LHS of toggle mappings in NORMAL mode + toggler = { + ---Line-comment toggle keymap + line = 'gcc', + ---Block-comment toggle keymap + block = 'gbc', + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = 'gc', + ---Block-comment keymap + block = 'gb', + }, + ---LHS of extra mappings + extra = { + ---Add comment on the line above + above = 'gcO', + ---Add comment on the line below + below = 'gco', + ---Add comment at the end of line + eol = 'gcA', + }, + ---Enable keybindings + ---NOTE: If given `false` then the plugin won't create any mappings + mappings = { + ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + basic = true, + ---Extra mapping; `gco`, `gcO`, `gcA` + extra = true, + }, + ---Function to call before (un)comment + pre_hook = nil, + ---Function to call after (un)comment + post_hook = nil, +}) \ No newline at end of file