aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init')
-rw-r--r--vim/init/keymaps.vim21
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
47nmap <leader>w :w!<CR> 47nmap <leader>w :w!<CR>
48 48
49" Fast quit with error 49" Fast quit with error
50nmap <leader>q :q<CR>
51
52" Fast quit with error
50nmap cq :cq<CR> 53nmap 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>
76vnoremap <leader>, :terminal<CR> 79vnoremap <leader>, :terminal<CR>
77echo foo
78 80
79" Toggle paste mode on and off 81" Toggle paste mode on and off
80map <leader>pp :setlocal paste!<CR> 82map <leader>pp :setlocal paste!<CR>
@@ -312,20 +314,17 @@ nnoremap <leader>rr :Redir
312"---------------------------------------------------------------------- 314"----------------------------------------------------------------------
313" QUICK_SUBSTITUTE 315" QUICK_SUBSTITUTE
314"---------------------------------------------------------------------- 316"----------------------------------------------------------------------
315function! IsSubstituteTextSelected() 317let 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
320endfunction
321function! SelectAreaOrDoSubstitute() 318function! 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
327endfunction 326endfunction
328vnoremap <CR> <Cmd>call SelectAreaOrDoSubstitute()<CR> 327vnoremap <TAB> <Cmd>call SelectAreaOrDoSubstitute()<CR>
329 328
330 329
331"---------------------------------------------------------------------- 330"----------------------------------------------------------------------