git/list[1] front-page[2] threads[3] people[4] search[5] about
 

about vim contrib support

From
Manlio Perillo <manlio.perillo@gmail.com>
Date
Jan 10, 2013, 11:17 UTC
Message-ID
<50EEA34B.7070102@gmail.com>
-----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-----

" 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"
Next: Jeff King
Message 1 of 7 in “about vim contrib support”
  1. Manlio PerilloJan 10, 2013
  2. Jeff KingJan 10, 2013
  3. Manlio PerilloJan 10, 2013
  4. Jeff KingJan 10, 2013
  5. contrib/vim: simplify instructions for old vim supportJonathan Nieder, Jan 10, 2013
  6. Jeff KingJan 10, 2013
  7. Jonathan NiederJan 10, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.