From b12dbf3e49a45b714668c184544d3efe850346fc Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Mon, 18 May 2020 13:59:53 +0200 Subject: [PATCH] Add git root to path in vim when applicable --- vim/plugin/git.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vim/plugin/git.vim b/vim/plugin/git.vim index 5551307..f7a6e1d 100644 --- a/vim/plugin/git.vim +++ b/vim/plugin/git.vim @@ -145,6 +145,15 @@ function! s:git_blame(first, last) return map(l:data, {idx, ary -> ary[1][match(ary[1], '\s\+\zs'):]}) endfun +function! s:git_root_to_path() + let l:root = substitute(system('git rev-parse --show-toplevel'), '\n\_.*', '', '') + if !v:shell_error + let &path.=','.l:root.'/**' + end +endfun + +call s:git_root_to_path() + command! -range Blame echom join(uniq(sort(git_blame(, ))), ', ') command! -range DBlame !git blame % -L , command! GitNext try