diff --git a/init.lua b/init.lua index a7188dc..eb0c153 100644 --- a/init.lua +++ b/init.lua @@ -13,3 +13,4 @@ vim.opt.rtp:prepend(lazypath) require("znvim.options") require("lazy").setup("znvim.plugins") +require("znvim.keymaps") diff --git a/lua/znvim/keymaps.lua b/lua/znvim/keymaps.lua new file mode 100644 index 0000000..24f52fc --- /dev/null +++ b/lua/znvim/keymaps.lua @@ -0,0 +1,39 @@ +vim.keymap.set("i", "jk", "") + +vim.keymap.set("n", "pl", "Lazy", { desc = "Lazy" }) + +vim.keymap.set("n", "uc", function () + if #vim.o.colorcolumn == 0 then + vim.o.colorcolumn = "80" + else + vim.o.colorcolumn = "" + end +end, { desc = "toggle 80th column" }) + +vim.keymap.set("n", "ur", function () + if vim.o.relativenumber then + vim.o.relativenumber = false + else + vim.o.relativenumber = true + end +end, { desc = "toggle relative numbers" }) + +vim.keymap.set("n", "", "m .-2==", { desc = "move up" }) +vim.keymap.set("n", "", "m .+1==", { desc = "move line down" }) +vim.keymap.set("i", "", "m .-2==gi", { desc = "move up" }) +vim.keymap.set("i", "", "m .+1==gi", { desc = "move line down" }) +vim.keymap.set("v", "", ":m '>+1gv=gv", { desc = "move lines up" }) +vim.keymap.set("v", "", ":m '<-2gv=gv", { desc = "move lines down"}) + +vim.keymap.set({ "i", "n" }, "", "noh", { desc = "clear hlsearch" }) + + +-- replace word under the cursor +vim.keymap.set("n", "ss", [[:%s/\<\>//gI]]) + +vim.keymap.set("x", "P", "\"_dP", { desc = "delete into void register and paste" }) + +vim.keymap.set("n", "", "bprevious", { desc = "prev buffer" }) +vim.keymap.set("n", "", "bnext", { desc = "next buffer" }) +vim.keymap.set("n", "[b", "bprevious", { desc = "prev buffer" }) +vim.keymap.set("n", "]b", "bnext", { desc = "next buffer" })