a simple lua script to help you comment and uncomment faster
- Single line comment/uncomment
- Visual mode multi-line comment/uncomment
- Detecting languages and using the correct comment sign
- Remapable keymap shortcuts available
Plug 'EvgeniGenchev/comment-nvim'
use({
'EvgeniGenchev/comment-nvim',
})
-- include the package in your init.lua
require('comment').setup()
You can change the shortcuts of the commands.
-- Change the default singleline comment
vim.api.nvim_set_keymap('n', '?', ':Comment<CR>', {noremap=true, silent=false})
-- Change the visual mode multiline comment
vim.api.nvim_set_keymap('v', '?', ':CommentMore<CR>', {noremap=true, silent=false})
Also you can add other languages when you require the plug-in in init.lua
.
require('comment').setup({
languages = {
sh = "#",
php = "//",
java = "//",
},
})
- add support for spaces
- add support for ranges in normal mod
- add support for multiline comment signes
Copyright © 2023-present EvgeniGenchev