@matheusbsbs / matheus-bagliano / commits / 1d4c498670
Fork 0

remove vim syntax highlighting in favor of upstream

As of version 7.2, vim ships with its own syntax highlighting for git commit messages, which is: 1. more comprehensive in splitting up the various components of the file 2. in accordance with the usual vim behavior for syntax highlighting (e.g., respecting b:current_syntax) 3. presumably better maintained (I have not been using what's in git's contrib/ directory for some time in favor of the upstream version) Furthermore, vim upsream also provides syntax highlighting for other git filetypes (gitconfig, rebase, send-email). This patch gets rid of our local version and just points interested parties to the upstream version. The code for auto-detecting filetypes is taken from vim's runtime/filetype.vim. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

SZEDER Gábor committed Sep 29, 2008 at 22:08 UTC 1d4c4986708688c14e72a5b442a3432048aeea79
2 files changed +30 -26
contrib/vim/README
+30 -8
@@ -1,8 +1,30 @@
1 -To syntax highlight git's commit messages, you need to:
2 - 1. Copy syntax/gitcommit.vim to vim's syntax directory:
3 - $ mkdir -p $HOME/.vim/syntax
4 - $ cp syntax/gitcommit.vim $HOME/.vim/syntax
5 - 2. Auto-detect the editing of git commit files:
6 - $ cat >>$HOME/.vimrc <<'EOF'
7 - autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit
8 - EOF
1 +Syntax highlighting for git commit messages, config files, etc. is
2 +included with the vim distribution as of vim 7.2, and should work
3 +automatically.
4 +
5 +If you have an older version of vim, you can get the latest syntax
6 +files from the vim project:
7 +
8 + http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/git.vim
9 + http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitcommit.vim
10 + http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitconfig.vim
11 + http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitrebase.vim
12 + http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitsendemail.vim
13 +
14 +To install:
15 +
16 + 1. Copy these files to vim's syntax directory $HOME/.vim/syntax
17 + 2. To auto-detect the editing of various git-related filetypes:
18 + $ cat >>$HOME/.vim/filetype.vim <<'EOF'
19 + autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit
20 + autocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig
21 + autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase
22 + autocmd BufNewFile,BufRead .msg.[0-9]*
23 + \ if getline(1) =~ '^From.*# This line is ignored.$' |
24 + \ setf gitsendemail |
25 + \ endif
26 + autocmd BufNewFile,BufRead *.git/**
27 + \ if getline(1) =~ '^\x\{40\}\>\|^ref: ' |
28 + \ setf git |
29 + \ endif
30 + EOF
contrib/vim/syntax/gitcommit.vim deleted
-18
@@ -1,18 +0,0 @@
1 -syn region gitLine start=/^#/ end=/$/
2 -syn region gitCommit start=/^# Changes to be committed:$/ end=/^#$/ contains=gitHead,gitCommitFile
3 -syn region gitHead contained start=/^# (.*)/ end=/^#$/
4 -syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile
5 -syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile
6 -
7 -syn match gitCommitFile contained /^#\t.*/hs=s+2
8 -syn match gitChangedFile contained /^#\t.*/hs=s+2
9 -syn match gitUntrackedFile contained /^#\t.*/hs=s+2
10 -
11 -hi def link gitLine Comment
12 -hi def link gitCommit Comment
13 -hi def link gitChanged Comment
14 -hi def link gitHead Comment
15 -hi def link gitUntracked Comment
16 -hi def link gitCommitFile Type
17 -hi def link gitChangedFile Constant
18 -hi def link gitUntrackedFile Constant