aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init')
-rw-r--r--vim/init/keymaps.vim22
1 files changed, 22 insertions, 0 deletions
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim
index 3c3ebc8..68103a1 100644
--- a/vim/init/keymaps.vim
+++ b/vim/init/keymaps.vim
@@ -11,6 +11,7 @@
11" - MANAGE_BUFFERS 11" - MANAGE_BUFFERS
12" - SURROURD_WITH_CHAR 12" - SURROURD_WITH_CHAR
13" - REDIRECTION_WITH_BUFFER 13" - REDIRECTION_WITH_BUFFER
14" - QUICK_SUBSTITUTE
14" - 终端支持 15" - 终端支持
15" - 编译运行 16" - 编译运行
16" - 符号搜索 17" - 符号搜索
@@ -262,6 +263,7 @@ noremap <leader><leader>fm :set foldmethod=
262let g:lastbuffer = 1 263let g:lastbuffer = 1
263au BufLeave * let g:lastbuffer = bufnr() 264au BufLeave * let g:lastbuffer = bufnr()
264 265
266
265"---------------------------------------------------------------------- 267"----------------------------------------------------------------------
266" SURROURD_WITH_CHAR 268" SURROURD_WITH_CHAR
267"---------------------------------------------------------------------- 269"----------------------------------------------------------------------
@@ -305,6 +307,26 @@ endfunction
305command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) 307command! -nargs=1 -complete=command Redir silent call Redir(<q-args>)
306nnoremap <leader>rr :Redir 308nnoremap <leader>rr :Redir
307 309
310
311"----------------------------------------------------------------------
312" QUICK_SUBSTITUTE
313"----------------------------------------------------------------------
314function! IsSubstituteTextSelected()
315 execute "norm \<ESC>"
316 " Get position of the first/last char
317 echo col("'<") col("'>") len(getline('.'))+1
318 return col("'<") != 1 || col("'>") != len(getline('.')) + 1
319endfunction
320function! SelectAreaOrDoSubstitute()
321 if IsSubstituteTextSelected()
322 call feedkeys('gv"aygv*NVL')
323 else
324 call feedkeys("gv:s//\<C-R>a/g\<Left>\<Left>")
325 endif
326endfunction
327vnoremap <CR> <Cmd>call SelectAreaOrDoSubstitute()<CR>
328
329
308"---------------------------------------------------------------------- 330"----------------------------------------------------------------------
309" Markdown items (temproray solution) 331" Markdown items (temproray solution)
310"---------------------------------------------------------------------- 332"----------------------------------------------------------------------