Add support for p4 changelists. Auto-positioning at Description is nice.
David Blume

David Blume commited on 2021-01-06 14:30:20
Showing 3 changed files, with 58 additions and 0 deletions.

... ...
@@ -0,0 +1,19 @@
1
+" Vim filetype detection file
2
+" Language:     P4 Changelist
3
+" Author:       Wade Brown <wbrown@roku.com>
4
+" Copyright:    Copyright (C) 2019  Wade Brown <wbrown@roku.com>
5
+" Licence:      You may redistribute this under the same terms as Vim itself
6
+"
7
+" Detects p4 changelists edits and sets up the editor appropriately
8
+
9
+if &compatible || version < 600
10
+    finish
11
+endif
12
+
13
+au BufNewFile,BufRead /tmp/tmp.*.* call s:changelist_scan()
14
+
15
+function! s:changelist_scan()
16
+    if getline(1) =~ '# A Perforce Change Specification.'
17
+        setfiletype p4changelist
18
+    endif
19
+endfunction
... ...
@@ -0,0 +1,3 @@
1
+set autoindent
2
+/^Description:
3
+.+1
... ...
@@ -0,0 +1,36 @@
1
+" Vim syntax file
2
+" Language:	Perforce Changelist
3
+" Maintainer:	Wade Brown <wbrown@roku.com>
4
+" Last Change:	2019 May 20
5
+
6
+" Quit when a (custom) syntax file was already loaded
7
+if exists("b:current_syntax")
8
+  finish
9
+endif
10
+
11
+" Comments
12
+syn match Comment "^#.*"
13
+
14
+" Changelist sections
15
+syn match Type "^Change:"
16
+syn match Type "^Client:"
17
+syn match Type "^User:"
18
+syn match Type "^Status:"
19
+syn match Type "^Description:"
20
+syn match Type "^Files:"
21
+
22
+" Swarm wants all descriptions tab indented
23
+syn match Error "^ \+"
24
+
25
+" Code review bits
26
+syn match PreProc "#review"
27
+syn match String '\s\+@[a-z]\+'
28
+
29
+" File operations
30
+syn match Special "# delete$"
31
+syn match Special "# edit$"
32
+syn match Special "# add$"
33
+
34
+let b:current_syntax = "p4changelist"
35
+
36
+" vim: ts=8 sw=2
0 37