Skip to content

Commit

Permalink
enhance!: update quickfix mapping, add vnoremap <Leader>ll
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangyinzuo committed Oct 26, 2024
1 parent c6477f4 commit d9cbe40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
16 changes: 9 additions & 7 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' . <q-args>)
nnoremap ]q :call ToggleQuickfix('c')<CR>
nnoremap ]l :call ToggleQuickfix('l')<CR>
nnoremap <silent> <leader>cn :cn<CR>
nnoremap <silent> <leader>cp :cp<CR>
nnoremap <silent> <leader>ln :ln<CR>
nnoremap <silent> <leader>lp :lp<CR>
nnoremap <leader>q :call ToggleQuickfix('c')<CR>
nnoremap <leader>lf :call ToggleQuickfix('l')<CR>
if !has('nvim')
nnoremap <silent> ]q :cn<CR>
nnoremap <silent> [q :cp<CR>
nnoremap <silent> ]l :ln<CR>
nnoremap <silent> [l :lp<CR>
endif
" vnoremap <silent> <leader>t :term ++open ++rows=9<CR>
" nnoremap <silent> <leader>t :term ++rows=9<CR>

Expand All @@ -381,6 +382,7 @@ if has('autocmd') " vim-tiny does not have autocmd
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 添加高亮一行
nnoremap <Leader>ll :call matchadd('Todo', '\%.l')<cr>
vnoremap <Leader>ll :call matchadd('Todo', '\%V')<cr>
" 清空高亮
nnoremap <Leader>lc :call clearmatches()<cr>
Expand Down
19 changes: 10 additions & 9 deletions root/.vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -299,19 +299,21 @@ if has('autocmd') " vim-tiny does not have autocmd
command! -nargs=1 FdToQf call noplug#SystemToQf('fd ' . <q-args> . ' | xargs file | sed "s/:/:1:/"')
" neovim 0.10.0 uses ripgrep as greppg by default
command! -nargs=1 RgToQf call noplug#SystemToQf('rg --vimgrep ' . <q-args>)

nnoremap ]q :call noplug#ToggleQuickfix('c')<CR>
nnoremap ]l :call noplug#ToggleQuickfix('l')<CR>
nnoremap <silent> <leader>cn :cn<CR>
nnoremap <silent> <leader>cp :cp<CR>
nnoremap <silent> <leader>ln :ln<CR>
nnoremap <silent> <leader>lp :lp<CR>
nnoremap <leader>q :call noplug#ToggleQuickfix('c')<CR>
nnoremap <leader>lf :call noplug#ToggleQuickfix('l')<CR>
if !has('nvim') " https://github.com/tpope/vim-unimpaired
nnoremap <silent> ]q :cn<CR>
nnoremap <silent> [q :cp<CR>
nnoremap <silent> ]l :ln<CR>
nnoremap <silent> [l :lp<CR>
endif

" [[palette]]执行系统命令并输出到quickfix list :SystemToQf
command! -nargs=1 SystemToQf call noplug#SystemToQf(<q-args>)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 添加高亮一行
nnoremap <Leader>ll :call matchadd('Todo', '\%.l')<cr>
vnoremap <Leader>ll :call matchadd('Todo', '\%V')<cr>
" 清空高亮
nnoremap <Leader>lc :call clearmatches()<cr>
Expand Down Expand Up @@ -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 <line1>,<line2> -- %

" neovim 会报错
if !has('nvim')
if !has('nvim') " neovim 会报错
" .txt的helpfile,第一行必须都是英文,不能包含中文,否则报 mixed encoding的错误
" set helplang=cn
helptags ~/.vim/doc
Expand Down

0 comments on commit d9cbe40

Please sign in to comment.