Mercurial > dotfiles
comparison .chezmoitemplates/config.vim @ 520:f845e2eba7e3
Use new keymap lua function to set keymaps
author | zegervdv <zegervdv@me.com> |
---|---|
date | Sun, 09 Jan 2022 14:27:10 +0100 |
parents | d919c1590230 |
children | 21745760a5dc |
comparison
equal
deleted
inserted
replaced
519:d919c1590230 | 520:f845e2eba7e3 |
---|---|
36 endif | 36 endif |
37 | 37 |
38 " | 38 " |
39 | 39 |
40 " Mappings | 40 " Mappings |
41 " Set leader to spacebar | |
42 map <space> <leader> | |
43 | |
44 " See long lines as line breaks | |
45 noremap <expr> j (v:count? 'j' : 'gj') | |
46 noremap <expr> k (v:count? 'k' : 'gk') | |
47 | |
48 " Remap tag-search to better place | |
49 nnoremap <C-$> g<C-]> | |
50 nnoremap <C-w>y <C-w>g<C-]> | |
51 | |
52 nnoremap <C-s> <C-e> | |
53 | |
54 " Move while in insert mode | |
55 inoremap <C-f> <right> | |
56 | |
57 " Switch between the last two files | |
58 " nnoremap <space><space> <C-^> | |
59 | |
60 " " Very Magic search patterns | |
61 nnoremap / /\v | |
62 vnoremap / /\v | |
63 | |
64 " Keep search matches in the middle of the window. | |
65 nnoremap n nzzzv | |
66 nnoremap N Nzzzv | |
67 | |
68 " Search for beginning of command | |
69 cnoremap <c-n> <down> | |
70 cnoremap <c-p> <up> | |
71 | |
72 " Move whole lines | |
73 nnoremap [e :<c-u>execute 'move -1-'. v:count1<cr> | |
74 nnoremap ]e :<c-u>execute 'move +'. v:count1<cr> | |
75 | |
76 " Insert empty lines | |
77 nnoremap [<space> :<c-u>put! =repeat(nr2char(10), v:count1)<cr>'[ | |
78 nnoremap ]<space> :<c-u>put =repeat(nr2char(10), v:count1)<cr> | |
79 | |
80 " Clear highlight | |
81 nnoremap <silent><leader>l :noh<CR> | |
82 | |
83 inoremap £ \ | |
84 | |
85 " Highlight last inserted text | |
86 nnoremap gV `[v`] | |
87 | 41 |
88 " Highlight VCS conflict markers | 42 " Highlight VCS conflict markers |
89 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' | 43 match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$' |
90 | |
91 " Use backspace as delete in visual mode | |
92 vmap <BS> x | |
93 | |
94 " Redraw screen | |
95 nnoremap <F3> :redraw!<CR> | |
96 | |
97 " Keep selection when shifting | |
98 vmap <expr> > KeepVisualSelection(">") | |
99 vmap <expr> < KeepVisualSelection("<") | |
100 | |
101 function! KeepVisualSelection(cmd) | |
102 set nosmartindent | |
103 if mode() ==# "V" | |
104 return a:cmd . ":set smartindent\<CR>gv" | |
105 else | |
106 return a:cmd . ":set smartindent\<CR>" | |
107 endif | |
108 endfunction | |
109 | |
110 " Swap backticks and quotes | |
111 nnoremap ` ' | |
112 nnoremap ' ` | |
113 | 44 |
114 " Do not move on * | 45 " Do not move on * |
115 nnoremap <silent> * :let stay_star_view = winsaveview()<cr>*:call winrestview(stay_star_view)<cr> | 46 nnoremap <silent> * :let stay_star_view = winsaveview()<cr>*:call winrestview(stay_star_view)<cr> |
116 | 47 |
117 " Search for selected text, forwards or backwards. | 48 " Search for selected text, forwards or backwards. |