aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/lf.vim
blob: e4cf0148652f79ab0413137f2cdc95d5f93a21bf (plain) (blame)
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
" Vim syntax file
" Language: lf file manager configuration file (lfrc)
" Maintainer: Andis Sprinkis <andis@sprinkis.com>
" Former Maintainer: Cameron Wright
" Former URL: https://github.com/andis-sprinkis/lf-vim
" Last Change: 13 October 2024
"
" The shell syntax highlighting is configurable. See $VIMRUNTIME/doc/syntax.txt
" lf version: 32

if exists("b:current_syntax")
    finish
endif

let b:current_syntax = "lf"

"{{{ Comment Matching
syn match    lfComment        '#.*$'
"}}}

"{{{ String Matching
syn match    lfString         "'.*'"
syn match    lfString         '".*"' contains=lfVar,lfSpecial
"}}}

"{{{ Match lf Variables
syn match    lfVar            '\$f\|\$fx\|\$fs\|\$id'
"}}}

"{{{ Keywords
syn keyword  lfKeyword        set setlocal cmd map cmap skipwhite
"}}}

"{{{ Options Keywords
syn keyword  lfOptions
    \ quit
    \ up
    \ half-up
    \ page-up
    \ scroll-up
    \ down
    \ half-down
    \ page-down
    \ scroll-down
    \ updir
    \ open
    \ jump-next
    \ jump-prev
    \ top
    \ bottom
    \ high
    \ middle
    \ low
    \ toggle
    \ invert
    \ invert-below
    \ unselect
    \ glob-select
    \ glob-unselect
    \ calcdirsize
    \ clearmaps
    \ copy
    \ cut
    \ paste
    \ clear
    \ sync
    \ draw
    \ redraw
    \ load
    \ reload
    \ echo
    \ echomsg
    \ echoerr
    \ cd
    \ select
    \ delete
    \ rename
    \ source
    \ push
    \ read
    \ shell
    \ shell-pipe
    \ shell-wait
    \ shell-async
    \ find
    \ find-back
    \ find-next
    \ find-prev
    \ search
    \ search-back
    \ search-next
    \ search-prev
    \ filter
    \ setfilter
    \ mark-save
    \ mark-load
    \ mark-remove
    \ tag
    \ tag-toggle
    \ cmd-escape
    \ cmd-complete
    \ cmd-menu-complete
    \ cmd-menu-complete-back
    \ cmd-menu-accept
    \ cmd-enter
    \ cmd-interrupt
    \ cmd-history-next
    \ cmd-history-prev
    \ cmd-left
    \ cmd-right
    \ cmd-home
    \ cmd-end
    \ cmd-delete
    \ cmd-delete-back
    \ cmd-delete-home
    \ cmd-delete-end
    \ cmd-delete-unix-word
    \ cmd-yank
    \ cmd-transpose
    \ cmd-transpose-word
    \ cmd-word
    \ cmd-word-back
    \ cmd-delete-word
    \ cmd-delete-word-back
    \ cmd-capitalize-word
    \ cmd-uppercase-word
    \ cmd-lowercase-word
    \ anchorfind
    \ autoquit
    \ borderfmt
    \ cleaner
    \ copyfmt
    \ cursoractivefmt
    \ cursorparentfmt
    \ cursorpreviewfmt
    \ cutfmt
    \ dircache
    \ dircounts
    \ dirfirst
    \ dironly
    \ dirpreviews
    \ drawbox
    \ dupfilefmt
    \ errorfmt
    \ filesep
    \ findlen
    \ globfilter
    \ globsearch
    \ hidden
    \ hiddenfiles
    \ hidecursorinactive
    \ history
    \ icons
    \ ifs
    \ ignorecase
    \ ignoredia
    \ incfilter
    \ incsearch
    \ info
    \ infotimefmtnew
    \ infotimefmtold
    \ mouse
    \ number
    \ numberfmt
    \ period
    \ preserve
    \ preview
    \ previewer
    \ promptfmt
    \ ratios
    \ relativenumber
    \ reverse
    \ roundbox
    \ ruler
    \ rulerfmt
    \ scrolloff
    \ selectfmt
    \ selmode
    \ shell
    \ shellflag
    \ shellopts
    \ sixel
    \ smartcase
    \ smartdia
    \ sortby
    \ statfmt
    \ tabstop
    \ tagfmt
    \ tempmarks
    \ timefmt
    \ truncatechar
    \ truncatepct
    \ waitmsg
    \ wrapscan
    \ wrapscroll
    \ pre-cd
    \ on-cd
    \ on-select
    \ on-redraw
    \ on-quit
"}}}

"{{{ Special Matching
syn match    lfSpecial        '<.*>\|\\.'
"}}}

"{{{ Shell Script Matching for cmd
let s:shell_syntax = get(g:, 'lf_shell_syntax', "syntax/sh.vim")
let s:shell_syntax = get(b:, 'lf_shell_syntax', s:shell_syntax)
unlet b:current_syntax
exe 'syn include @Shell '.s:shell_syntax
let b:current_syntax = "lf"
syn region   lfIgnore         start=".{{\n" end="^}}"
    \ keepend contains=lfExternalShell,lfExternalPatch
syn match    lfShell          '\$[a-zA-Z].*$
    \\|:[a-zA-Z].*$
    \\|%[a-zA-Z].*$
    \\|![a-zA-Z].*$
    \\|&[a-zA-Z].*$'
    \ transparent contains=@Shell,lfExternalPatch
syn match    lfExternalShell  "^.*$" transparent contained contains=@Shell
syn match    lfExternalPatch  "^\s*cmd\ .*\ .{{$\|^}}$" contained
"}}}

"{{{ Link Highlighting
hi def link  lfComment        Comment
hi def link  lfVar            Type
hi def link  lfSpecial        Special
hi def link  lfString         String
hi def link  lfKeyword        Statement
hi def link  lfOptions        Constant
hi def link  lfConstant       Constant
hi def link  lfExternalShell  Normal
hi def link  lfExternalPatch  Special
hi def link  lfIgnore         Special
"}}}