From 5a5a7b7ba5e5a4f83a2c76c46dd9d05bea8b88d8 Mon Sep 17 00:00:00 2001 From: bpc2003 Date: Mon, 19 May 2025 16:09:46 -0400 Subject: Add commenting --- lua/plugins/keybindings.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lua/plugins/keybindings.lua') 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', 'lr', ':Lazy restore', { noremap = true }) vim.keymap.set('n', 'lp', ':Lazy profile', { noremap = true }) vim.keymap.set('n', 'ld', ':Lazy debug', { noremap = true }) +-- ==============Comments============ +-- Comment out a group of lines +vim.keymap.set('x', '/', function() + local api = require('Comment.api') + local esc = vim.api.nvim_replace_termcodes('', 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', '/', function() + local api = require('Comment.api') + api.toggle.linewise.current() +end) + + -- ============file commands========= -- write vim.keymap.set('n', 's', ':w', { noremap = true }) -- cgit v1.2.3