Fix Rag and add <leader>ag shortcut

This commit is contained in:
Julian Ospald 2018-08-19 14:15:09 +08:00
parent 3adeb5e04e
commit 275a07bf4e
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
2 changed files with 7 additions and 4 deletions

View File

@ -155,5 +155,6 @@ nnoremap <C-A> ggVG<CR>
inoremap <C-A> <C-O>:call Select()<CR> inoremap <C-A> <C-O>:call Select()<CR>
" fzf " fzf
nnoremap <leader>ag :call fzf#vim#ag(expand('<cword>'), WithGitRoot())<CR>
nnoremap <leader>tg :call fzf#vim#tags(expand('<cword>'), {'options': '--exact --select-1 --exit-0'})<CR> nnoremap <leader>tg :call fzf#vim#tags(expand('<cword>'), {'options': '--exact --select-1 --exit-0'})<CR>

10
vimrc
View File

@ -272,12 +272,14 @@ let g:ctrlp_match_func = { 'match': 'cpsm#CtrlPMatch' }
" --color: Search color options " --color: Search color options
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0) command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)
function! s:with_git_root() function! WithGitRoot()
let root = systemlist('git rev-parse --show-toplevel')[0] let groot = systemlist('git -C ' . expand('%:p:h') . ' rev-parse --show-toplevel')[0]
return v:shell_error ? {} : {'dir': root} return v:shell_error ? {} : {'dir': groot}
endfunction endfunction
command! -bang -nargs=* Rag call fzf#vim#ag_raw(<q-args>, s:with_git_root()) command! -nargs=* Rag
\ call fzf#vim#ag(<q-args>, WithGitRoot())
" ==== conque ==== " ==== conque ====
" command aliases " command aliases