From d9cbe406eae7226f91a6f7948cb9652e23063c0a Mon Sep 17 00:00:00 2001 From: Yinzuo Jiang Date: Sat, 26 Oct 2024 11:17:05 +0800 Subject: [PATCH] enhance!: update quickfix mapping, add vnoremap ll --- .vimrc | 16 +++++++++------- root/.vim/vimrc | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.vimrc b/.vimrc index 256246b..8e6e305 100644 --- a/.vimrc +++ b/.vimrc @@ -366,13 +366,14 @@ if has('autocmd') " vim-tiny does not have autocmd " neovim 0.10.0 uses ripgrep as greppg by default command! -nargs=1 RgToQf call SystemToQf('rg --vimgrep ' . ) - nnoremap ]q :call ToggleQuickfix('c') - nnoremap ]l :call ToggleQuickfix('l') - nnoremap cn :cn - nnoremap cp :cp - nnoremap ln :ln - nnoremap lp :lp - + nnoremap q :call ToggleQuickfix('c') + nnoremap lf :call ToggleQuickfix('l') + if !has('nvim') + nnoremap ]q :cn + nnoremap [q :cp + nnoremap ]l :ln + nnoremap [l :lp + endif " vnoremap t :term ++open ++rows=9 " nnoremap t :term ++rows=9 @@ -381,6 +382,7 @@ if has('autocmd') " vim-tiny does not have autocmd """"""""""""""""""""""""""""""""""""""""""""""""""""""" " 添加高亮一行 nnoremap ll :call matchadd('Todo', '\%.l') + vnoremap ll :call matchadd('Todo', '\%V') " 清空高亮 nnoremap lc :call clearmatches() diff --git a/root/.vim/vimrc b/root/.vim/vimrc index 166b50e..6836fdc 100644 --- a/root/.vim/vimrc +++ b/root/.vim/vimrc @@ -299,19 +299,21 @@ if has('autocmd') " vim-tiny does not have autocmd command! -nargs=1 FdToQf call noplug#SystemToQf('fd ' . . ' | xargs file | sed "s/:/:1:/"') " neovim 0.10.0 uses ripgrep as greppg by default command! -nargs=1 RgToQf call noplug#SystemToQf('rg --vimgrep ' . ) - - nnoremap ]q :call noplug#ToggleQuickfix('c') - nnoremap ]l :call noplug#ToggleQuickfix('l') - nnoremap cn :cn - nnoremap cp :cp - nnoremap ln :ln - nnoremap lp :lp + nnoremap q :call noplug#ToggleQuickfix('c') + nnoremap lf :call noplug#ToggleQuickfix('l') + if !has('nvim') " https://github.com/tpope/vim-unimpaired + nnoremap ]q :cn + nnoremap [q :cp + nnoremap ]l :ln + nnoremap [l :lp + endif " [[palette]]执行系统命令并输出到quickfix list :SystemToQf command! -nargs=1 SystemToQf call noplug#SystemToQf() """"""""""""""""""""""""""""""""""""""""""""""""""""""" " 添加高亮一行 nnoremap ll :call matchadd('Todo', '\%.l') + vnoremap ll :call matchadd('Todo', '\%V') " 清空高亮 nnoremap lc :call clearmatches() @@ -343,8 +345,7 @@ if has('autocmd') " vim-tiny does not have autocmd " [[palette]]git-blame :GitBlame command -range -nargs=0 GitBlame :!git blame -n -L , -- % - " neovim 会报错 - if !has('nvim') + if !has('nvim') " neovim 会报错 " .txt的helpfile,第一行必须都是英文,不能包含中文,否则报 mixed encoding的错误 " set helplang=cn helptags ~/.vim/doc