{"thread":{"id":"32581","subject":"about vim contrib support","startedAt":"2013-01-10T11:17:31Z","lastAt":"2013-01-10T23:08:55Z","messageCount":7,"participants":["Manlio Perillo","Jeff King","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"206450","messageId":"50EEA34B.7070102@gmail.com","threadId":"32581","inReplyTo":null,"subject":"about vim contrib support","fromName":"Manlio Perillo","fromEmail":"manlio.perillo@gmail.com","sentAt":"2013-01-10T11:17:31Z","receivedAt":"2013-01-10T11:17:31Z","isPatch":false,"sender":{"key":"manlio.perillo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6217088?v=4"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nHi.\n\nIn the contrib/vim/README file there are instructions about how to setup\ngit support with Vim builtin git syntax files.\n\nHowever these instructions seems to be redundant, since the system\nfiletype.vim file already have the autocmd rules.\n\nThe only issue I found is with:\n\nautocmd BufNewFile,BufRead .msg.[0-9]*\n\t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n\t\\   setf gitsendemail |\n\t\\ endif\n\nIt should be:\n\nautocmd BufNewFile,BufRead [0-9]*.patch\n\nIMHO it should contain some other checks, to make sure it is a patch\ngenerated by git format-patch, and not, as an example, a plain patch or\na Mercurial patch.\n\n\nBy the way: I don't understand the purpose of gitsendemail syntax.\nOn my system it does not highlight the diff.\n\nI have implemented an alternate gitpatch syntax file, attached.\nWhat I would like to get, is to syntax highligth the commit subject\nmessage, but I'm not a Vim expert.\n\n\nRegards   Manlio\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niEYEARECAAYFAlDuo0sACgkQscQJ24LbaUTZMQCgm7QRylhxc5v4i4tHBfUXCl8o\n36IAn3t72o/+5R/x1TF7r9mu85z6wY25\n=b2l0\n-----END PGP SIGNATURE-----\n\n\n\" Vim syntax file\n\" Language:\t\tgit format-patch message\n\" Maintainer:\tManlio Perillo\n\" Filenames:\t[0-9]*.patch (first line is \"From ... # This line is ignored.\")\n\" Last Change:\t2014 Gen 10\n\nif exists(\"b:current_syntax\")\n    finish\nendif\n\nsyn case match\n\nsyn match   gitsendemailComment \"\\%^From.*#.*\"\nsyn match   gitsendemailComment \"^GIT:.*\"\n\nif has(\"spell\")\n    syn spell toplevel\nendif\n\nsyn include @gitcommitMessage syntax/gitcommit.vim\nsyn region gitcommitMessage start=/^Subject: \\@=/ end=/^$|^#\\@=/ contains=@gitcommitMessage\n\nhi def link gitsendemailComment Comment\n\nlet b:current_syntax = \"gitpatch\"\n"},{"id":"206452","messageId":"20130110113958.GA17137@sigill.intra.peff.net","threadId":"32581","inReplyTo":"50EEA34B.7070102@gmail.com","subject":"Re: about vim contrib support","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-01-10T11:39:58Z","receivedAt":"2013-01-10T11:39:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 10, 2013 at 12:17:31PM +0100, Manlio Perillo wrote:\n\n> In the contrib/vim/README file there are instructions about how to setup\n> git support with Vim builtin git syntax files.\n> \n> However these instructions seems to be redundant, since the system\n> filetype.vim file already have the autocmd rules.\n\nWhat version of vim do you have? As the README says, version 7.2 and on\ncome with the files already, and you do not need to do anything. If you\nhave an older version that does not ship with them, and you are pulling\nthem down directly from the URLs provided, then your vim probably does\nnot already have them in its stock filetype.vim.\n\n> The only issue I found is with:\n> \n> autocmd BufNewFile,BufRead .msg.[0-9]*\n> \t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n> \t\\   setf gitsendemail |\n> \t\\ endif\n> \n> It should be:\n> \n> autocmd BufNewFile,BufRead [0-9]*.patch\n\nIt looks like .msg.[0-9] was originally used for send-email cover\nletters, and was changed to .gitsendemail.msg.* by commit eed6ca7. I\nthink your [0-9]*.patch would match something else entirely (though it\nis still broken, of course, as .msg.* does not exist anymore).\n\nI'd argue that we should just remove contrib/vim at this point. It has\nno actual files in it, only pointers to vim.org for pre-7.2 vim users.\nAnd that version was released in 2008, so the README is helping almost\nnobody at this point (if you are on an ancient platform, and are an avid\nenough vim user to download the syntax files, I suspect you would simply\ninstall a newer version of vim).\n\n> IMHO it should contain some other checks, to make sure it is a patch\n> generated by git format-patch, and not, as an example, a plain patch or\n> a Mercurial patch.\n> \n> By the way: I don't understand the purpose of gitsendemail syntax.\n> On my system it does not highlight the diff.\n\nAs far as I can tell, it is for cover letters, not for patches. Patches\nshould already be handled by existing RFC822-message highlighting.\n\n-Peff\n"},{"id":"206453","messageId":"50EEAB36.6060508@gmail.com","threadId":"32581","inReplyTo":"20130110113958.GA17137@sigill.intra.peff.net","subject":"Re: about vim contrib support","fromName":"Manlio Perillo","fromEmail":"manlio.perillo@gmail.com","sentAt":"2013-01-10T11:51:18Z","receivedAt":"2013-01-10T11:51:18Z","isPatch":false,"sender":{"key":"manlio.perillo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6217088?v=4"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA1\n\nIl 10/01/2013 12:39, Jeff King ha scritto:\n> On Thu, Jan 10, 2013 at 12:17:31PM +0100, Manlio Perillo wrote:\n> \n>> In the contrib/vim/README file there are instructions about how to setup\n>> git support with Vim builtin git syntax files.\n>>\n>> However these instructions seems to be redundant, since the system\n>> filetype.vim file already have the autocmd rules.\n> \n> What version of vim do you have? As the README says, version 7.2 and on\n> come with the files already, and you do not need to do anything.\n\nAh, right.\nI missed the first lines of the README file, sorry.\n\n\n> [...]\n>> The only issue I found is with:\n>>\n>> autocmd BufNewFile,BufRead .msg.[0-9]*\n>> \t\\ if getline(1) =~ '^From.*# This line is ignored.$' |\n>> \t\\   setf gitsendemail |\n>> \t\\ endif\n>>\n>> It should be:\n>>\n>> autocmd BufNewFile,BufRead [0-9]*.patch\n> \n> It looks like .msg.[0-9] was originally used for send-email cover\n> letters,\n\nOk, thanks.\nI was assuming it was used for the generated patched.\n\n> and was changed to .gitsendemail.msg.* by commit eed6ca7. I\n> think your [0-9]*.patch would match something else entirely (though it\n> is still broken, of course, as .msg.* does not exist anymore).\n> \n> [...]\n>> By the way: I don't understand the purpose of gitsendemail syntax.\n>> On my system it does not highlight the diff.\n> \n> As far as I can tell, it is for cover letters, not for patches. Patches\n> should already be handled by existing RFC822-message highlighting.\n> \n\n.patch files are handled by diff highlight.\nWhat I would like to do is to use gitcommit syntax highlight, in order\nto also enable commit subject message hightlight.\n\n\n\nThanks   Manlio\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.10 (GNU/Linux)\nComment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/\n\niEYEARECAAYFAlDuqzYACgkQscQJ24LbaUQ5TgCfQPeX53KOsQDF6WJF1AaSpiRd\nNpMAn0GcffJwTA/etrnOnXAQctCKAY4W\n=IDVf\n-----END PGP SIGNATURE-----\n"},{"id":"206458","messageId":"20130110133619.GA19232@sigill.intra.peff.net","threadId":"32581","inReplyTo":"50EEAB36.6060508@gmail.com","subject":"Re: about vim contrib support","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-01-10T13:36:19Z","receivedAt":"2013-01-10T13:36:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 10, 2013 at 12:51:18PM +0100, Manlio Perillo wrote:\n\n> .patch files are handled by diff highlight.\n> What I would like to do is to use gitcommit syntax highlight, in order\n> to also enable commit subject message hightlight.\n\nUsing the regular gitcommit highlighter would not make sense, as it is\nintended for the message templates seen when making a commit. Whereas\nformat-patch .patch files have the headers as email headers.\n\nYou can load the mail header highlighting on top of diff highlighting\nlike this (which only triggers for patches that look like emails):\n\n  au FileType diff\n    \\ if getline(1) =~ '^From ' |\n    \\   unlet b:current_syntax |\n    \\   runtime! syntax/mail.vim |\n    \\ endif\n\nBut maybe there is something else that you wanted to highlight. It's not\nclear to me what you want from gitcommit's highlighting. Is it the\n\"complain about long lines\" highlighting? I think that you'd have to\npull out of the gitcommit.vim and execute manually (and you'd have to\ntweak the regex to take into account the \"Subject: [PATCH] bits).\n\n-Peff\n"},{"id":"206467","messageId":"20130110205427.GG16532@google.com","threadId":"32581","inReplyTo":"20130110113958.GA17137@sigill.intra.peff.net","subject":"[PATCH] contrib/vim: simplify instructions for old vim support","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-01-10T20:54:27Z","receivedAt":"2013-01-10T20:54:27Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Rely on the upstream filetype.vim instead of duplicating its rules in\ngit's instructions for syntax highlighting support on pre-7.2 vim\nversions.\n\nThe result is a shorter contrib/vim/README.  More importantly, it lets\nus punt on maintenance of the autocmd rules.\n\nSo now when we fix the upstream gitsendemail rule in light of commit\need6ca7, new git users stuck on old vim reading contrib/vim/README can\nautomagically get the fix without any further changes needed to git.\n\nOnce the world has moved on to vim 7.2+ completely, we can get rid of\nthese instructions, but for now if they are this simple it's\neffortless to keep them.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nJeff King wrote:\n\n> I'd argue that we should just remove contrib/vim at this point. It has\n> no actual files in it, only pointers to vim.org for pre-7.2 vim users.\n\nI think that's reasonable.  Of course we can still discuss enhancements\nto the vim support on this list, but ultimately it's easiest to\ndistribute and document such work upstream in the usual way for vim\nplugins.\n\nHow about this patch?\n\n contrib/vim/README | 16 +++-------------\n 1 file changed, 3 insertions(+), 13 deletions(-)\n\ndiff --git a/contrib/vim/README b/contrib/vim/README\nindex fca1e17..8f16d06 100644\n--- a/contrib/vim/README\n+++ b/contrib/vim/README\n@@ -17,16 +17,6 @@ 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+\n+\t$ curl http://ftp.vim.org/pub/vim/runtime/filetype.vim |\n+\t\tsed -ne '/^\" Git$/, /^$/ p' >>$HOME/.vim/filetype.vim\n-- \n1.8.1\n"},{"id":"206469","messageId":"20130110213427.GA26138@sigill.intra.peff.net","threadId":"32581","inReplyTo":"20130110205427.GG16532@google.com","subject":"Re: [PATCH] contrib/vim: simplify instructions for old vim support","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-01-10T21:34:27Z","receivedAt":"2013-01-10T21:34:27Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jan 10, 2013 at 12:54:27PM -0800, Jonathan Nieder wrote:\n\n> Rely on the upstream filetype.vim instead of duplicating its rules in\n> git's instructions for syntax highlighting support on pre-7.2 vim\n> versions.\n> \n> The result is a shorter contrib/vim/README.  More importantly, it lets\n> us punt on maintenance of the autocmd rules.\n> \n> So now when we fix the upstream gitsendemail rule in light of commit\n> eed6ca7, new git users stuck on old vim reading contrib/vim/README can\n> automagically get the fix without any further changes needed to git.\n> \n> Once the world has moved on to vim 7.2+ completely, we can get rid of\n> these instructions, but for now if they are this simple it's\n> effortless to keep them.\n> \n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Jeff King wrote:\n> \n> > I'd argue that we should just remove contrib/vim at this point. It has\n> > no actual files in it, only pointers to vim.org for pre-7.2 vim users.\n> \n> I think that's reasonable.  Of course we can still discuss enhancements\n> to the vim support on this list, but ultimately it's easiest to\n> distribute and document such work upstream in the usual way for vim\n> plugins.\n> \n> How about this patch?\n\nYeah, I think this makes sense. I'd be fine with removing it entirely,\nbut it doesn't hurt to err on the conservative side and leave it there.\nIt's not like it's generating a huge maintenance burden, and with your\npatch, there is even less to maintain.\n\nAcked-by: Jeff King <peff@peff.net>\n\n-Peff\n"},{"id":"206475","messageId":"20130110230855.GC30784@google.com","threadId":"32581","inReplyTo":"20130110213427.GA26138@sigill.intra.peff.net","subject":"Re: [PATCH] contrib/vim: simplify instructions for old vim support","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-01-10T23:08:55Z","receivedAt":"2013-01-10T23:08:55Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n> On Thu, Jan 10, 2013 at 12:54:27PM -0800, Jonathan Nieder wrote:\n\n>> Rely on the upstream filetype.vim instead of duplicating its rules in\n>> git's instructions for syntax highlighting support on pre-7.2 vim\n>> versions.\n[...]\n> Yeah, I think this makes sense. I'd be fine with removing it entirely,\n> but it doesn't hurt to err on the conservative side and leave it there.\n> It's not like it's generating a huge maintenance burden, and with your\n> patch, there is even less to maintain.\n>\n> Acked-by: Jeff King <peff@peff.net>\n\nThanks for looking it over.\n"}]}