diff options
Diffstat (limited to 'vim/init')
-rw-r--r-- | vim/init/keymaps.vim | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index d0e2cd0..e4bdfd4 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
@@ -47,6 +47,9 @@ nnoremap <C-p> "0p | |||
47 | nmap <leader>w :w!<CR> | 47 | nmap <leader>w :w!<CR> |
48 | 48 | ||
49 | " Fast quit with error | 49 | " Fast quit with error |
50 | nmap <leader>q :q<CR> | ||
51 | |||
52 | " Fast quit with error | ||
50 | nmap cq :cq<CR> | 53 | nmap cq :cq<CR> |
51 | 54 | ||
52 | " Switch wrap | 55 | " Switch wrap |
@@ -74,7 +77,6 @@ augroup END | |||
74 | " Open terminal | 77 | " Open terminal |
75 | " nnoremap <leader>, :terminal ++noclose<CR> | 78 | " nnoremap <leader>, :terminal ++noclose<CR> |
76 | vnoremap <leader>, :terminal<CR> | 79 | vnoremap <leader>, :terminal<CR> |
77 | echo foo | ||
78 | 80 | ||
79 | " Toggle paste mode on and off | 81 | " Toggle paste mode on and off |
80 | map <leader>pp :setlocal paste!<CR> | 82 | map <leader>pp :setlocal paste!<CR> |
@@ -312,20 +314,17 @@ nnoremap <leader>rr :Redir | |||
312 | "---------------------------------------------------------------------- | 314 | "---------------------------------------------------------------------- |
313 | " QUICK_SUBSTITUTE | 315 | " QUICK_SUBSTITUTE |
314 | "---------------------------------------------------------------------- | 316 | "---------------------------------------------------------------------- |
315 | function! IsSubstituteTextSelected() | 317 | let g:text_selected = 1 |
316 | execute "norm \<ESC>" | ||
317 | " Get position of the first/last char | ||
318 | echo col("'<") col("'>") len(getline('.'))+1 | ||
319 | return col("'<") != 1 || col("'>") != len(getline('.')) + 1 | ||
320 | endfunction | ||
321 | function! SelectAreaOrDoSubstitute() | 318 | function! SelectAreaOrDoSubstitute() |
322 | if IsSubstituteTextSelected() | 319 | if g:text_selected |
323 | call feedkeys('gv"aygv*NVL') | 320 | call feedkeys("\"sygv/\<C-R>s\<CR>gn") |
321 | let g:text_selected = 0 | ||
324 | else | 322 | else |
325 | call feedkeys("gv:s//\<C-R>a/g\<Left>\<Left>") | 323 | call feedkeys(":s//\<C-R>//g\<Left>\<Left>") |
324 | let g:text_selected = 1 | ||
326 | endif | 325 | endif |
327 | endfunction | 326 | endfunction |
328 | vnoremap <CR> <Cmd>call SelectAreaOrDoSubstitute()<CR> | 327 | vnoremap <TAB> <Cmd>call SelectAreaOrDoSubstitute()<CR> |
329 | 328 | ||
330 | 329 | ||
331 | "---------------------------------------------------------------------- | 330 | "---------------------------------------------------------------------- |