blob: 37888b15b4a8719bc2379ad934c31b293cfc0ec4 [file] [log] [blame]
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00001" Vim filetype plugin
2" Language: generic git output
3" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
4" Last Change: 2008 Feb 27
5
6" Only do this when not done yet for this buffer
7if (exists("b:did_ftplugin"))
8 finish
9endif
10let b:did_ftplugin = 1
11
12if !exists('b:git_dir')
13 if expand('%:p') =~# '\.git\>'
14 let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
15 elseif $GIT_DIR != ''
16 let b:git_dir = $GIT_DIR
17 endif
18 if has('win32') || has('win64')
19 let b:git_dir = substitute(b:git_dir,'\\','/','g')
20 endif
21endif
22
23if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
24 if b:git_dir =~# '/\.git$' " Not a bare repository
25 let &l:path = escape(fnamemodify(b:git_dir,':t'),'\, ').','.&l:path
26 endif
27 let &l:path = escape(b:git_dir,'\, ').','.&l:path
28 let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
29else
30 setlocal keywordprg=git\ show
31endif
32
33setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
34let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"