summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/core/keymaps.lua
diff options
context:
space:
mode:
diffstat (limited to '.config/nvim/lua/core/keymaps.lua')
-rw-r--r--.config/nvim/lua/core/keymaps.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua
index b63156d..95e5fcd 100644
--- a/.config/nvim/lua/core/keymaps.lua
+++ b/.config/nvim/lua/core/keymaps.lua
@@ -12,12 +12,11 @@ map("c", "w!!", 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>'
12map("n", "Q", "gq", "format lines") 12map("n", "Q", "gq", "format lines")
13 13
14-- set formatprg to sentences, for prose 14-- set formatprg to sentences, for prose
15-- TODO: can we do this with vim.o.formatprg? 15map("n", "<Leader>fp", ":set formatprg=~/.local/bin/sentences<CR>", "switch to sentences formatprg", { silent = false })
16map("n", "<Leader>fp", "<cmd>set formatprg=~/.local/bin/sentences<CR>", "switch to sentences view", { silent = false })
17 16
18-- replace all is aliased to S. 17-- replace all is aliased to S.
19map("n", "S", ":s//g<Left><Left>", "replace all", { silent = false }) 18map("n", "<leader>S", ":%s//g<Left><Left>", "replace all", { silent = false })
20map("v", "S", ":s//g<Left><Left>", "replace all selection", { silent = false }) 19map("v", "<leader>S", ":s//g<Left><Left>", "replace all", { silent = false })
21 20
22-- jump to buffer 21-- jump to buffer
23map("n", "<Leader>b", "<cmd>ls<cr>:b<space>", "jump to buffer") 22map("n", "<Leader>b", "<cmd>ls<cr>:b<space>", "jump to buffer")
@@ -42,16 +41,16 @@ map("n", "<Leader>cd", "<cmd>lcd %:p:h<CR>:pwd<CR>", "cd to current buffer's pwd
42 41
43-- call CreatePaper on word below cursor 42-- call CreatePaper on word below cursor
44map("n", "<leader>np", 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>', 43map("n", "<leader>np", 'gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand("<cword>"))<CR>',
45 "vimwiki new paper on word under cursor") 44 "vimwiki: new paper on word under cursor")
46 45
47-- link paper 46-- link paper
48map("n", "<leader>lp", "gewi[[/papers/<ESC>Ea]]<ESC>", "vimwiki link wrap word under cursor") 47map("n", "<leader>lp", "gewi[[/papers/<ESC>Ea]]<ESC>", "vimwiki: link wrap word under cursor")
49 48
50-- call CreateReference on word below cursor 49-- call CreateReference on word below cursor
51map("n", "<leader>nr", '<cmd>call CreateReference(expand("<cword>"))<CR>', "vimwiki new reference word under cursor") 50map("n", "<leader>nr", '<cmd>call CreateReference(expand("<cword>"))<CR>', "vimwiki: new reference word under cursor")
52 51
53-- create a new note 52-- create a new note
54map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki new note for slipbox") 53map("n", "<leader>nn", "<cmd>call CreateNote()<CR>", "vimwiki: new note for slipbox")
55 54
56-- :%% to get current file path 55-- :%% to get current file path
57map('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", "get current file path", { expr = true, silent = false }) 56map('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", "get current file path", { expr = true, silent = false })
@@ -67,6 +66,10 @@ map('v', 'Y', 'myY`y')
67-- ` is more useful than ' 66-- ` is more useful than '
68map('n', "'", '`') 67map('n', "'", '`')
69 68
69-- keep cursor in the middle while doing search
70map("n", "n", "nzzzv")
71map("n", "N", "Nzzzv")
72
70-- switch between light and dark modes 73-- switch between light and dark modes
71map("n", "<leader>ut", function() 74map("n", "<leader>ut", function()
72 if vim.o.background == "dark" then 75 if vim.o.background == "dark" then