From 313ed251f53e6eb3dfed3cac7a6526ba9dfb642b Mon Sep 17 00:00:00 2001 From: robin Date: Sat, 30 May 2026 15:09:35 +0200 Subject: [PATCH] plugin: cozytabs --- config/lua/ivy/config/keybinds.lua | 13 --------- config/plugin/cozytabs.lua | 46 ++++++++++++++++++++++++++++++ config/plugin/keymap.bracketed.lua | 6 ---- 3 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 config/plugin/cozytabs.lua delete mode 100644 config/plugin/keymap.bracketed.lua diff --git a/config/lua/ivy/config/keybinds.lua b/config/lua/ivy/config/keybinds.lua index c8a99ae..c6ca780 100644 --- a/config/lua/ivy/config/keybinds.lua +++ b/config/lua/ivy/config/keybinds.lua @@ -32,19 +32,6 @@ vim.keymap.set("n", "", "", { desc = "edit alt file" }) -- [windows] vim.keymap.set("n", "s", "", { desc = "win prefix" }) --- [tabs] -vim.keymap.set("n", "]", vim.cmd.tabnext, { desc = "next tab" }) -vim.keymap.set("n", "[", vim.cmd.tabprev, { desc = "prev tab" }) -vim.keymap.set("n", "n", cbcall(vim.cmd, [[$tabedit]]), { desc = "open new tab" }) -vim.keymap.set("n", "d", vim.cmd.tabclose, { desc = "close current tab" }) -vim.keymap.set("n", "x", vim.cmd.tabclose, { desc = "close current tab" }) -vim.keymap.set("n", "<", function() - vim.cmd([[ -tabmove ]]) -end, { desc = "move tab to the left" }) -vim.keymap.set("n", ">", function() - vim.cmd([[ +tabmove ]]) -end, { desc = "move tab to the right" }) - -- [splits] vim.keymap.set("n", "", cbcall(vim.cmd, [[ vs | wincmd l ]]), { desc = "split file vertically" }) diff --git a/config/plugin/cozytabs.lua b/config/plugin/cozytabs.lua new file mode 100644 index 0000000..6d23c7f --- /dev/null +++ b/config/plugin/cozytabs.lua @@ -0,0 +1,46 @@ +-- go to the previous tab +vim.keymap.set("n", "[g", vim.cmd.tabprev) +-- go to the next tab +vim.keymap.set("n", "]g", vim.cmd.tabnext) +-- go to the first tab +vim.keymap.set("n", "[G", [[1tabnext]]) +-- go to the last tab +vim.keymap.set("n", "]G", [[$tabnext]]) + +-- open a new tab with the current window +vim.keymap.set("n", "", [[tab split]]) +-- open an empty tab after the last tab +vim.keymap.set( + "n", + "n", + [[$tabedit]], + { desc = "open new tab" } +) +-- go to the last accessed tab +vim.keymap.set( + "n", + "p", + [[#tabnext]], + { desc = "go to the last accessed tab" } +) +-- close the current tab +vim.keymap.set( + "n", + "c", + [[tabclose]], + { desc = "close current tab" } +) +-- move the current tab to the left +vim.keymap.set( + "n", + "<", + [[-tabmove]], + { desc = "move tab to the left" } +) +-- move the current tab to the right +vim.keymap.set( + "n", + ">", + [[+tabmove]], + { desc = "move tab to the right" } +) diff --git a/config/plugin/keymap.bracketed.lua b/config/plugin/keymap.bracketed.lua deleted file mode 100644 index b6f614e..0000000 --- a/config/plugin/keymap.bracketed.lua +++ /dev/null @@ -1,6 +0,0 @@ --- go to the previous tab -vim.keymap.set("n", "[", vim.cmd.tabprev) --- go to the next tab -vim.keymap.set("n", "]", vim.cmd.tabnext) --- create a new tab with the current window -vim.keymap.set("n", "", "tab split") -- 2.51.2