]> git.r.bdr.sh - rbdr/dotfiles/blame - vim/ftplugin/git.vim
Double color lines in vim
[rbdr/dotfiles] / vim / ftplugin / git.vim
CommitLineData
0d23b6e5
BB
1" Vim filetype plugin
2" Language: generic git output
3" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
4
5" Only do this when not done yet for this buffer
6if (exists("b:did_ftplugin"))
7 finish
8endif
9let b:did_ftplugin = 1
10
11if !exists('b:git_dir')
12 if expand('%:p') =~# '\.git\>'
13 let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
14 elseif $GIT_DIR != ''
15 let b:git_dir = $GIT_DIR
16 endif
17 if (has('win32') || has('win64')) && exists('b:git_dir')
18 let b:git_dir = substitute(b:git_dir,'\\','/','g')
19 endif
20endif
21
22if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
23 if b:git_dir =~# '/\.git$' " Not a bare repository
24 let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path
25 endif
26 let &l:path = escape(b:git_dir,'\, ').','.&l:path
27 let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
28else
29 setlocal keywordprg=git\ show
30endif
31if has('gui_running')
32 let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','')
33endif
34
35setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
36let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"