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

49 lines
1.2 KiB
Lua

vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- Paste over without copying in the pasted over word
vim.keymap.set("x", "<leader>p", "\"_dP")
-- From old vimrc
-- Enter and space completion
local function enter_complete(seq)
local open_seq = string.sub(seq, 1, math.floor(string.len(seq)/2))
local close_seq = string.sub(seq, math.ceil(string.len(seq)/2)+1, string.len(seq))
vim.keymap.set(
"i",
string.format("%s<cr>", open_seq),
string.format("%s<cr>%s<c-o>O", open_seq, close_seq)
)
end
local function space_complete(seq)
local open_seq = string.sub(seq, 1, string.len(seq)/2)
local lefts = string.rep("<left>", string.len(seq)/2)
vim.keymap.set(
"i",
string.format("%s<space>", open_seq),
string.format("%s%s", seq, lefts)
)
end
enter_complete("{}")
enter_complete("[]")
enter_complete("({})")
space_complete("[]")
space_complete("()")
space_complete("<>")
space_complete("{}")
space_complete("({})")
-- Split management
vim.keymap.set("n", "<leader>w", "<C-w>")
vim.keymap.set("n", "<leader>ws", ":vsp<cr>")
vim.keymap.set("n", "<leader>wi", ":sp<cr>")
vim.keymap.set("n", "<leader>wt", ":tabnew<cr>")
vim.keymap.set("n", "<Leader>c", '"+')
vim.keymap.set("v", "<Leader>c", '"+')