diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-19 16:09:46 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-19 16:09:46 -0400 |
commit | 5a5a7b7ba5e5a4f83a2c76c46dd9d05bea8b88d8 (patch) | |
tree | 7c97db05fe27f1172131eb289889cf17e1c5503f /lua/plugins/keybindings.lua | |
parent | f08a1d80993366e19a5f5f8db4b2d68554317492 (diff) |
Add commenting
Diffstat (limited to 'lua/plugins/keybindings.lua')
-rw-r--r-- | lua/plugins/keybindings.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lua/plugins/keybindings.lua b/lua/plugins/keybindings.lua index cb40552..10d8436 100644 --- a/lua/plugins/keybindings.lua +++ b/lua/plugins/keybindings.lua @@ -36,6 +36,22 @@ vim.keymap.set('n', '<Leader>lr', ':Lazy restore<CR>', { noremap = true }) vim.keymap.set('n', '<Leader>lp', ':Lazy profile<CR>', { noremap = true }) vim.keymap.set('n', '<Leader>ld', ':Lazy debug<CR>', { noremap = true }) +-- ==============Comments============ +-- Comment out a group of lines +vim.keymap.set('x', '<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) + +-- Comment out the current line +vim.keymap.set('n', '<Leader>/', function() + local api = require('Comment.api') + api.toggle.linewise.current() +end) + + -- ============file commands========= -- write vim.keymap.set('n', '<Leader>s', ':w<CR>', { noremap = true }) |