diff options
Diffstat (limited to 'vim/init')
-rw-r--r-- | vim/init/keymaps.vim | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim index eca23f9..2475ad8 100644 --- a/vim/init/keymaps.vim +++ b/vim/init/keymaps.vim | |||
@@ -14,7 +14,6 @@ | |||
14 | " - QUICK_SUBSTITUTE | 14 | " - QUICK_SUBSTITUTE |
15 | " - 终端支持 | 15 | " - 终端支持 |
16 | " - 编译运行 | 16 | " - 编译运行 |
17 | " - 符号搜索 | ||
18 | " | 17 | " |
19 | "====================================================================== | 18 | "====================================================================== |
20 | " vim: set ts=4 sw=4 tw=78 noet : | 19 | " vim: set ts=4 sw=4 tw=78 noet : |
@@ -317,12 +316,16 @@ endfunction | |||
317 | 316 | ||
318 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) | 317 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) |
319 | nnoremap <leader>rr :Redir<space> | 318 | nnoremap <leader>rr :Redir<space> |
319 | |||
320 | |||
320 | "---------------------------------------------------------------------- | 321 | "---------------------------------------------------------------------- |
321 | " QUICK_SUBSTITUTE | 322 | " QUICK_SUBSTITUTE |
322 | " Press <TAB> n times for area, and <CR> for substitute | 323 | " Press <TAB> n times for area, and <CR> for substitute |
324 | "---------------------------------------------------------------------- | ||
325 | |||
323 | let g:search_not_in_register = 1 | 326 | let g:search_not_in_register = 1 |
324 | function! ExpandSelectionForSearch(sep) | 327 | function! ExpandSelectionBySearch(sep) |
325 | if g:search_not_in_register == 1 | 328 | if g:search_not_in_register |
326 | " Save current selection to register s, and keep selection | 329 | " Save current selection to register s, and keep selection |
327 | execute 'norm "sygv' | 330 | execute 'norm "sygv' |
328 | let g:search_not_in_register = 0 | 331 | let g:search_not_in_register = 0 |
@@ -331,18 +334,17 @@ function! ExpandSelectionForSearch(sep) | |||
331 | " statusline | 334 | " statusline |
332 | call feedkeys(a:sep.."\<C-R>s"..a:sep.."e\<CR>") | 335 | call feedkeys(a:sep.."\<C-R>s"..a:sep.."e\<CR>") |
333 | endfunction | 336 | endfunction |
334 | function! SubstituteForSearch() | 337 | function! SubstituteBySearch() |
335 | " Apply current for default substitute text | 338 | " Apply current search for default substitute text |
336 | call feedkeys(":s//\<C-R>s/g\<Left>\<Left>") | 339 | call feedkeys(":s//\<C-R>s/g\<Left>\<Left>") |
337 | endfunction | 340 | endfunction |
338 | vnoremap <TAB> <Cmd>call ExpandSelectionForSearch('/')<CR> | 341 | vnoremap <TAB> <Cmd>call ExpandSelectionBySearch('/')<CR> |
339 | vnoremap <S-TAB> <Cmd>call ExpandSelectionForSearch('?')<CR> | 342 | vnoremap <S-TAB> <Cmd>call ExpandSelectionBySearch('?')<CR> |
340 | vnoremap <CR> <Cmd>call SubstituteForSearch()<CR> | 343 | vnoremap <CR> <Cmd>call SubstituteBySearch()<CR> |
341 | " When leaving visual mode, resume search_not_in_register | 344 | " When leaving visual mode, resume search_not_in_register |
342 | autocmd Modechanged [vV\x16]*:* let g:search_not_in_register = 1 | 345 | autocmd Modechanged [vV\x16]*:* let g:search_not_in_register = 1 |
343 | 346 | ||
344 | 347 | ||
345 | |||
346 | "---------------------------------------------------------------------- | 348 | "---------------------------------------------------------------------- |
347 | " Markdown items (temproray solution) | 349 | " Markdown items (temproray solution) |
348 | "---------------------------------------------------------------------- | 350 | "---------------------------------------------------------------------- |