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
|
-- open project view with netrw
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
-- file splitting
vim.keymap.set("n", "<leader>vs", vim.cmd.vsplit)
vim.keymap.set("n", "<leader>hs", vim.cmd.split)
-- moving selected lines across lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- not moving cursor when bringing files up
vim.keymap.set("n", "J", "mzJ`z")
-- keep cursor in screen center when moving up and down
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
-- keep cursor in screen center when traversing in find
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("x", "<leader>p", "\"_dP")
-- Tab navigation
vim.keymap.set("n", "<C-t>n", vim.cmd.tabn)
-- go to prev error
vim.keymap.set("n", "<C-t>p", vim.cmd.tabp)
---- system clipboard
-- copying
vim.keymap.set("n", "<leader>y", [["+y]])
vim.keymap.set("v", "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
-- pasting
-- @note: for posting in insert mode use: <C-r>+
vim.keymap.set("n", "<leader>p", [["+p]])
vim.keymap.set("n", "<leader>P", [["+P]])
vim.keymap.set("v", "<leader>p", [["+p]])
-- deleting without polluting vim clipboard
vim.keymap.set({"n", "x"}, "x", [["_x]])
vim.keymap.set({"n", "x"}, "X", [["_d]])
-- global substitute the word cursor is on in current file
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
---- remapping quickfix list navigation
-- go to next error
vim.keymap.set("n", "<A-n>", function() SafeCListNav(1) end)
-- go to prev error
vim.keymap.set("n", "<A-p>", function() SafeCListNav(-1) end)
-- open error list when there are errors
vim.keymap.set("n", "<A-e>", vim.cmd.cw)
-- building
vim.keymap.set("n", "<F5>", function()
vim.cmd.Neomake{bang=true};
end)
|