comments: use neovim native commenting (#2861)

* comments: use neovim native commenting

* Comment mapping : remap to gc/gcc

---------

Co-authored-by: Sidhanth Rathod <siduck@tutanota.com>
This commit is contained in:
Hanxx 2024-06-01 09:38:32 +08:00 committed by GitHub
parent 722b42f2c9
commit f9ed3a79db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 25 deletions

View File

@ -44,16 +44,8 @@ map("n", "<leader>x", function()
end, { desc = "buffer close" }) end, { desc = "buffer close" })
-- Comment -- Comment
map("n", "<leader>/", function() map("n", "<leader>/", "gcc", { desc = "comment toggle", remap = true })
require("Comment.api").toggle.linewise.current() map("v", "<leader>/", "gc", { desc = "comment toggle", remap = true })
end, { desc = "comment toggle" })
map(
"v",
"<leader>/",
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
{ desc = "comment toggle" }
)
-- nvimtree -- nvimtree
map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "nvimtree toggle window" }) map("n", "<C-n>", "<cmd>NvimTreeToggle<CR>", { desc = "nvimtree toggle window" })

View File

@ -129,21 +129,6 @@ return {
end, end,
}, },
{
"numToStr/Comment.nvim",
keys = {
{ "gcc", mode = "n", desc = "comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "comment toggle linewise" },
{ "gc", mode = "x", desc = "comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "comment toggle blockwise" },
{ "gb", mode = "x", desc = "comment toggle blockwise (visual)" },
},
config = function(_, opts)
require("Comment").setup(opts)
end,
},
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" }, dependencies = { "nvim-treesitter/nvim-treesitter" },