public
Created

Vim syntax file for hg commit file

  • Download Gist
add-hg-vim.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
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"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.