2 " Language: generic git output
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4 " Last Change: 2013 May 30
6 " Only do this when not done yet for this buffer
7 if (exists("b:did_ftplugin"))
10 let b:did_ftplugin = 1
12 if !exists('b:git_dir')
13 if expand('%:p') =~# '[\/]\.git[\/]modules[\/]'
15 elseif expand('%:p') =~# '\.git\>'
16 let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
18 let b:git_dir = $GIT_DIR
20 if (has('win32') || has('win64')) && exists('b:git_dir')
21 let b:git_dir = substitute(b:git_dir,'\\','/','g')
25 if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
26 if b:git_dir =~# '/\.git$' " Not a bare repository
27 let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path
29 let &l:path = escape(b:git_dir,'\, ').','.&l:path
30 let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
32 setlocal keywordprg=git\ show
35 let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','')
38 setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
39 let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"