refactor(nvim): use builtin :h commenting
for comments
This commit is contained in:
parent
6d4ec7861d
commit
73ee308ac8
@ -121,8 +121,8 @@ M.setup = function()
|
||||
vim.keymap.set("n", "<Tab>", "za", { silent = true, desc = "Toggle Fold" })
|
||||
|
||||
-- Alias <leader>/ to toggle comments
|
||||
vim.keymap.set("n", "<leader>/", "gcc", { silent = true, desc = "Comment: Toggle Line" })
|
||||
vim.keymap.set("v", "<leader>/", "gc", { silent = true, desc = "Comment: Toggle Selection" })
|
||||
vim.keymap.set("n", "<leader>/", "gcc", { silent = true, remap = true, desc = "Comment: Toggle Line" })
|
||||
vim.keymap.set("v", "<leader>/", "gc", { silent = true, remap = true, desc = "Comment: Toggle Selection" })
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -1,51 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup({
|
||||
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
{
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
opts = function()
|
||||
vim.g.skip_ts_context_commentstring_module = true
|
||||
end,
|
||||
config = function()
|
||||
require("ts_context_commentstring").setup({
|
||||
enable_autocmd = false,
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "gc", desc = "> Comment: Line" },
|
||||
{ "gb", desc = "> Comment: Block " },
|
||||
{ "gbc", desc = "Comment: Toggle block comment" },
|
||||
{ "gcc", desc = "Comment: Toggle line comment" },
|
||||
{ "gcO", desc = "Comment: Add comment on line above" },
|
||||
{ "gco", desc = "Comment: Add comment on line below" },
|
||||
{ "gcA", desc = "Comment: Add comment at end of line" },
|
||||
{
|
||||
"<leader>/",
|
||||
function()
|
||||
local api = require("Comment.api")
|
||||
api.toggle.linewise.current()
|
||||
end,
|
||||
desc = "Comment: Toggle Linewise",
|
||||
},
|
||||
{
|
||||
"<leader>/",
|
||||
function()
|
||||
local api = require("Comment.api")
|
||||
local esc = vim.api.nvim_replace_termcodes("<ESC>", true, false, true)
|
||||
vim.api.nvim_feedkeys(esc, "nx", false)
|
||||
api.toggle.linewise(vim.fn.visualmode())
|
||||
end,
|
||||
desc = "Comment: Toggle Blockwise",
|
||||
mode = { "x" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user