43 lines
1.7 KiB
Lua
43 lines
1.7 KiB
Lua
vim.keymap.set("i", "jk", "<ESC>")
|
|
|
|
vim.keymap.set("n", "<leader>pl", "<cmd>Lazy<cr>", { desc = "Lazy" })
|
|
|
|
vim.keymap.set("n", "<leader>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", "<leader>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", "<C-A-k>", "<cmd>m .-2<cr>==", { desc = "move up" })
|
|
vim.keymap.set("n", "<C-A-j>", "<cmd>m .+1<cr>==", { desc = "move line down" })
|
|
vim.keymap.set("i", "<C-A-k>", "<Esc><cmd>m .-2<cr>==gi", { desc = "move up" })
|
|
vim.keymap.set("i", "<C-A-j>", "<Esc><cmd>m .+1<cr>==gi", { desc = "move line down" })
|
|
vim.keymap.set("v", "<C-A-j>", ":m '>+1<CR>gv=gv", { desc = "move lines up" })
|
|
vim.keymap.set("v", "<C-A-k>", ":m '<-2<CR>gv=gv", { desc = "move lines down"})
|
|
|
|
vim.keymap.set({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "clear hlsearch" })
|
|
|
|
|
|
-- replace word under the cursor
|
|
vim.keymap.set("n", "<leader>ss", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
|
|
|
vim.keymap.set("x", "<leader>P", "\"_dP", { desc = "delete into void register and paste" })
|
|
|
|
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "prev buffer" })
|
|
vim.keymap.set("n", "<S-l>", "<cmd>bnext<cr>", { desc = "next buffer" })
|
|
vim.keymap.set("n", "[b", "<cmd>bprevious<cr>", { desc = "prev buffer" })
|
|
vim.keymap.set("n", "]b", "<cmd>bnext<cr>", { desc = "next buffer" })
|
|
|
|
vim.keymap.set("n", "<leader>uf", function ()
|
|
vim.opt.foldcolumn = vim.opt.foldcolumn:get() == "0" and "4" or "0"
|
|
end, { desc = "toggle fold column" })
|