From b0e5ba4d127844f05f84b8e087b0fd60383c8df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D0=BB=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC?= Date: Sat, 6 Jun 2026 13:42:20 +0300 Subject: [PATCH] feat(plugins): Install autocomment plugin --- after/plugin/comment.lua | 47 ++++++++++++++++++++++++++++++++++++++++ lua/plugins.lua | 1 + nvim-pack-lock.json | 4 ++++ 3 files changed, 52 insertions(+) create mode 100644 after/plugin/comment.lua diff --git a/after/plugin/comment.lua b/after/plugin/comment.lua new file mode 100644 index 0000000..db69845 --- /dev/null +++ b/after/plugin/comment.lua @@ -0,0 +1,47 @@ +local comment = require("Comment") + +local options = { + ---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 = "cc", + ---Block-comment toggle keymap + block = "cb", + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = "cc", + ---Block-comment keymap + block = "cb", + }, + ---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 = false, + }, + ---Function to call before (un)comment + pre_hook = nil, + ---Function to call after (un)comment + post_hook = nil, +} + +comment.setup(options) diff --git a/lua/plugins.lua b/lua/plugins.lua index a55d308..022614d 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -42,6 +42,7 @@ vim.pack.add({ { src = "https://github.com/petertriho/nvim-scrollbar" }, { src = "https://github.com/j-hui/fidget.nvim" }, { src = "https://github.com/nvimdev/lspsaga.nvim" }, + { src = "https://github.com/numtostr/comment.nvim" }, -- Framework specific { src = "https://github.com/adibhanna/laravel.nvim" }, diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index facbbc2..ed81ba5 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -8,6 +8,10 @@ "rev": "2cb62890cee636fe46722d03b7b2331e54fb3755", "src": "https://github.com/saghen/blink.lib" }, + "comment.nvim": { + "rev": "e30b7f2008e52442154b66f7c519bfd2f1e32acb", + "src": "https://github.com/numtostr/comment.nvim" + }, "conform.nvim": { "rev": "619363c30309d29ffa631e67c8183f2a72caa373", "src": "https://github.com/stevearc/conform.nvim"