diff options
Diffstat (limited to '.config/nvim/lua/mappings.lua')
-rw-r--r-- | .config/nvim/lua/mappings.lua | 183 |
1 files changed, 0 insertions, 183 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua deleted file mode 100644 index adc68a9..0000000 --- a/.config/nvim/lua/mappings.lua +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | -- ┌────────────────────────┐ | ||
2 | -- │ ▗ │ | ||
3 | -- │▛▚▀▖▝▀▖▛▀▖▛▀▖▄ ▛▀▖▞▀▌▞▀▘│ | ||
4 | -- │▌▐ ▌▞▀▌▙▄▘▙▄▘▐ ▌ ▌▚▄▌▝▀▖│ | ||
5 | -- │▘▝ ▘▝▀▘▌ ▌ ▀▘▘ ▘▗▄▘▀▀ │ | ||
6 | -- └────────────────────────┘ | ||
7 | |||
8 | -- brute force deasciify everything | ||
9 | vim.keymap.set("n", "<leader>tc", "TurkishDeasciifyForce()", { expr = true }) | ||
10 | vim.keymap.set("n", "<leader>tctc", "TurkishDeasciifyForce() .. '_'", { expr = true }) | ||
11 | vim.keymap.set("x", "<leader>tc", "TurkishDeasciifyForce()", { expr = true }) | ||
12 | |||
13 | -- use turkish-mode to selectively deasciify | ||
14 | vim.keymap.set("n", "<Leader>tr", "TurkishDeasciify()", {expr = true}) | ||
15 | vim.keymap.set("n", "<Leader>trtr", "TurkishDeasciify() .. '_'", {expr = true}) | ||
16 | vim.keymap.set("x", "<Leader>tr", "TurkishDeasciify()", {expr = true}) | ||
17 | |||
18 | -- ascii everything | ||
19 | vim.keymap.set("n", "<Leader>rt", "TurkishAsciify()", {expr = true}) | ||
20 | vim.keymap.set("n", "<Leader>rtrt", "TurkishAsciify() .. '_'", {expr = true}) | ||
21 | vim.keymap.set("x", "<Leader>rt", "TurkishAsciify()", {expr = true}) | ||
22 | |||
23 | -- https://stackoverflow.com/questions/4256697/vim-search-and-highlight-but-do-not-jump | ||
24 | -- search & highlight but do not jump | ||
25 | vim.keymap.set("n", "*", ":keepjumps normal! mi*`i<CR>") | ||
26 | vim.keymap.set("n", "#", ":keepjumps normal! mi#`i<CR>") | ||
27 | |||
28 | -- save file as sudo on files that require root permission | ||
29 | vim.keymap.set("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', { silent = false }) | ||
30 | |||
31 | -- replace ex mode with gq (format lines) | ||
32 | vim.keymap.set('n', 'Q', 'gq') | ||
33 | |||
34 | -- set formatprg to sentences, for prose | ||
35 | vim.keymap.set('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>", { silent = false }) | ||
36 | |||
37 | -- replace all is aliased to S. | ||
38 | vim.keymap.set('n', 'S', ':%s//g<Left><Left>', { silent = false }) | ||
39 | vim.keymap.set('v', 'S', ':s//g<Left><Left>', { silent = false }) | ||
40 | |||
41 | -- jump to buffer | ||
42 | vim.keymap.set('n', '<Leader>b', ':ls<cr>:b<space>') | ||
43 | |||
44 | -- up and down are more logical with g.. | ||
45 | vim.keymap.set('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true }) | ||
46 | vim.keymap.set('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true }) | ||
47 | vim.keymap.set('i', '<Up>', '<Esc>gka') | ||
48 | vim.keymap.set('i', '<Down>', '<Esc>gja') | ||
49 | |||
50 | -- space used to toggle folds, now it's x (because x is d) | ||
51 | vim.keymap.set('n', '<Space>', '"_x') | ||
52 | |||
53 | -- separate cut and delete | ||
54 | vim.keymap.set('n', 'x', 'd') | ||
55 | vim.keymap.set('x', 'x', 'd') | ||
56 | vim.keymap.set('n', 'xx', 'dd') | ||
57 | vim.keymap.set('n', 'X', 'D') | ||
58 | |||
59 | -- change into pwd of current directory | ||
60 | vim.keymap.set('n', '<Leader>cd', ':lcd %:p:h<CR>:pwd<CR>') | ||
61 | |||
62 | -- call CreatePaper on word below cursor | ||
63 | vim.keymap.set('n', '<leader>np', 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>') | ||
64 | |||
65 | -- link paper | ||
66 | vim.keymap.set('n', '<leader>lp', 'gewi[[/papers/<ESC>Ea]]<ESC>') | ||
67 | |||
68 | -- call CreateReference on word below cursor | ||
69 | vim.keymap.set('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>') | ||
70 | |||
71 | -- create a new note | ||
72 | vim.keymap.set('n', '<leader>nn', ':call CreateNote()<CR>') | ||
73 | |||
74 | -- :%% to get current file path | ||
75 | vim.keymap.set('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false }) | ||
76 | |||
77 | -- reselect visual selection after indent | ||
78 | vim.keymap.set('v', '>', '>gv') | ||
79 | vim.keymap.set('v', '<', '<gv') | ||
80 | |||
81 | -- keep cursor position after visual yank | ||
82 | vim.keymap.set('v', 'y', 'myy`y') | ||
83 | vim.keymap.set('v', 'Y', 'myY`y') | ||
84 | |||
85 | -- ` is more useful than ` | ||
86 | vim.keymap.set('n', "'", '`') | ||
87 | |||
88 | -- plug mappings {{{ -- | ||
89 | |||
90 | -- use the special yoink paste that rotates | ||
91 | vim.keymap.set('n', 'p', '<Plug>(YoinkPaste_p)') | ||
92 | vim.keymap.set('n', 'P', '<Plug>(YoinkPaste_P)') | ||
93 | |||
94 | -- substitute from yank | ||
95 | vim.keymap.set('n', '<Leader>ys', '<plug>(SubversiveSubstitute)') | ||
96 | vim.keymap.set('n', '<Leader>yss', '<plug>(SubversiveSubstituteLine)') | ||
97 | vim.keymap.set('n', '<Leader>yS', '<plug>(SubversiveSubstituteToEndOfLine)') | ||
98 | |||
99 | -- substitute over range | ||
100 | vim.keymap.set('n', '<Leader>s', '<plug>(SubversiveSubstituteRange)') | ||
101 | vim.keymap.set('x', '<Leader>s', '<plug>(SubversiveSubstituteRange)') | ||
102 | vim.keymap.set('n', '<Leader>ss', '<plug>(SubversiveSubstituteWordRange)') | ||
103 | |||
104 | -- subvert over range | ||
105 | vim.keymap.set('n', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') | ||
106 | vim.keymap.set('x', '<Leader><Leader>s', '<plug>(SubversiveSubvertRange)') | ||
107 | vim.keymap.set('n', '<Leader><Leader>ss', '<plug>(SubversiveSubvertWordRange)') | ||
108 | |||
109 | -- iterate over yank list | ||
110 | vim.keymap.set('n', '<c-n>', '<Plug>(YoinkPostPasteSwapBack)') | ||
111 | vim.keymap.set('n', '<c-p>', '<Plug>(YoinkPostPasteSwapForward)') | ||
112 | |||
113 | -- checkmarks on vimwiki | ||
114 | vim.keymap.set('n', '<leader>v', '<Plug>VimwikiToggleListItem') | ||
115 | -- add/increase header level | ||
116 | vim.keymap.set('n', '<leader>a', '<Plug>VimwikiAddHeaderLevel') | ||
117 | |||
118 | -- vim-test bindings | ||
119 | vim.keymap.set('n', 't<C-n>', ':TestNearest<CR>') | ||
120 | vim.keymap.set('n', 't<C-f>', ':TestFile<CR>') | ||
121 | vim.keymap.set('n', 't<C-s>', ':TestSuite<CR>') | ||
122 | vim.keymap.set('n', 't<C-l>', ':TestLast<CR>') | ||
123 | vim.keymap.set('n', 't<C-g>', ':TestVisit<CR>') | ||
124 | |||
125 | -- telescope bindings | ||
126 | vim.keymap.set('n', '<leader>ff', "<cmd>lua require('telescope.builtin').find_files()<cr>") | ||
127 | vim.keymap.set('n', '<leader>fg', "<cmd>lua require('telescope.builtin').live_grep()<cr>") | ||
128 | vim.keymap.set('n', '<leader>fb', "<cmd>lua require('telescope.builtin').buffers()<cr>") | ||
129 | vim.keymap.set('n', '<leader>fh', "<cmd>lua require('telescope.builtin').help_tags()<cr>") | ||
130 | |||
131 | -- nvim tree mappings | ||
132 | vim.keymap.set('n', 'vt', ':NvimTreeToggle<CR>') | ||
133 | vim.keymap.set('n', 'vr', ':NvimTreeRefresh<CR>') | ||
134 | vim.keymap.set('n', 'vs', ':NvimTreeFindFile!<CR>') | ||
135 | |||
136 | -- dial.nvim mappings | ||
137 | local opts = { noremap=true, silent=true } | ||
138 | vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), opts) | ||
139 | vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), opts) | ||
140 | vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), opts) | ||
141 | vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), opts) | ||
142 | vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), opts) | ||
143 | vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), opts) | ||
144 | |||
145 | -- leap.nvim mappings | ||
146 | vim.keymap.set('n', '`', '<Plug>(leap-forward)', opts) | ||
147 | vim.keymap.set('n', '<Leader>`', '<Plug>(leap-backward)', opts) | ||
148 | vim.keymap.set('v', '`', '<Plug>(leap-forward)', opts) | ||
149 | vim.keymap.set('v', '<Leader>`', '<Plug>(leap-backward)', opts) | ||
150 | |||
151 | -- barbar.nvim mappings | ||
152 | local opts = { noremap = true, silent = true } | ||
153 | |||
154 | -- move to previous/next | ||
155 | vim.keymap.set('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts) | ||
156 | vim.keymap.set('n', '<A-.>', '<Cmd>BufferNext<CR>', opts) | ||
157 | -- re-order to previous/next | ||
158 | vim.keymap.set('n', '<A-e>', '<Cmd>BufferMovePrevious<CR>', opts) | ||
159 | vim.keymap.set('n', '<A-i>', '<Cmd>BufferMoveNext<CR>', opts) | ||
160 | -- goto buffer in position... | ||
161 | vim.keymap.set('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts) | ||
162 | vim.keymap.set('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts) | ||
163 | vim.keymap.set('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts) | ||
164 | vim.keymap.set('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts) | ||
165 | vim.keymap.set('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts) | ||
166 | vim.keymap.set('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts) | ||
167 | vim.keymap.set('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts) | ||
168 | vim.keymap.set('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts) | ||
169 | vim.keymap.set('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts) | ||
170 | vim.keymap.set('n', '<A-0>', '<Cmd>BufferLast<CR>', opts) | ||
171 | -- pin/unpin buffer | ||
172 | vim.keymap.set('n', '<A-p>', '<Cmd>BufferPin<CR>', opts) | ||
173 | -- close buffer | ||
174 | vim.keymap.set('n', '<A-c>', '<Cmd>BufferClose<CR>', opts) | ||
175 | -- magic buffer-picking mode | ||
176 | vim.keymap.set('n', '<leader>dg', '<Cmd>BufferPick<CR>', opts) | ||
177 | -- sort automatically by... | ||
178 | vim.keymap.set('n', '<Leader>db', '<Cmd>BufferOrderByBufferNumber<CR>', opts) | ||
179 | vim.keymap.set('n', '<Leader>dd', '<Cmd>BufferOrderByDirectory<CR>', opts) | ||
180 | vim.keymap.set('n', '<Leader>dl', '<Cmd>BufferOrderByLanguage<CR>', opts) | ||
181 | vim.keymap.set('n', '<Leader>dw', '<Cmd>BufferOrderByWindowNumber<CR>', opts) | ||
182 | |||
183 | -- }}} plug mappings -- | ||