diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-06-29 00:55:46 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-06-29 00:55:46 +0800 |
| commit | e68ae5fe812b870acd7792776ab111cf52fb766f (patch) | |
| tree | 53406c102c94c9a8dbef0cdc8beeb8b49e3b0f6a /vim/init | |
| parent | 10001cd06de8a6b564c0b5e6964fb05555b55002 (diff) | |
Update
Diffstat (limited to 'vim/init')
| -rw-r--r-- | vim/init/keymaps.vim | 22 |
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= | |||
| 262 | let g:lastbuffer = 1 | 263 | let g:lastbuffer = 1 |
| 263 | au BufLeave * let g:lastbuffer = bufnr() | 264 | au 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 | |||
| 305 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) | 307 | command! -nargs=1 -complete=command Redir silent call Redir(<q-args>) |
| 306 | nnoremap <leader>rr :Redir | 308 | nnoremap <leader>rr :Redir |
| 307 | 309 | ||
| 310 | |||
| 311 | "---------------------------------------------------------------------- | ||
| 312 | " QUICK_SUBSTITUTE | ||
| 313 | "---------------------------------------------------------------------- | ||
| 314 | function! 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 | ||
| 319 | endfunction | ||
| 320 | function! 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 | ||
| 326 | endfunction | ||
| 327 | vnoremap <CR> <Cmd>call SelectAreaOrDoSubstitute()<CR> | ||
| 328 | |||
| 329 | |||
| 308 | "---------------------------------------------------------------------- | 330 | "---------------------------------------------------------------------- |
| 309 | " Markdown items (temproray solution) | 331 | " Markdown items (temproray solution) |
| 310 | "---------------------------------------------------------------------- | 332 | "---------------------------------------------------------------------- |