Skip to content

Commit a337aba

Browse files
committed
refactor(vim): add new custom keybindings
,va Select all lines. ,vf Select from the current line to the end of line. ,vb Select from the current line to the first of line. ,ya Yank all lines. ,yf Yank from the current line to the end of line. ,yb Yank from the current line to the first of line.
1 parent 9610e7e commit a337aba

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

vim/vimrc

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,8 +3220,8 @@ set relativenumber number
32203220
" 使查看 Vim 帮助文档的窗口也显示相对行号.
32213221
augroup vim help
32223222
autocmd!
3223-
autocmd FileType help setlocal number
3224-
autocmd FileType help setlocal relativenumber
3223+
autocmd FileType help,man setlocal number
3224+
autocmd FileType help,man setlocal relativenumber
32253225
augroup END
32263226

32273227
" 失去焦点时(比如光标从当前 buffer 移走), 不显示相对行号, 而是显示正常行号.
@@ -3531,9 +3531,26 @@ imap <silent> <C-s> <C-o>:setlocal spell! spelllang=en,cjk<CR>
35313531
noremap <C-e> 3<C-e>
35323532
noremap <C-y> 3<C-y>
35333533
3534-
" normal 模式下, 使用 Y 复制当前行光标之后的内容, 和 C 和 D 用法统一起来.
3534+
" Y normal 模式下, 使用 Y 复制当前行光标之后的内容, 和 C 和 D 用法统一起来.
35353535
nnoremap Y y$
35363536
3537+
" 选中当前文件所有行、当前行到最后一行、当前行到第一行,
3538+
" 选中之后可以进行一系列编辑动作, 比如 y/d/c 等等.
3539+
" ,va Select all lines.
3540+
map <Leader>va ggVG
3541+
" ,vf Select from the current line to the end of line.
3542+
map <Leader>vf VG
3543+
" ,vb Select from the current line to the first of line.
3544+
map <Leader>vb Vgg
3545+
3546+
" 拷贝当前文件所有行、当前行到最后一行、当前行到第一行,
3547+
" ,ya Yank all lines.
3548+
map <Leader>ya ggVGy
3549+
" ,yf Yank from the current line to the end of line.
3550+
map <Leader>yf VGy
3551+
" ,yb Yank from the current line to the first of line.
3552+
map <Leader>yb Vggy
3553+
35373554
" :W 普通用户没有权限时使用 sudo 权限保存文件.
35383555
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
35393556

@@ -3682,7 +3699,7 @@ endif
36823699
" }}
36833700

36843701

3685-
" Vim/Neovim 使用技巧 Tips {{
3702+
" 使用技巧 Tips {{
36863703

36873704
"""""""""" 常用命令行 {{
36883705
"

0 commit comments

Comments
 (0)