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