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.

75 lines
1.9 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")
-- Maybe getting pasting through gmosh
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
-- 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("({})")
-- 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", '"+')
-- Reload config
vim.keymap.set("n", "<leader>rc", ":so $HOME/.config/nvim/init.lua<cr>")
function WritingMode()
require("centerpad").toggle()
vim.opt.wrap = not vim.opt.wrap
end
-- Writing
vim.keymap.set('n', '<leader>z', ':lua WritingMode()<CR>')
-- Tree
vim.keymap.set("n", "<leader>nt", ":Neotree toggle<CR>")