git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manlio Perillo <manlio.perillo@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: about vim contrib support
Date: Thu, 10 Jan 2013 12:17:31 +0100	[thread overview]
Message-ID: <50EEA34B.7070102@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

In the contrib/vim/README file there are instructions about how to setup
git support with Vim builtin git syntax files.

However these instructions seems to be redundant, since the system
filetype.vim file already have the autocmd rules.

The only issue I found is with:

autocmd BufNewFile,BufRead .msg.[0-9]*
	\ if getline(1) =~ '^From.*# This line is ignored.$' |
	\   setf gitsendemail |
	\ endif

It should be:

autocmd BufNewFile,BufRead [0-9]*.patch

IMHO it should contain some other checks, to make sure it is a patch
generated by git format-patch, and not, as an example, a plain patch or
a Mercurial patch.


By the way: I don't understand the purpose of gitsendemail syntax.
On my system it does not highlight the diff.

I have implemented an alternate gitpatch syntax file, attached.
What I would like to get, is to syntax highligth the commit subject
message, but I'm not a Vim expert.


Regards   Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDuo0sACgkQscQJ24LbaUTZMQCgm7QRylhxc5v4i4tHBfUXCl8o
36IAn3t72o/+5R/x1TF7r9mu85z6wY25
=b2l0
-----END PGP SIGNATURE-----

[-- Attachment #2: gitpatch.vim --]
[-- Type: text/plain, Size: 609 bytes --]

" Vim syntax file
" Language:		git format-patch message
" Maintainer:	Manlio Perillo
" Filenames:	[0-9]*.patch (first line is "From ... # This line is ignored.")
" Last Change:	2014 Gen 10

if exists("b:current_syntax")
    finish
endif

syn case match

syn match   gitsendemailComment "\%^From.*#.*"
syn match   gitsendemailComment "^GIT:.*"

if has("spell")
    syn spell toplevel
endif

syn include @gitcommitMessage syntax/gitcommit.vim
syn region gitcommitMessage start=/^Subject: \@=/ end=/^$|^#\@=/ contains=@gitcommitMessage

hi def link gitsendemailComment Comment

let b:current_syntax = "gitpatch"

             reply	other threads:[~2013-01-10 11:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 11:17 Manlio Perillo [this message]
2013-01-10 11:39 ` about vim contrib support Jeff King
2013-01-10 11:51   ` Manlio Perillo
2013-01-10 13:36     ` Jeff King
2013-01-10 20:54   ` [PATCH] contrib/vim: simplify instructions for old vim support Jonathan Nieder
2013-01-10 21:34     ` Jeff King
2013-01-10 23:08       ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50EEA34B.7070102@gmail.com \
    --to=manlio.perillo@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).