1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
local set = vim.keymap.set
local function remapkey(mode, key, action)
vim.keymap.set(mode, key, action, { noremap = true, silent = true })
end
-- dagnostic popup
set("n", "<leader>e", ":lua vim.diagnostic.open_float()<CR>")
-- ESC insert to normal ctrl jk
-- set("i", "<C-j><C-k>", "<ESC>")
-- set("v", "t", "!pandoc -f csv -t commonmark_x<CR>")
set("v", "<m-t>", "!pandoc -f csv -t commonmark_x<CR>")
-- common save shortcuts
set("i", "<C-s>", "<ESC>:w<cr>a")
set("n", "<C-s>", ":w<cr>")
-- don't move the cursor
set("n", "J", "mzJ`z")
-- keep cursor in the middle
set("n", "<C-d>", "<C-d>zz")
set("n", "<C-u>", "<C-u>zz")
set("n", "n", "nzzzv")
set("n", "N", "Nzzzv")
-- preserve clipboard when pasting
set("x", "<space>p", '"_dp')
-- sane movement with wrap o n
remapkey({ "n", "v" }, "j", "gj")
remapkey({ "n", "v" }, "k", "gk")
remapkey({ "n", "v" }, "<Down>", "gj")
remapkey({ "n", "v" }, "<Up>", "gk")
remapkey("i", "<Down>", "<C-o>gj")
remapkey("i", "<Up>", "<C-o>gk")
-- terminal shortcuts
remapkey("i", "<C-t>", "<Esc>:term<CR>A")
remapkey("n", "<C-t", ":term<CR>A")
-- tab key in visual mode
set("v", "<Tab>", ">gv")
set("v", "<S-Tab>", "<gv")
-- visually select the characters that are wanted in the search, then type // to search for the next occurrence of the selected text
remapkey("v", "//", "y/\\V<C-R>=escape(@\",'/\\')<CR><CR>")
-- no ex mode etc
remapkey("n", "Q", "<Nop>")
remapkey("n", "<C-f>", "<Nop>")
-- center current line
remapkey("n", "cc", ":center<CR>")
-- write to files with root privileges
set("c", "w!!", ":w !sudo tee % >/dev/null")
-- blamer
-- set("", "<C-b>", ":BlamerToggle<CR>")
-- delete to void register
set({ "n", "v" }, "<leader>d", '"_d')
-- quickfix list
set("n", "<C-x>", "<cmd>cnext<CR>zz")
set("n", "C-c>", "<cmd>cprev<CR>zz")
set("n", "<leader>x", "<cmd>lnext<CR>zz")
set("n", "<leader>c", "<cmd>lprev<CR>zz")
-- typo fix
set("i", "<F1>", "<Esc>")
set("n", "q:", ":q<CR>")
vim.cmd([[
ia tongiht tonight
ia htese these
ia od do
ia nothign nothing
ia htey they
ia htem them
ia iwth with
ia maxium maximum
ia funtcion function
ia fucntion function
ia funciton function
ia dfe def
ia edn end
ia teh the
ia hte the
ia htis this
ia tihs this
ia taht that
ia retunr return
ia reutrn return
ia eariler earlier
ia ulness unless
ia ahve have
ia chatper chapter
ia colmun column
ia amster master
ia orgiin origin
ia somehting something
ia hting thing
ia orgniaztion organization
ia orgnization organization
]])
|