aboutsummaryrefslogtreecommitdiff
path: root/modules/neovim/nvim/lua/config/keybinds.lua
diff options
context:
space:
mode:
authorStefan Weigl-Bosker <stefan@s00.xyz>2025-03-02 17:47:10 -0500
committerStefan Weigl-Bosker <stefan@s00.xyz>2025-03-02 17:47:10 -0500
commit3fb87c7b8b2377a2cfc0f6e2b858a5b4f96f49d6 (patch)
tree7efef9eec4b626cbcfd1d1396cb6dee4c73c7783 /modules/neovim/nvim/lua/config/keybinds.lua
parentb5e3e6f12b41a9a1133744e139c5aa47d1bee006 (diff)
downloadhome-3fb87c7b8b2377a2cfc0f6e2b858a5b4f96f49d6.tar.gz
update
Diffstat (limited to 'modules/neovim/nvim/lua/config/keybinds.lua')
-rw-r--r--modules/neovim/nvim/lua/config/keybinds.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/neovim/nvim/lua/config/keybinds.lua b/modules/neovim/nvim/lua/config/keybinds.lua
new file mode 100644
index 0000000..690a4d8
--- /dev/null
+++ b/modules/neovim/nvim/lua/config/keybinds.lua
@@ -0,0 +1,44 @@
+local map = vim.keymap.set
+
+local function nmap(lhs, rhs, opts)
+ map('n', lhs, rhs, opts)
+end
+
+local function swap(mode, bind1, bind2)
+ local tmp=bind1
+ map(mode, bind1, bind2)
+ map(mode, bind2, tmp)
+end
+
+local function swapnv(bind1, bind2)
+ swap({'n', 'v'}, bind1, bind2)
+end
+
+swapnv('m', 'h')
+swapnv('n', 'j')
+swapnv('e', 'k')
+swapnv('i', 'l')
+
+swapnv('M', 'H')
+swapnv('N', 'J')
+--swapnv('E', 'K')
+swapnv('I', 'L')
+
+nmap('<leader>tn', ':tabnew<CR>', { desc = "Open a new tab" })
+nmap('<leader>tc', ':tabc<CR>', { desc = "Close the current tab" })
+nmap('<leader>tm', ':tabp<CR>', { desc = "Go to previous tab" })
+nmap('<leader>ti', ':tabn<CR>', { desc = "Go to next tab" })
+
+nmap('<leader>wh', ':vne<CR>', { desc = "Create vertical split" })
+nmap('<leader>wv', ':new<CR>', { desc = "Create horizontal split" })
+nmap('<leader>wc', ':clo<CR>', { desc = "Close current window" })
+
+nmap('<leader>wm', '<C-w><C-h>', { desc = "Focus window left of the current one" })
+nmap('<leader>wn', '<C-w><C-j>', { desc = "Focus window below the current one" })
+nmap('<leader>we', '<C-w><C-k>', { desc = "Focus window above the current one" })
+nmap('<leader>wi', '<C-w><C-l>', { desc = "Focus window right of the current one" })
+
+nmap('<leader>fo', '<cmd>Telescope find_files<CR>', { silent = true })
+nmap('<leader>?', '<cmd>Telescope live_grep<CR>', { silent = true })
+
+nmap('<leader>to', '<cmd>te<CR>', { silent = true; desc = "Open a terminal buffer in the current window." })