1620
|
1 " Vim filetype plugin
|
|
2 " Language: generic git output
|
2034
|
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
2202
|
4 " Last Change: 2010 May 21
|
1620
|
5
|
|
6 " Only do this when not done yet for this buffer
|
|
7 if (exists("b:did_ftplugin"))
|
2202
|
8 finish
|
1620
|
9 endif
|
|
10 let b:did_ftplugin = 1
|
|
11
|
|
12 if !exists('b:git_dir')
|
2202
|
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')) && exists('b:git_dir')
|
|
19 let b:git_dir = substitute(b:git_dir,'\\','/','g')
|
|
20 endif
|
1620
|
21 endif
|
|
22
|
|
23 if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
|
2202
|
24 if b:git_dir =~# '/\.git$' " Not a bare repository
|
|
25 let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&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'
|
1620
|
29 else
|
2202
|
30 setlocal keywordprg=git\ show
|
1620
|
31 endif
|
2034
|
32 if has('gui_running')
|
|
33 let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','')
|
|
34 endif
|
1620
|
35
|
|
36 setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
|
|
37 let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"
|