summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYigit Sever2021-11-02 15:25:21 +0300
committerYigit Sever2021-11-02 15:25:21 +0300
commit81764d44f86917a38744f22a8c494be3589ae995 (patch)
tree7cd87770e2e15036fa49aa2ca473dfa06e074c99
parent0ee0b219d4f7bd235043d262e41d517f3c5a507e (diff)
downloaddotfiles-81764d44f86917a38744f22a8c494be3589ae995.tar.gz
dotfiles-81764d44f86917a38744f22a8c494be3589ae995.tar.bz2
dotfiles-81764d44f86917a38744f22a8c494be3589ae995.zip
nvim: mapping fixes
-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',