From 6e466632d8ae6c8aeba0b6eb45aa97f71b1d86e6 Mon Sep 17 00:00:00 2001 From: Charles Danesi Date: Fri, 6 Dec 2024 08:18:11 -0500 Subject: [PATCH] add keybinds for executing lua code --- .config/nvim/lua/core/keymap.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.config/nvim/lua/core/keymap.lua b/.config/nvim/lua/core/keymap.lua index 483266c..44d0b17 100644 --- a/.config/nvim/lua/core/keymap.lua +++ b/.config/nvim/lua/core/keymap.lua @@ -14,6 +14,11 @@ keymap.set('n', 'nh', ':nohl', opts('Clear search highlights')) keymap.set({ 'n', 'v' }, 'cm', 'Noice dismiss', opts('Dismiss notifications')) keymap.set('n', '?', 'Telescope help_tags', opts('Search documentation')) +-- ──────────────────────────────────────────────────────( run code )─ +keymap.set('n', 'x', 'source %', opts('Execute the current file')) +keymap.set('n', 'cx', ':.lua', opts('Execute current line')) +keymap.set('v', 'cx', ':lua', opts('Execute selected code')) + -- ────────────────────────────────────────────────────( formatting )─ keymap.set({ 'n', 'v' }, 'F', function() require('conform').format({ @@ -232,4 +237,4 @@ keymap.set('i', '', function() else vim.opt_local.spell = true end -end, opts('Toggle spell check')) +end, opts('Toggle spell check')) \ No newline at end of file