You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>u", ":Undotreeshow<CR>")
-- Save key strokes (don't require shift to enter command mode)
vim.keymap.set({ "n", "x"}, ";", ":")
-- Turn word under cursor to upper case
vim.keymap.set("i", "<c-u>", "<Esc>viwUea")
-- Turn the current word into title case
vim.keymap.set("i", "<c-t>", "<Esc>b~lea")
vim.keymap.set("n", "<leader>cd", "<cmd>lcd %:p:h<cr><cmd>pwd<cr>", {desc = "change cwd"})
-- Switch windows
vim.keymap.set("n", "<Left>", "<c-w>h")
vim.keymap.set("n", "<Right>", "<c-w>l")
vim.keymap.set("n", "<Up>", "<c-w>k")
vim.keymap.set("n", "<Down>", "<c-w>j")
-- Go to start and end of current line quickly (when in insert mode)
vim.keymap.set({"n", "i"}, "<C-A>", "<HOME>")
vim.keymap.set({"n","i"}, "<C-Z>", "<END>")
-- Go to start of command in command-line mode
vim.keymap.set("c", "<C-A>", "<HOME>")
vim.keymap.set("n", "<leader>cb", function()
local cnt = 0
local blink_times = 7
local timer = vim.loop.new_timer()
timer:start(0, 100, vim.schedule_wrap(function()
vim.cmd[[
set cursorcolumn!
set cursorline!
]]
if cnt == blink_times then
timer:close()
end
cnt = cnt + 1
end))
end)