summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/mappings.lua22
-rw-r--r--.config/nvim/lua/settings.lua2
2 files changed, 17 insertions, 7 deletions
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
index df7e3d3..ad40879 100644
--- a/.config/nvim/lua/mappings.lua
+++ b/.config/nvim/lua/mappings.lua
@@ -39,16 +39,17 @@ map('n', '*', ':keepjumps normal! mi*`i<CR>')
39map('n', '#', ':keepjumps normal! mi#`i<CR> ') 39map('n', '#', ':keepjumps normal! mi#`i<CR> ')
40 40
41-- save file as sudo on files that require root permission 41-- save file as sudo on files that require root permission
42map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>') 42map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>', { silent = false })
43 43
44-- replace ex mode with gq (format lines) 44-- replace ex mode with gq (format lines)
45map('n', 'Q', 'gq') 45map('n', 'Q', 'gq')
46 46
47-- set formatprg to sentences, for prose 47-- set formatprg to sentences, for prose
48map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>") 48map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>", { silent = false })
49 49
50-- replace all is aliased to S. 50-- replace all is aliased to S.
51map('n', 'S', ':%s//g<Left><Left>') 51map('n', 'S', ':%s//g<Left><Left>', { silent = false })
52map('v', 'S', ':s//g<Left><Left>', { silent = false })
52 53
53-- if you like "Y" to work from the cursor to the end of line (which is more 54-- if you like "Y" to work from the cursor to the end of line (which is more
54-- logical, but not Vi-compatible) 55-- logical, but not Vi-compatible)
@@ -58,8 +59,8 @@ map('n', 'Y', 'y$', { noremap = false })
58map('n', '<Leader>b', ':ls<cr>:b<space>') 59map('n', '<Leader>b', ':ls<cr>:b<space>')
59 60
60-- up and down are more logical with g.. 61-- up and down are more logical with g..
61map('n', 'k', 'gk') 62map('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true })
62map('n', 'j', 'gj') 63map('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true })
63map('i', '<Up>', '<Esc>gka') 64map('i', '<Up>', '<Esc>gka')
64map('i', '<Down>', '<Esc>gja') 65map('i', '<Down>', '<Esc>gja')
65 66
@@ -92,7 +93,16 @@ map('n', '<leader>nr', ':call CreateReference(expand("<cword>"))<CR>')
92-- create a new note 93-- create a new note
93map('n', '<leader>nn', ':call CreateNote()<CR>') 94map('n', '<leader>nn', ':call CreateNote()<CR>')
94 95
95vim.cmd("cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'") 96-- :%% to get current file path
97map('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false })
98
99-- reselect visual selection after indent
100map('v', '>', '>gv')
101map('v', '<', '<gv')
102
103-- keep cursor position after visual yank
104map('v', 'y', 'myy`y')
105map('v', 'Y', 'myY`y')
96 106
97-- plug mappings {{{ -- 107-- plug mappings {{{ --
98 108
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
index 34e68b2..895d6d9 100644
--- a/.config/nvim/lua/settings.lua
+++ b/.config/nvim/lua/settings.lua
@@ -35,7 +35,7 @@ bo.spelllang = "en_gb"
35wo.spell = false 35wo.spell = false
36 36
37-- tab completion, zsh style 37-- tab completion, zsh style
38o.wildmode = "full" 38o.wildmode = "longest:full,full"
39opt.wildignore = { 39opt.wildignore = {
40 '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls', 40 '*.o', '*.obj', '*.class', '*.aux', '*.lof', '*.log', '*.lot', '*.fls',
41 '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv', 41 '*.toc', '*.fmt', '*.fot', '*.cb', '*.cb2', '.*.lb', '.dvi', '*.xdv',