summaryrefslogtreecommitdiffstats
path: root/ftdetect/git.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2013-09-12 17:33:47 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2013-09-12 17:33:47 +0200
commit3bd65161236bf5344619861fbe18b30f5bfd1a23 (patch)
tree7ecdb8efb1f3ef4a290d82e4000d2ff52943308e /ftdetect/git.vim
parent5bc380150aee647d26a5a538ed855e9e82dcc7f7 (diff)
downloadvim-polyglot-3bd65161236bf5344619861fbe18b30f5bfd1a23.tar.gz
vim-polyglot-3bd65161236bf5344619861fbe18b30f5bfd1a23.zip
Add git support by tpope-git
Diffstat (limited to '')
-rw-r--r--ftdetect/git.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/ftdetect/git.vim b/ftdetect/git.vim
new file mode 100644
index 00000000..b1b14e0d
--- /dev/null
+++ b/ftdetect/git.vim
@@ -0,0 +1,20 @@
+" Git
+autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,MERGE_}MSG set ft=gitcommit
+autocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules set ft=gitconfig
+autocmd BufNewFile,BufRead */.config/git/config set ft=gitconfig
+autocmd BufNewFile,BufRead *.git/modules/**/config set ft=gitconfig
+autocmd BufNewFile,BufRead git-rebase-todo set ft=gitrebase
+autocmd BufNewFile,BufRead .msg.[0-9]*
+ \ if getline(1) =~ '^From.*# This line is ignored.$' |
+ \ set ft=gitsendemail |
+ \ endif
+autocmd BufNewFile,BufRead *.git/**
+ \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
+ \ set ft=git |
+ \ endif
+
+" This logic really belongs in scripts.vim
+autocmd BufNewFile,BufRead,StdinReadPost *
+ \ if getline(1) =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' |
+ \ set ft=git |
+ \ endif