about summary refs log tree commit diff stats
path: root/archive/2.transect/vimrc.vim
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-01-01 17:04:37 -0800
committerKartik Agaram <vc@akkartik.com>2020-01-01 17:04:37 -0800
commit2a4088119cf41175457414dfa59bd4064b8f0562 (patch)
tree64fe184e399f9870ebd481a90eec34d51e5dff68 /archive/2.transect/vimrc.vim
parent23fd294d85959c6b476bcdc35ed6ad508cc99b8f (diff)
downloadmu-2a4088119cf41175457414dfa59bd4064b8f0562.tar.gz
5852
Diffstat (limited to 'archive/2.transect/vimrc.vim')
-rw-r--r--archive/2.transect/vimrc.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/archive/2.transect/vimrc.vim b/archive/2.transect/vimrc.vim
new file mode 100644
index 00000000..d8b70fbc
--- /dev/null
+++ b/archive/2.transect/vimrc.vim
@@ -0,0 +1,36 @@
+" Highlighting literate directives in C++ sources.
+function! HighlightTangledFile()
+  " Tangled comments only make sense in the sources and are stripped out of
+  " the generated .cc file. They're highlighted same as regular comments.
+  syntax match tangledComment /\/\/:.*/ | highlight link tangledComment Comment
+  syntax match tangledSalientComment /\/\/::.*/ | highlight link tangledSalientComment SalientComment
+  set comments-=://
+  set comments-=n://
+  set comments+=n://:,n://
+
+  " Inside tangle scenarios.
+  syntax region tangleDirective start=+:(+ skip=+".*"+ end=+)+
+  highlight link tangleDirective Delimiter
+  syntax match traceContains /^+.*/
+  highlight traceContains ctermfg=darkgreen
+  syntax match traceAbsent /^-.*/
+  highlight traceAbsent ctermfg=darkred
+  syntax match tangleScenarioSetup /^\s*% .*/ | highlight link tangleScenarioSetup SpecialChar
+
+  " Our C++ files can have Mu code in scenarios, so highlight Mu comments like
+  " regular comments.
+  syntax match muComment /#.*$/
+  highlight link muComment Comment
+  syntax match muSalientComment /##.*$/ | highlight link muSalientComment SalientComment
+  syntax match muCommentedCode /#? .*$/ | highlight link muCommentedCode CommentedCode
+  set comments+=n:#
+endfunction
+augroup LocalVimrc
+  autocmd BufRead,BufNewFile *.cc call HighlightTangledFile()
+augroup END
+
+" Scenarios considered:
+"   opening or starting vim with a new or existing file without an extension (should interpret as C++)
+"   starting vim or opening a buffer without a file name (ok to do nothing)
+"   opening a second file in a new or existing window (shouldn't mess up existing highlighting)
+"   reloading an existing file (shouldn't mess up existing highlighting)
kartik.com> 2016-08-20 18:29:09 -0700 3231 - reading from fake files in scenarios' href='/akkartik/mu/commit/088file.mu?h=hlt&id=ebea4c3f4a3aed3bb0f6c16edd1d44eea965ca6b'>ebea4c3f ^
0606f4ac ^

294b2ab3 ^
ebea4c3f ^

0606f4ac ^

294b2ab3 ^
0606f4ac ^

b1f0fa4d ^

294b2ab3 ^
b1f0fa4d ^

294b2ab3 ^

d6ae0078 ^
294b2ab3 ^












7a84094a ^
0893d65e ^
7a84094a ^
ebea4c3f ^
80df524b ^
ebea4c3f ^
0893d65e ^
6641b247 ^
b1f0fa4d ^

ebea4c3f ^
760f683f ^
ea19d0dc ^
f03c9c05 ^
ebea4c3f ^

294b2ab3 ^
da925d06 ^

f03c9c05 ^
da925d06 ^


80df524b ^
10bbca64 ^
da925d06 ^


da925d06 ^
ff16e04f ^
a621ef95 ^

f03c9c05 ^
ebea4c3f ^

7a84094a ^

ebea4c3f ^
80df524b ^
ebea4c3f ^
08f4628e ^
ebea4c3f ^






294b2ab3 ^
a621ef95 ^

294b2ab3 ^
760f683f ^
2d3d88d9 ^
0606f4ac ^

294b2ab3 ^
f116818c ^
2d3d88d9 ^
0606f4ac ^

294b2ab3 ^
eb2b6cd2 ^




0606f4ac ^
a621ef95 ^

294b2ab3 ^






















760f683f ^
a621ef95 ^


80df524b ^
a621ef95 ^



ff16e04f ^
da925d06 ^
2d3d88d9 ^
294b2ab3 ^
2d3d88d9 ^

ef69c56c ^

2d3d88d9 ^
d6ae0078 ^
2d3d88d9 ^
80df524b ^
2d3d88d9 ^



ea19d0dc ^
0893d65e ^

ea19d0dc ^
0893d65e ^
2d3d88d9 ^
7a84094a ^

0230a6cc ^
80df524b ^
0230a6cc ^
0893d65e ^
0230a6cc ^
80df524b ^
d5c86dfd ^






0230a6cc ^

7a84094a ^
0893d65e ^

2d3d88d9 ^
7a84094a ^
2d3d88d9 ^
80df524b ^
2d3d88d9 ^
0893d65e ^
2d3d88d9 ^


0893d65e ^
d5c86dfd ^
ef69c56c ^
2d3d88d9 ^
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213