Skip to content

Commit 1d4c498

Browse files
szederspearce
authored andcommitted
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>
1 parent 9800c0d commit 1d4c498

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

contrib/vim/README

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)