Mercurial > vim
annotate runtime/ftplugin/git.vim @ 18435:bdaf40503e2a
Added tag v8.1.2211 for changeset 5da355d15b88360e33bac2e45e38f44f6adcd60e
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Oct 2019 20:15:03 +0200 |
parents | 43efa4f5a8ea |
children | 5c40013d45ee |
rev | line source |
---|---|
1620 | 1 " Vim filetype plugin |
2 " Language: generic git output | |
2034 | 3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
4 " Last Change: 2016 Aug 29 |
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') | |
3465 | 13 if expand('%:p') =~# '[\/]\.git[\/]modules[\/]' |
14 " Stay out of the way | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
15 elseif expand('%:p') =~# '[\/]\.git[\/]worktrees' |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
16 let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>') |
3465 | 17 elseif expand('%:p') =~# '\.git\>' |
2202 | 18 let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') |
19 elseif $GIT_DIR != '' | |
20 let b:git_dir = $GIT_DIR | |
21 endif | |
22 if (has('win32') || has('win64')) && exists('b:git_dir') | |
23 let b:git_dir = substitute(b:git_dir,'\\','/','g') | |
24 endif | |
1620 | 25 endif |
26 | |
27 if exists('*shellescape') && exists('b:git_dir') && b:git_dir != '' | |
2202 | 28 if b:git_dir =~# '/\.git$' " Not a bare repository |
29 let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path | |
30 endif | |
31 let &l:path = escape(b:git_dir,'\, ').','.&l:path | |
32 let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' | |
1620 | 33 else |
2202 | 34 setlocal keywordprg=git\ show |
1620 | 35 endif |
2034 | 36 if has('gui_running') |
37 let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','') | |
38 endif | |
1620 | 39 |
40 setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','') | |
41 let b:undo_ftplugin = "setl keywordprg< path< includeexpr<" |