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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
-- ┌────────────────────────┐
-- │ ▗ │
-- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│
-- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│
-- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │
-- └────────────────────────┘
-- brute force deasciify everything
vim.keymap.set("n", "<leader>tc", "TurkishDeasciifyForce()", { expr = true })
vim.keymap.set("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", { expr = true })
vim.keymap.set("x", "<leader>tc", "TurkishDeasciifyForce()", { expr = true })
-- use turkish-mode to selectively deasciify
vim.keymap.set("n", "<Leader>tr", "TurkishDeasciify()", {expr = true})
vim.keymap.set("n", "<Leader>trtr", "TurkishDeasciify() .. '_'", {expr = true})
vim.keymap.set("x", "<Leader>tr", "TurkishDeasciify()", {expr = true})
-- ascii everything
vim.keymap.set("n", "<Leader>rt", "TurkishAsciify()", {expr = true})
vim.keymap.set("n", "<Leader>rtrt", "TurkishAsciify() .. '_'", {expr = true})
vim.keymap.set("x", "<Leader>rt", "TurkishAsciify()", {expr = true})
-- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump
-- search & highlight but do not jump
vim.keymap.set("n", "*", ":keepjumps normal! mi*`i<CR>")
vim.keymap.set("n", "#", ":keepjumps normal! mi#`i<CR>")
-- save file as sudo on files that require root permission
vim.keymap.set("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', { silent = false })
-- replace ex mode with gq (format lines)
vim.keymap.set('n', 'Q', 'gq')
-- set formatprg to sentences, for prose
vim.keymap.set('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>", { silent = false })
-- replace all is aliased to S.
vim.keymap.set('n', 'S', ':%s//g<Left><Left>', { silent = false })
vim.keymap.set('v', 'S', ':s//g<Left><Left>', { silent = false })
-- jump to buffer
vim.keymap.set('n', '<Leader>b', ':ls<cr>:b<space>')
-- up and down are more logical with g..
vim.keymap.set('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true })
vim.keymap.set('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true })
vim.keymap.set('i', '<Up>', '<Esc>gka')
vim.keymap.set('i', '<Down>', '<Esc>gja')
-- space used to toggle folds, now it's x (because x is d)
vim.keymap.set('n', '<Space>', '"_x')
-- separate cut and delete
vim.keymap.set('n', 'x', 'd')
vim.keymap.set('x', 'x', 'd')
vim.keymap.set('n', 'xx', 'dd')
vim.keymap.set('n', 'X', 'D')
-- change into pwd of current directory
vim.keymap.set('n', '<Leader>cd', ':lcd %:p:h<CR>:pwd<CR>')
-- call CreatePaper on word below cursor
vim.keymap.set('n', '<leader>np', 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>')
-- link paper
vim.keymap.set('n', '<leader>lp', 'gewi[[/papers/<ESC>Ea]]<ESC>')
-- call CreateReference on word below cursor
vim.keymap.set('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>')
-- create a new note
vim.keymap.set('n', '<leader>nn', ':call CreateNote()<CR>')
-- :%% to get current file path
vim.keymap.set('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false })
-- reselect visual selection after indent
vim.keymap.set('v', '>', '>gv')
vim.keymap.set('v', '<', '<gv')
-- keep cursor position after visual yank
vim.keymap.set('v', 'y', 'myy`y')
vim.keymap.set('v', 'Y', 'myY`y')
-- ` is more useful than `
vim.keymap.set('n', "'", '`')
-- plug mappings {{{ --
-- use the special yoink paste that rotates
vim.keymap.set('n', 'p', '<Plug>(YoinkPaste_p)')
vim.keymap.set('n', 'P', '<Plug>(YoinkPaste_P)')
-- substitute from yank
vim.keymap.set('n', '<Leader>ys', '<plug>(SubversiveSubstitute)')
vim.keymap.set('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)')
vim.keymap.set('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)')
-- substitute over range
vim.keymap.set('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
vim.keymap.set('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)')
vim.keymap.set('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)')
-- subvert over range
vim.keymap.set('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
vim.keymap.set('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)')
vim.keymap.set('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)')
-- iterate over yank list
vim.keymap.set('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)')
vim.keymap.set('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)')
-- checkmarks on vimwiki
vim.keymap.set('n', '<leader>v', '<Plug>VimwikiToggleListItem')
-- add/increase header level
vim.keymap.set('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel')
-- vim-test bindings
vim.keymap.set('n', 't<C-n>', ':TestNearest<CR>')
vim.keymap.set('n', 't<C-f>', ':TestFile<CR>')
vim.keymap.set('n', 't<C-s>', ':TestSuite<CR>')
vim.keymap.set('n', 't<C-l>', ':TestLast<CR>')
vim.keymap.set('n', 't<C-g>', ':TestVisit<CR>')
-- telescope bindings
vim.keymap.set('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>")
vim.keymap.set('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>")
vim.keymap.set('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>")
vim.keymap.set('n', '<leader>fh', "<cmd>lua require('telescope.builtin').help_tags()<cr>")
-- vista
vim.keymap.set('n', '<F3>', ":Vista focus<cr>")
vim.keymap.set('n', '<F4>', ":Vista finder<cr>")
-- nvim tree mappings
vim.keymap.set('n', 'vt', ':NvimTreeToggle<CR>')
vim.keymap.set('n', 'vr', ':NvimTreeRefresh<CR>')
vim.keymap.set('n', 'vs', ':NvimTreeFindFile<CR>')
-- dial.nvim mappings
local opts = { noremap=true, silent=true }
vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), opts)
vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), opts)
vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), opts)
vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), opts)
vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), opts)
vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), opts)
-- leap.nvim mappings
vim.keymap.set('n', '`', '<Plug>(leap-forward)', opts)
vim.keymap.set('n', '<Leader>`', '<Plug>(leap-backward)', opts)
vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts)
vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts)
-- }}} plug mappings --
|