You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.8 KiB
72 lines
1.8 KiB
local M = { |
|
"numToStr/Comment.nvim", |
|
lazy = false, |
|
dependencies = { |
|
|
|
{ |
|
"JoosepAlviste/nvim-ts-context-commentstring", |
|
event = "VeryLazy", |
|
}, |
|
}, |
|
} |
|
|
|
function M.config() |
|
local wk = require "which-key" |
|
wk.register { |
|
["<leader>/"] = { "<Plug>(comment_toggle_linewise_current)", "Comment" }, |
|
} |
|
|
|
wk.register { |
|
["<leader>/"] = { "<Plug>(comment_toggle_linewise_visual)", "Comment", mode = "v" }, |
|
} |
|
|
|
vim.g.skip_ts_context_commentstring_module = true |
|
---@diagnostic disable: missing-fields |
|
require("ts_context_commentstring").setup { |
|
enable_autocmd = false, |
|
} |
|
|
|
require("Comment").setup { |
|
---Add a space b/w comment and the line |
|
padding = true, |
|
---Whether the cursor should stay at its position |
|
sticky = true, |
|
---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 = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(), |
|
---Function to call after (un)comment |
|
-- post_hook = nil, |
|
} |
|
end |
|
|
|
return M
|
|
|