Skip to content

Instantly share code, notes, and snippets.

@k-takata
Created July 17, 2012 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k-takata/3129572 to your computer and use it in GitHub Desktop.
Save k-takata/3129572 to your computer and use it in GitHub Desktop.
Vim syntax file for hg commit file
diff -r 942df3a8051b -r 1dd8790a0648 runtime/filetype.vim
--- a/runtime/filetype.vim Mon Jul 16 19:27:29 2012 +0200
+++ b/runtime/filetype.vim Thu Aug 02 00:50:57 2012 +0900
@@ -1119,6 +1119,9 @@
" Maya Extension Language
au BufNewFile,BufRead *.mel setf mel
+" Mercurial (hg) commit file
+au BufNewFile,BufRead hg-editor-*.txt setf hgcommit
+
" Mercurial config (looks like generic config file)
au BufNewFile,BufRead *.hgrc,*hgrc setf cfg
diff -r 942df3a8051b -r 1dd8790a0648 runtime/syntax/hgcommit.vim
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/syntax/hgcommit.vim Thu Aug 02 00:50:57 2012 +0900
@@ -0,0 +1,27 @@
+" Vim syntax file
+" Language: hg (Mercurial) commit file
+" Maintainer: Ken Takata <kentkt at csc dot jp>
+" Last Change: 2012 Aug 2
+" Filenames: hg-editor-*.txt
+" License: VIM License
+" URL: https://github.com/k-takata/hg-vim
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn match hgcommitComment "^HG:.*$"
+syn match hgcommitUser "^HG: user: \zs.*$" contained containedin=hgcommitComment
+syn match hgcommitBranch "^HG: branch \zs.*$" contained containedin=hgcommitComment
+syn match hgcommitAdded "^HG: \zsadded .*$" contained containedin=hgcommitComment
+syn match hgcommitChanged "^HG: \zschanged .*$" contained containedin=hgcommitComment
+syn match hgcommitRemoved "^HG: \zsremoved .*$" contained containedin=hgcommitComment
+
+hi def link hgcommitComment Comment
+hi def link hgcommitUser String
+hi def link hgcommitBranch String
+hi def link hgcommitAdded Identifier
+hi def link hgcommitChanged Special
+hi def link hgcommitRemoved Constant
+
+let b:current_syntax = "hgcommit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment