From 5aaf50744a115ebbc123d7fb389bd3bcbb1cd963 Mon Sep 17 00:00:00 2001 From: Stefan Weigl-Bosker Date: Thu, 19 Jun 2025 10:24:34 -0400 Subject: modules/nvim: rework --- modules/neovim/nvim/lua/config/keybinds.lua | 51 ++++++++++++++++------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'modules/neovim/nvim/lua/config/keybinds.lua') diff --git a/modules/neovim/nvim/lua/config/keybinds.lua b/modules/neovim/nvim/lua/config/keybinds.lua index 4f8df1b..8dbc0fc 100644 --- a/modules/neovim/nvim/lua/config/keybinds.lua +++ b/modules/neovim/nvim/lua/config/keybinds.lua @@ -14,15 +14,15 @@ 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') +-- 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('tn', ':tabnew', { desc = "Open a new tab" }) nmap('tc', ':tabc', { desc = "Close the current tab" }) @@ -37,29 +37,34 @@ nmap('wm', '', { desc = "Focus window left of the current one" nmap('wn', '', { desc = "Focus window below the current one" }) nmap('we', '', { desc = "Focus window above the current one" }) nmap('wi', '', { desc = "Focus window right of the current one" }) --- nmap('', '', { desc = "Focus window left of the current one" }) --- nmap('', '', { desc = "Focus window below the current one" }) --- nmap('', '', { desc = "Focus window above the current one" }) --- nmap('', '', { desc = "Focus window right of the current one" }) map({'n', 't', 'i'}, '', function() require("tmux").move_left() end, { desc = "Focus window left of the current one" }) map({'n', 't', 'i'}, '', function() require("tmux").move_bottom() end, { desc = "Focus window below the current one" }) map({'n', 't', 'i'}, '', function() require("tmux").move_top() end, { desc = "Focus window above the current one" }) map({'n', 't', 'i'}, '', function() require("tmux").move_right() end, { desc = "Focus window right of the current one" }) + map({'n', 't', 'i'}, '', function() require("tmux").resize_left() end, { desc = "Resize left side of split" }) map({'n', 't', 'i'}, '', function() require("tmux").resize_bottom() end, { desc = "Resize bottom side of split" }) map({'n', 't', 'i'}, '', function() require("tmux").resize_top() end, { desc = "Resize top side of split" }) map({'n', 't', 'i'}, '', function() require("tmux").resize_right() end, { desc = "Resize right side of split" }) --- nmap('fo', 'Telescope find_files', { silent = true }) -nmap('fo', 'FzfLua files', { silent = true }) --- nmap('fe', 'lua require("oil").open(nil, { preview = { split = "aboveleft" } })', { silent = true }) -nmap('fe', 'lua require("oil").toggle_float()', { silent = true }) - --- nmap('?', 'Telescope live_grep', { silent = true }) -nmap('?', 'FzfLua live_grep_native', { silent = true }) +nmap('fo', 'Telescope find_files', { silent = true }) +nmap('?', 'Telescope live_grep', { silent = true }) nmap('to', 'te', { silent = true; desc = "Open a terminal buffer in the current window." }) - - - +vim.api.nvim_create_autocmd({ 'FileType' }, { + pattern = '*', + callback = function() + local opts = { buffer = true } + local langs = require'treesj.langs'['presets'] + if langs[vim.bo.filetype] then + vim.keymap.set('n', 'S', 'TSJToggle', opts) + vim.keymap.set('n', 'gS', 'TSJSplit', opts) + vim.keymap.set('n', 'gJ', 'TSJJoin', opts) + else + vim.keymap.set('n', 'S', 'lua MiniSplitJoin.toggle()', opts) + vim.keymap.set('n', 'gS', 'lua MiniSplitJoin.split()', opts) + vim.keymap.set('n', 'gJ', 'lua MiniSplitJoin.join()', opts) + end + end +}) -- cgit v1.2.3