Fix Rag and add <leader>ag shortcut
This commit is contained in:
parent
3adeb5e04e
commit
275a07bf4e
@ -155,5 +155,6 @@ nnoremap <C-A> ggVG<CR>
|
||||
inoremap <C-A> <C-O>:call Select()<CR>
|
||||
|
||||
" 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>
|
||||
|
||||
|
10
vimrc
10
vimrc
@ -272,12 +272,14 @@ let g:ctrlp_match_func = { 'match': 'cpsm#CtrlPMatch' }
|
||||
" --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)
|
||||
|
||||
function! s:with_git_root()
|
||||
let root = systemlist('git rev-parse --show-toplevel')[0]
|
||||
return v:shell_error ? {} : {'dir': root}
|
||||
function! WithGitRoot()
|
||||
let groot = systemlist('git -C ' . expand('%:p:h') . ' rev-parse --show-toplevel')[0]
|
||||
return v:shell_error ? {} : {'dir': groot}
|
||||
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 ====
|
||||
" command aliases
|
||||
|
Loading…
Reference in New Issue
Block a user