diff options
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/mappings.lua | 22 | ||||
-rw-r--r-- | .config/nvim/lua/settings.lua | 2 |
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>') | |||
39 | map('n', '#', ':keepjumps normal! mi#`i<CR> ') | 39 | map('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 |
42 | map('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" <bar> edit!<CR>') | 42 | map('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) |
45 | map('n', 'Q', 'gq') | 45 | map('n', 'Q', 'gq') |
46 | 46 | ||
47 | -- set formatprg to sentences, for prose | 47 | -- set formatprg to sentences, for prose |
48 | map('n', '<Leader>fp', ":set formatprg=~/.local/bin/sentences<CR>") | 48 | map('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. |
51 | map('n', 'S', ':%s//g<Left><Left>') | 51 | map('n', 'S', ':%s//g<Left><Left>', { silent = false }) |
52 | map('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 }) | |||
58 | map('n', '<Leader>b', ':ls<cr>:b<space>') | 59 | map('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.. |
61 | map('n', 'k', 'gk') | 62 | map('n', 'k', '(v:count == 0 ? "gk" : "k")', { expr = true }) |
62 | map('n', 'j', 'gj') | 63 | map('n', 'j', '(v:count == 0 ? "gj" : "j")', { expr = true }) |
63 | map('i', '<Up>', '<Esc>gka') | 64 | map('i', '<Up>', '<Esc>gka') |
64 | map('i', '<Down>', '<Esc>gja') | 65 | map('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 |
93 | map('n', '<leader>nn', ':call CreateNote()<CR>') | 94 | map('n', '<leader>nn', ':call CreateNote()<CR>') |
94 | 95 | ||
95 | vim.cmd("cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'") | 96 | -- :%% to get current file path |
97 | map('c', '%%', "getcmdtype() == ':' ? expand('%:h').'/' : '%%'", { expr = true, silent = false }) | ||
98 | |||
99 | -- reselect visual selection after indent | ||
100 | map('v', '>', '>gv') | ||
101 | map('v', '<', '<gv') | ||
102 | |||
103 | -- keep cursor position after visual yank | ||
104 | map('v', 'y', 'myy`y') | ||
105 | map('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" | |||
35 | wo.spell = false | 35 | wo.spell = false |
36 | 36 | ||
37 | -- tab completion, zsh style | 37 | -- tab completion, zsh style |
38 | o.wildmode = "full" | 38 | o.wildmode = "longest:full,full" |
39 | opt.wildignore = { | 39 | opt.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', |