{"thread":{"id":"15651","subject":"[PATCH] vim syntax: highlight the diff in commit message template","startedAt":"2008-09-24T15:22:06Z","lastAt":"2008-09-30T08:29:37Z","messageCount":14,"participants":["SZEDER Gábor","Jeff King","Shawn O. Pearce","Garry Dolley","Bob Hiestand","Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"91478","messageId":"1222269726-15632-1-git-send-email-szeder@ira.uka.de","threadId":"15651","inReplyTo":null,"subject":"[PATCH] vim syntax: highlight the diff in commit message template","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-09-24T15:22:06Z","receivedAt":"2008-09-24T15:22:06Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The template generated by 'git commit -v' is much easier to read now.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n contrib/vim/syntax/gitcommit.vim |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim\nindex 332121b..0872e65 100644\n--- a/contrib/vim/syntax/gitcommit.vim\n+++ b/contrib/vim/syntax/gitcommit.vim\n@@ -16,3 +16,5 @@ hi def link gitUntracked Comment\n hi def link gitCommitFile Type\n hi def link gitChangedFile Constant\n hi def link gitUntrackedFile Constant\n+\n+source $VIMRUNTIME/syntax/diff.vim\n-- \n1.6.0.2.323.gb1a20\n"},{"id":"91484","messageId":"20080924155745.GA3908@coredump.intra.peff.net","threadId":"15651","inReplyTo":"1222269726-15632-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH] vim syntax: highlight the diff in commit message template","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-24T15:57:45Z","receivedAt":"2008-09-24T15:57:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 24, 2008 at 05:22:06PM +0200, SZEDER Gábor wrote:\n\n> The template generated by 'git commit -v' is much easier to read now.\n\nI think the goal of this change is good, but I'm not sure about the\nimplementation:\n\n> +source $VIMRUNTIME/syntax/diff.vim\n\nDespite having written the original gitcommit.vim, I am largely clueless\nabout vim syntax highlighting. However, the gitcommit.vim shipped with\nvim 7.2 does this:\n\n  syn include @gitcommitDiff syntax/diff.vim\n  syn region gitcommitDiff start=/\\%(^diff --git \\)\\@=/ end=/^$\\|^#\\@=/ contains=@gitcommitDiff\n\nwhich seems a bit more robust to me. I have no idea if that syntax\nintroduces any limitations about which versions of vim can be used.\n\nHowever, this brings up a more important question: is there any reason\nfor git to ship a vim syntax file when there is already a maintained\n(and IMHO, much superior) one that ships with vim? The only people who\nshould need our file are people on versions of vim older than the ones\nthat ship gitcommit.vim. For those people, I suspect they are better off\ngoing to vim.org and grabbing the up to date (and undoubtedly more\ncarefully constructed) syntax file rather than pulling what is in our\ncontrib/ area.\n\nIs there any objection to simply removing it (and probably replacing it\nwith a note to go look at the official highlighting file)?\n\n-Peff\n"},{"id":"91494","messageId":"20080924170154.GA6816@neumann","threadId":"15651","inReplyTo":"20080924155745.GA3908@coredump.intra.peff.net","subject":"Re: [PATCH] vim syntax: highlight the diff in commit message template","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-09-24T17:01:54Z","receivedAt":"2008-09-24T17:01:54Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\nOn Wed, Sep 24, 2008 at 11:57:45AM -0400, Jeff King wrote:\n> Is there any objection to simply removing it (and probably replacing it\n> with a note to go look at the official highlighting file)?\nI'm for it, because I didn't know that there is an official git syntax\nhighlight file out there.  Indeed, I haven't even know that vim 7.2 is\nout.\n\nThanks,\nGábor\n"},{"id":"91500","messageId":"20080924175315.GA10337@coredump.intra.peff.net","threadId":"15651","inReplyTo":"20080924170154.GA6816@neumann","subject":"[RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-24T17:53:15Z","receivedAt":"2008-09-24T17:53:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"[Tim Pope cc'd as the author of the official version. Tim: just an FYI,\nbut if you have any comments, please feel free to share]\n\n[Shawn cc'd as the interim maintainer. I, for one, welcome our\nnew Java-programming overlords].\n\nOn Wed, Sep 24, 2008 at 07:01:54PM +0200, SZEDER Gábor wrote:\n\n> > Is there any objection to simply removing it (and probably replacing it\n> > with a note to go look at the official highlighting file)?\n> I'm for it, because I didn't know that there is an official git syntax\n> highlight file out there.  Indeed, I haven't even know that vim 7.2 is\n> out.\n\nHere is a patch, then. Shawn, we should probably give any vim users a\nfew days to object in case there is something they don't like about the\nupstream version, but other than that, I think this should be applied to\nmaster.\n\n-- >8 --\nremove vim syntax highlighting in favor of upstream\n\nAs of version 7.2, vim ships with its own syntax\nhighlighting for git commit messages, which is:\n\n  1. more comprehensive in splitting up the various\n     components of the file\n\n  2. in accordance with the usual vim behavior for syntax\n     highlighting (e.g., respecting b:current_syntax)\n\n  3. presumably better maintained (I have not been using\n     what's in git's contrib/ directory for some time in\n     favor of the upstream version)\n\nThis patch gets rid of our local version and just points\ninterested parties to the upstream version.\n---\n contrib/vim/README               |   13 +++++++++++--\n contrib/vim/syntax/gitcommit.vim |   18 ------------------\n 2 files changed, 11 insertions(+), 20 deletions(-)\n delete mode 100644 contrib/vim/syntax/gitcommit.vim\n\ndiff --git a/contrib/vim/README b/contrib/vim/README\nindex 9e7881f..12d61bb 100644\n--- a/contrib/vim/README\n+++ b/contrib/vim/README\n@@ -1,8 +1,17 @@\n-To syntax highlight git's commit messages, you need to:\n-  1. Copy syntax/gitcommit.vim to vim's syntax directory:\n+Syntax highlighting for git commit messages is included with the vim\n+distribution as of vim 7.2, and should work automatically.\n+\n+If you have an older version of vim, you can get the latest syntax file\n+from the vim project:\n+\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitcommit.vim\n+\n+To install:\n+\n+  1. Copy gitcommit.vim to vim's syntax directory:\n      $ mkdir -p $HOME/.vim/syntax\n      $ cp syntax/gitcommit.vim $HOME/.vim/syntax\n   2. Auto-detect the editing of git commit files:\n      $ cat >>$HOME/.vimrc <<'EOF'\n      autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n      EOF\ndiff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim\ndeleted file mode 100644\nindex 332121b..0000000\n--- a/contrib/vim/syntax/gitcommit.vim\n+++ /dev/null\n@@ -1,18 +0,0 @@\n-syn region gitLine start=/^#/ end=/$/\n-syn region gitCommit start=/^# Changes to be committed:$/ end=/^#$/ contains=gitHead,gitCommitFile\n-syn region gitHead contained start=/^#   (.*)/ end=/^#$/\n-syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile\n-syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile\n-\n-syn match gitCommitFile contained /^#\\t.*/hs=s+2\n-syn match gitChangedFile contained /^#\\t.*/hs=s+2\n-syn match gitUntrackedFile contained /^#\\t.*/hs=s+2\n-\n-hi def link gitLine Comment\n-hi def link gitCommit Comment\n-hi def link gitChanged Comment\n-hi def link gitHead Comment\n-hi def link gitUntracked Comment\n-hi def link gitCommitFile Type\n-hi def link gitChangedFile Constant\n-hi def link gitUntrackedFile Constant\n-- \n1.6.0.2.473.g126a14\n"},{"id":"91505","messageId":"20080924180742.GB3669@spearce.org","threadId":"15651","inReplyTo":"20080924175315.GA10337@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-24T18:07:42Z","receivedAt":"2008-09-24T18:07:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jeff King <peff@peff.net> wrote:\n> [Shawn cc'd as the interim maintainer. I, for one, welcome our\n> new Java-programming overlords].\n\nHeh.\n \n> Here is a patch, then. Shawn, we should probably give any vim users a\n> few days to object in case there is something they don't like about the\n> upstream version, but other than that, I think this should be applied to\n> master.\n\nThanks.  Its queued in my pile of patches waiting for ACKs and/or\ncomments before I actually apply them to my tree.  I'll let it sit\nfor a little, but I think we want to apply it.\n\n> -- >8 --\n> remove vim syntax highlighting in favor of upstream\n> \n> As of version 7.2, vim ships with its own syntax\n> highlighting for git commit messages, which is:\n> \n>   1. more comprehensive in splitting up the various\n>      components of the file\n> \n>   2. in accordance with the usual vim behavior for syntax\n>      highlighting (e.g., respecting b:current_syntax)\n> \n>   3. presumably better maintained (I have not been using\n>      what's in git's contrib/ directory for some time in\n>      favor of the upstream version)\n> \n> This patch gets rid of our local version and just points\n> interested parties to the upstream version.\n\n-- \nShawn.\n"},{"id":"91509","messageId":"20080924183933.GA30265@garry-thinkpad.arpnetworks.com","threadId":"15651","inReplyTo":"20080924175315.GA10337@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Garry Dolley","fromEmail":"gdolley@arpnetworks.com","sentAt":"2008-09-24T18:39:33Z","receivedAt":"2008-09-24T18:39:33Z","isPatch":true,"sender":{"key":"gdolley@ucla.edu","avatar":"https://gravatar.com/avatar/b9ca98e2d5fd3a993ad695e8315f078b7ae364d2d1b637a6adecf8953a034dd2?d=mp&s=160"},"body":"On Wed, Sep 24, 2008 at 01:53:15PM -0400, Jeff King wrote:\n> [Tim Pope cc'd as the author of the official version. Tim: just an FYI,\n> but if you have any comments, please feel free to share]\n> \n> [Shawn cc'd as the interim maintainer. I, for one, welcome our\n> new Java-programming overlords].\n> \n> On Wed, Sep 24, 2008 at 07:01:54PM +0200, SZEDER Gábor wrote:\n> \n> > > Is there any objection to simply removing it (and probably replacing it\n> > > with a note to go look at the official highlighting file)?\n> > I'm for it, because I didn't know that there is an official git syntax\n> > highlight file out there.  Indeed, I haven't even know that vim 7.2 is\n> > out.\n> \n> Here is a patch, then. Shawn, we should probably give any vim users a\n> few days to object in case there is something they don't like about the\n> upstream version, but other than that, I think this should be applied to\n> master.\n\nAs a Vim user, I think removing the syntax file, and giving a\nreference to the official one, is fine.\n\n-- \nGarry Dolley\nARP Networks, Inc.\nhttp://scie.nti.st\nLos Angeles County REACT, Unit 336\nWQGK336\n"},{"id":"91516","messageId":"20080924195658.GB6816@neumann","threadId":"15651","inReplyTo":"20080924175315.GA10337@coredump.intra.peff.net","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-09-24T19:56:58Z","receivedAt":"2008-09-24T19:56:58Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\nOn Wed, Sep 24, 2008 at 01:53:15PM -0400, Jeff King wrote:\n> +Syntax highlighting for git commit messages is included with the vim\n> +distribution as of vim 7.2, and should work automatically.\n> +\n> +If you have an older version of vim, you can get the latest syntax file\n> +from the vim project:\n> +\n> +  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitcommit.vim\n\nvim 7.2 provides support not only for commit messages but also for\nother git-related filetypes.  I think it would be good to mention\nthem, too, therefore I extended your patch with them.\n\n\n-- >8 --\nremove vim syntax highlighting in favor of upstream\n\nAs of version 7.2, vim ships with its own syntax\nhighlighting for git commit messages, which is:\n\n  1. more comprehensive in splitting up the various\n     components of the file\n\n  2. in accordance with the usual vim behavior for syntax\n     highlighting (e.g., respecting b:current_syntax)\n\n  3. presumably better maintained (I have not been using\n     what's in git's contrib/ directory for some time in\n     favor of the upstream version)\n\nFurthermore, vim 7.2 also provides syntax highlighting for\nother git filetypes (gitconfig, rebase, send-email).\n\nThis patch gets rid of our local version and just points\ninterested parties to the upstream version.\n\nThe code for auto-detecting filetypes is taken from vim 7.2's\nruntime/filetype.vim.\n\n---\n contrib/vim/README               |   38 ++++++++++++++++++++++++++++++--------\n contrib/vim/syntax/gitcommit.vim |   18 ------------------\n 2 files changed, 30 insertions(+), 26 deletions(-)\n delete mode 100644 contrib/vim/syntax/gitcommit.vim\n\ndiff --git a/contrib/vim/README b/contrib/vim/README\nindex 9e7881f..a811675 100644\n--- a/contrib/vim/README\n+++ b/contrib/vim/README\n@@ -1,8 +1,30 @@\n-To syntax highlight git's commit messages, you need to:\n-  1. Copy syntax/gitcommit.vim to vim's syntax directory:\n-     $ mkdir -p $HOME/.vim/syntax\n-     $ cp syntax/gitcommit.vim $HOME/.vim/syntax\n-  2. Auto-detect the editing of git commit files:\n-     $ cat >>$HOME/.vimrc <<'EOF'\n-     autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n-     EOF\n+Syntax highlighting for git commit messages, config files, etc. is\n+included with the vim distribution as of vim 7.2, and should work\n+automatically.\n+\n+If you have an older version of vim, you can get the latest syntax\n+files from the vim project:\n+\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/git.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitcommit.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitconfig.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitrebase.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitsendemail.vim\n+\n+To install:\n+\n+  1. Copy these files to vim's syntax directory $HOME/.vim/syntax\n+  2. Auto-detect the editing of various git-related filetypes:\n+\t$ cat >>$HOME/.vimrc <<'EOF'\n+\tautocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG    setf gitcommit\n+\tautocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig\n+\tautocmd BufNewFile,BufRead git-rebase-todo         setf gitrebase\n+\tautocmd BufNewFile,BufRead .msg.[0-9]*\n+\t\t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n+\t\t\\   setf gitsendemail |\n+\t\t\\ endif\n+\tautocmd BufNewFile,BufRead *.git/**\n+\t\t\\ if getline(1) =~ '^\\x\\{40\\}\\>\\|^ref: ' |\n+\t\t\\   setf git |\n+\t\t\\ endif\n+\tEOF\ndiff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim\ndeleted file mode 100644\nindex 332121b..0000000\n--- a/contrib/vim/syntax/gitcommit.vim\n+++ /dev/null\n@@ -1,18 +0,0 @@\n-syn region gitLine start=/^#/ end=/$/\n-syn region gitCommit start=/^# Changes to be committed:$/ end=/^#$/ contains=gitHead,gitCommitFile\n-syn region gitHead contained start=/^#   (.*)/ end=/^#$/\n-syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile\n-syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile\n-\n-syn match gitCommitFile contained /^#\\t.*/hs=s+2\n-syn match gitChangedFile contained /^#\\t.*/hs=s+2\n-syn match gitUntrackedFile contained /^#\\t.*/hs=s+2\n-\n-hi def link gitLine Comment\n-hi def link gitCommit Comment\n-hi def link gitChanged Comment\n-hi def link gitHead Comment\n-hi def link gitUntracked Comment\n-hi def link gitCommitFile Type\n-hi def link gitChangedFile Constant\n-hi def link gitUntrackedFile Constant\n"},{"id":"91517","messageId":"20080924195952.GA17534@coredump.intra.peff.net","threadId":"15651","inReplyTo":"20080924195658.GB6816@neumann","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-24T19:59:52Z","receivedAt":"2008-09-24T19:59:52Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 24, 2008 at 09:56:58PM +0200, SZEDER Gábor wrote:\n\n> vim 7.2 provides support not only for commit messages but also for\n> other git-related filetypes.  I think it would be good to mention\n> them, too, therefore I extended your patch with them.\n\nI think that is a sensible change.\n\n-Peff\n"},{"id":"91587","messageId":"20080925124817.GC6816@neumann","threadId":"15651","inReplyTo":"20080924195658.GB6816@neumann","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-09-25T12:48:17Z","receivedAt":"2008-09-25T12:48:17Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\nOK, so I'm complaining a bit.\n\nOn Wed, Sep 24, 2008 at 09:56:58PM +0200, SZEDER Gábor wrote:\n> +To install:\n> +\n> +  1. Copy these files to vim's syntax directory $HOME/.vim/syntax\n> +  2. Auto-detect the editing of various git-related filetypes:\n> +\t$ cat >>$HOME/.vimrc <<'EOF'\n> +\tautocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG    setf gitcommit\n> +\tautocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig\n> +\tautocmd BufNewFile,BufRead git-rebase-todo         setf gitrebase\n> +\tautocmd BufNewFile,BufRead .msg.[0-9]*\n> +\t\t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n> +\t\t\\   setf gitsendemail |\n> +\t\t\\ endif\n> +\tautocmd BufNewFile,BufRead *.git/**\n> +\t\t\\ if getline(1) =~ '^\\x\\{40\\}\\>\\|^ref: ' |\n> +\t\t\\   setf git |\n> +\t\t\\ endif\n> +\tEOF\n\nThere are issues with this second step.  If I append this code to my\n.vimrc, then vim sometimes overrides the filetype with conf.\n\nvim has a guessing rule for detecting conf files, which triggers if\none of the first five lines of the file begins with a '#'.  So if I\nstart to write a new commit message or I interactively rebase 4 or\nless commits, then this rule triggers and vim overrides the git\nfiletype with filetype conf.  If I do a commit --amend with a long\nenough original commit message or an interactive rebase with more than\n4 commit, then this rule no more triggers and everything is fine.\n\nBut what's really puzzling is that if I insert the above code into\n$VIMRUNTIME/filetype.vim (at the spot where it can be found in vim\n7.2's filetype.vim), then everything works as expected, git filetypes\nare never overridden.\n\nThis is not related to the changes in this patch.  git's original vim\nsyntax highlight for commit messages has the exact same behaviour.\n\nThe first step is OK: it doesn't matter whether I put git-related\nsyntax files under $HOME/.vim/syntax/ or under $VIMRUNTIME/syntax/.\n\nI'm using vim 7.1.138 in Ubuntu 8.04.\n\nAnyone have a clue?\n\n\nThanks,\nGábor\n"},{"id":"91595","messageId":"cc29171c0809250700s3efa7601pbdb96d1bd94ab89b@mail.gmail.com","threadId":"15651","inReplyTo":"20080925124817.GC6816@neumann","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Bob Hiestand","fromEmail":"bob.hiestand@gmail.com","sentAt":"2008-09-25T14:00:49Z","receivedAt":"2008-09-25T14:00:49Z","isPatch":true,"sender":{"key":"bob.hiestand@gmail.com","avatar":null},"body":"On Thu, Sep 25, 2008 at 7:48 AM, SZEDER Gábor <szeder@ira.uka.de> wrote:\n> Hi,\n>\n> OK, so I'm complaining a bit.\n>\n> On Wed, Sep 24, 2008 at 09:56:58PM +0200, SZEDER Gábor wrote:\n>> +To install:\n>> +\n>> +  1. Copy these files to vim's syntax directory $HOME/.vim/syntax\n>> +  2. Auto-detect the editing of various git-related filetypes:\n>> +     $ cat >>$HOME/.vimrc <<'EOF'\n>> +     autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG    setf gitcommit\n>> +     autocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig\n>> +     autocmd BufNewFile,BufRead git-rebase-todo         setf gitrebase\n>> +     autocmd BufNewFile,BufRead .msg.[0-9]*\n>> +             \\ if getline(1) =~ '^From.*# This line is ignored.$' |\n>> +             \\   setf gitsendemail |\n>> +             \\ endif\n>> +     autocmd BufNewFile,BufRead *.git/**\n>> +             \\ if getline(1) =~ '^\\x\\{40\\}\\>\\|^ref: ' |\n>> +             \\   setf git |\n>> +             \\ endif\n>> +     EOF\n>\n> There are issues with this second step.  If I append this code to my\n> .vimrc, then vim sometimes overrides the filetype with conf.\n>\n> vim has a guessing rule for detecting conf files, which triggers if\n> one of the first five lines of the file begins with a '#'.  So if I\n> start to write a new commit message or I interactively rebase 4 or\n> less commits, then this rule triggers and vim overrides the git\n> filetype with filetype conf.  If I do a commit --amend with a long\n> enough original commit message or an interactive rebase with more than\n> 4 commit, then this rule no more triggers and everything is fine.\n>\n> But what's really puzzling is that if I insert the above code into\n> $VIMRUNTIME/filetype.vim (at the spot where it can be found in vim\n> 7.2's filetype.vim), then everything works as expected, git filetypes\n> are never overridden.\n>\n> This is not related to the changes in this patch.  git's original vim\n> syntax highlight for commit messages has the exact same behaviour.\n>\n> The first step is OK: it doesn't matter whether I put git-related\n> syntax files under $HOME/.vim/syntax/ or under $VIMRUNTIME/syntax/.\n\nI'd guess that your autocommands defined in .vimrc take effect after\nthe default file type settings.  When you use ':setf', it\nintentionally will not override the existing file type if one has\nalready been detected.\n\nUse ':help new-filetype' to see the various ways you can interact with\nand/or override the default filetype detection.\n\nbob\n"},{"id":"91842","messageId":"20080929145542.GA18340@spearce.org","threadId":"15651","inReplyTo":"20080924195658.GB6816@neumann","subject":"Re: [RFC/PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-09-29T14:55:42Z","receivedAt":"2008-09-29T14:55:42Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"SZEDER GGGbor <szeder@ira.uka.de> wrote:\n> remove vim syntax highlighting in favor of upstream\n> \n> As of version 7.2, vim ships with its own syntax\n> highlighting for git commit messages, which is:\n> \n>   1. more comprehensive in splitting up the various\n>      components of the file\n> \n>   2. in accordance with the usual vim behavior for syntax\n>      highlighting (e.g., respecting b:current_syntax)\n> \n>   3. presumably better maintained (I have not been using\n>      what's in git's contrib/ directory for some time in\n>      favor of the upstream version)\n> \n> Furthermore, vim 7.2 also provides syntax highlighting for\n> other git filetypes (gitconfig, rebase, send-email).\n> \n> This patch gets rid of our local version and just points\n> interested parties to the upstream version.\n> \n> The code for auto-detecting filetypes is taken from vim 7.2's\n> runtime/filetype.vim.\n> \n> ---\n>  contrib/vim/README               |   38 ++++++++++++++++++++++++++++++--------\n>  contrib/vim/syntax/gitcommit.vim |   18 ------------------\n>  2 files changed, 30 insertions(+), 26 deletions(-)\n>  delete mode 100644 contrib/vim/syntax/gitcommit.vim\n\nMissing SBO line?\n \n-- \nShawn.\n"},{"id":"91876","messageId":"20080929200814.GA19840@neumann","threadId":"15651","inReplyTo":"20080929145542.GA18340@spearce.org","subject":"[PATCH] remove vim syntax highlighting in favor of upstream","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2008-09-29T20:08:14Z","receivedAt":"2008-09-29T20:08:14Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"As of version 7.2, vim ships with its own syntax\nhighlighting for git commit messages, which is:\n\n  1. more comprehensive in splitting up the various\n     components of the file\n\n  2. in accordance with the usual vim behavior for syntax\n     highlighting (e.g., respecting b:current_syntax)\n\n  3. presumably better maintained (I have not been using\n     what's in git's contrib/ directory for some time in\n     favor of the upstream version)\n\nFurthermore, vim upsream also provides syntax highlighting\nfor other git filetypes (gitconfig, rebase, send-email).\n\nThis patch gets rid of our local version and just points\ninterested parties to the upstream version.\n\nThe code for auto-detecting filetypes is taken from vim's\nruntime/filetype.vim.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n\nOn Mon, Sep 29, 2008 at 07:55:42AM -0700, Shawn O. Pearce wrote:\n> Missing SBO line?\nHere it is.  Since significant parts of the patch and the commit\nmessage are from Jeff, maybe he should sign off, too?\n\nNote, that this patch is slightly different from the previous one, as\nit proposes writing the auto-detect commands into ~/.vim/filetype.vim\ninstead of ~/.vimrc.  It's not quite clear to me why, but it seems to\nresolve the filetype confusion I mentioned in my previous email.\n\n\n contrib/vim/README               |   38 ++++++++++++++++++++++++++++++--------\n contrib/vim/syntax/gitcommit.vim |   18 ------------------\n 2 files changed, 30 insertions(+), 26 deletions(-)\n delete mode 100644 contrib/vim/syntax/gitcommit.vim\n\ndiff --git a/contrib/vim/README b/contrib/vim/README\nindex 9e7881f..c487346 100644\n--- a/contrib/vim/README\n+++ b/contrib/vim/README\n@@ -1,8 +1,30 @@\n-To syntax highlight git's commit messages, you need to:\n-  1. Copy syntax/gitcommit.vim to vim's syntax directory:\n-     $ mkdir -p $HOME/.vim/syntax\n-     $ cp syntax/gitcommit.vim $HOME/.vim/syntax\n-  2. Auto-detect the editing of git commit files:\n-     $ cat >>$HOME/.vimrc <<'EOF'\n-     autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n-     EOF\n+Syntax highlighting for git commit messages, config files, etc. is\n+included with the vim distribution as of vim 7.2, and should work\n+automatically.\n+\n+If you have an older version of vim, you can get the latest syntax\n+files from the vim project:\n+\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/git.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitcommit.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitconfig.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitrebase.vim\n+  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitsendemail.vim\n+\n+To install:\n+\n+  1. Copy these files to vim's syntax directory $HOME/.vim/syntax\n+  2. To auto-detect the editing of various git-related filetypes:\n+\t$ cat >>$HOME/.vim/filetype.vim <<'EOF'\n+\tautocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG    setf gitcommit\n+\tautocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig\n+\tautocmd BufNewFile,BufRead git-rebase-todo         setf gitrebase\n+\tautocmd BufNewFile,BufRead .msg.[0-9]*\n+\t\t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n+\t\t\\   setf gitsendemail |\n+\t\t\\ endif\n+\tautocmd BufNewFile,BufRead *.git/**\n+\t\t\\ if getline(1) =~ '^\\x\\{40\\}\\>\\|^ref: ' |\n+\t\t\\   setf git |\n+\t\t\\ endif\n+\tEOF\ndiff --git a/contrib/vim/syntax/gitcommit.vim b/contrib/vim/syntax/gitcommit.vim\ndeleted file mode 100644\nindex 332121b..0000000\n--- a/contrib/vim/syntax/gitcommit.vim\n+++ /dev/null\n@@ -1,18 +0,0 @@\n-syn region gitLine start=/^#/ end=/$/\n-syn region gitCommit start=/^# Changes to be committed:$/ end=/^#$/ contains=gitHead,gitCommitFile\n-syn region gitHead contained start=/^#   (.*)/ end=/^#$/\n-syn region gitChanged start=/^# Changed but not updated:/ end=/^#$/ contains=gitHead,gitChangedFile\n-syn region gitUntracked start=/^# Untracked files:/ end=/^#$/ contains=gitHead,gitUntrackedFile\n-\n-syn match gitCommitFile contained /^#\\t.*/hs=s+2\n-syn match gitChangedFile contained /^#\\t.*/hs=s+2\n-syn match gitUntrackedFile contained /^#\\t.*/hs=s+2\n-\n-hi def link gitLine Comment\n-hi def link gitCommit Comment\n-hi def link gitChanged Comment\n-hi def link gitHead Comment\n-hi def link gitUntracked Comment\n-hi def link gitCommitFile Type\n-hi def link gitChangedFile Constant\n-hi def link gitUntrackedFile Constant\n-- \n1.6.0.2.330.gcef5c\n"},{"id":"91878","messageId":"20080929201221.GA20944@coredump.intra.peff.net","threadId":"15651","inReplyTo":"20080929200814.GA19840@neumann","subject":"Re: [PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-29T20:12:21Z","receivedAt":"2008-09-29T20:12:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 29, 2008 at 10:08:14PM +0200, SZEDER Gábor wrote:\n\n> Here it is.  Since significant parts of the patch and the commit\n> message are from Jeff, maybe he should sign off, too?\n\nI think all of my changes were deletions, so I'm not sure there is any\ncopyright to claim. ;) But:\n\nSigned-off-by: Jeff King <peff@peff.net>\n\n> Note, that this patch is slightly different from the previous one, as\n> it proposes writing the auto-detect commands into ~/.vim/filetype.vim\n> instead of ~/.vimrc.  It's not quite clear to me why, but it seems to\n> resolve the filetype confusion I mentioned in my previous email.\n\nI haven't really tested this at all, as I have been running vim 7.2 for\na while now. But presumably it works for you, and hey, it's only\ncontrib/. :)\n\n-Peff\n"},{"id":"91908","messageId":"48E1E371.30804@drmicha.warpmail.net","threadId":"15651","inReplyTo":"20080929200814.GA19840@neumann","subject":"Re: [PATCH] remove vim syntax highlighting in favor of upstream","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-09-30T08:29:37Z","receivedAt":"2008-09-30T08:29:37Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"SZEDER Gábor venit, vidit, dixit 29.09.2008 22:08:\n> As of version 7.2, vim ships with its own syntax\n> highlighting for git commit messages, which is:\n> \n>   1. more comprehensive in splitting up the various\n>      components of the file\n> \n>   2. in accordance with the usual vim behavior for syntax\n>      highlighting (e.g., respecting b:current_syntax)\n> \n>   3. presumably better maintained (I have not been using\n>      what's in git's contrib/ directory for some time in\n>      favor of the upstream version)\n> \n> Furthermore, vim upsream also provides syntax highlighting\n> for other git filetypes (gitconfig, rebase, send-email).\n> \n> This patch gets rid of our local version and just points\n> interested parties to the upstream version.\n> \n> The code for auto-detecting filetypes is taken from vim's\n> runtime/filetype.vim.\n> \n> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>\n> ---\n> \n> On Mon, Sep 29, 2008 at 07:55:42AM -0700, Shawn O. Pearce wrote:\n>> Missing SBO line?\n> Here it is.  Since significant parts of the patch and the commit\n> message are from Jeff, maybe he should sign off, too?\n> \n> Note, that this patch is slightly different from the previous one, as\n> it proposes writing the auto-detect commands into ~/.vim/filetype.vim\n> instead of ~/.vimrc.  It's not quite clear to me why, but it seems to\n> resolve the filetype confusion I mentioned in my previous email.\n> \n> \n>  contrib/vim/README               |   38 ++++++++++++++++++++++++++++++--------\n>  contrib/vim/syntax/gitcommit.vim |   18 ------------------\n>  2 files changed, 30 insertions(+), 26 deletions(-)\n>  delete mode 100644 contrib/vim/syntax/gitcommit.vim\n> \n> diff --git a/contrib/vim/README b/contrib/vim/README\n> index 9e7881f..c487346 100644\n> --- a/contrib/vim/README\n> +++ b/contrib/vim/README\n> @@ -1,8 +1,30 @@\n> -To syntax highlight git's commit messages, you need to:\n> -  1. Copy syntax/gitcommit.vim to vim's syntax directory:\n> -     $ mkdir -p $HOME/.vim/syntax\n> -     $ cp syntax/gitcommit.vim $HOME/.vim/syntax\n> -  2. Auto-detect the editing of git commit files:\n> -     $ cat >>$HOME/.vimrc <<'EOF'\n> -     autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit\n> -     EOF\n> +Syntax highlighting for git commit messages, config files, etc. is\n> +included with the vim distribution as of vim 7.2, and should work\n> +automatically.\n> +\n> +If you have an older version of vim, you can get the latest syntax\n> +files from the vim project:\n> +\n> +  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/git.vim\n> +  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitcommit.vim\n> +  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitconfig.vim\n> +  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitrebase.vim\n> +  http://vim.svn.sourceforge.net/viewvc/vim/trunk/runtime/syntax/gitsendemail.vim\n> +\n> +To install:\n> +\n> +  1. Copy these files to vim's syntax directory $HOME/.vim/syntax\n> +  2. To auto-detect the editing of various git-related filetypes:\n> +\t$ cat >>$HOME/.vim/filetype.vim <<'EOF'\n> +\tautocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG    setf gitcommit\n> +\tautocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig\n> +\tautocmd BufNewFile,BufRead git-rebase-todo         setf gitrebase\n> +\tautocmd BufNewFile,BufRead .msg.[0-9]*\n> +\t\t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n> +\t\t\\   setf gitsendemail |\n> +\t\t\\ endif\n> +\tautocmd BufNewFile,BufRead *.git/**\n> +\t\t\\ if getline(1) =~ '^\\x\\{40\\}\\>\\|^ref: ' |\n> +\t\t\\   setf git |\n> +\t\t\\ endif\n> +\tEOF\n\nWorks as described with vim 7.1.\n\nHow about creating a syntax file for editing the files generated by\nformat-patch, especially 0000-cover-letter.patch? Should be mostly a\ncombination of \"git.vim\" and \"gitsendemail.vim\", but I didn't find any\nsyntax defs for the diffstat.\n\nMichael\n\nP.S.: What? Git doc linking to an svn repo? Someone needs to set up a\ngit mirror ;)\n"}]}