|
| 1 | +" Vim syntax file |
| 2 | +" Language: lf file manager configuration file (lfrc) |
| 3 | +" Maintainer: Andis Sprinkis <andis@sprinkis.com> |
| 4 | +" Former Maintainer: Cameron Wright |
| 5 | +" Former URL: https://github.com/andis-sprinkis/lf-vim |
| 6 | +" Last Change: 13 October 2024 |
| 7 | +" |
| 8 | +" The shell syntax highlighting is configurable. See $VIMRUNTIME/doc/syntax.txt |
| 9 | +" lf version: 32 |
| 10 | + |
| 11 | +if exists("b:current_syntax") |
| 12 | + finish |
| 13 | +endif |
| 14 | + |
| 15 | +let b:current_syntax = "lf" |
| 16 | + |
| 17 | +"{{{ Comment Matching |
| 18 | +syn match lfComment '#.*$' |
| 19 | +"}}} |
| 20 | + |
| 21 | +"{{{ String Matching |
| 22 | +syn match lfString "'.*'" |
| 23 | +syn match lfString '".*"' contains=lfVar,lfSpecial |
| 24 | +"}}} |
| 25 | + |
| 26 | +"{{{ Match lf Variables |
| 27 | +syn match lfVar '\$f\|\$fx\|\$fs\|\$id' |
| 28 | +"}}} |
| 29 | + |
| 30 | +"{{{ Keywords |
| 31 | +syn keyword lfKeyword set setlocal cmd map cmap skipwhite |
| 32 | +"}}} |
| 33 | + |
| 34 | +"{{{ Options Keywords |
| 35 | +syn keyword lfOptions |
| 36 | + \ quit |
| 37 | + \ up |
| 38 | + \ half-up |
| 39 | + \ page-up |
| 40 | + \ scroll-up |
| 41 | + \ down |
| 42 | + \ half-down |
| 43 | + \ page-down |
| 44 | + \ scroll-down |
| 45 | + \ updir |
| 46 | + \ open |
| 47 | + \ jump-next |
| 48 | + \ jump-prev |
| 49 | + \ top |
| 50 | + \ bottom |
| 51 | + \ high |
| 52 | + \ middle |
| 53 | + \ low |
| 54 | + \ toggle |
| 55 | + \ invert |
| 56 | + \ invert-below |
| 57 | + \ unselect |
| 58 | + \ glob-select |
| 59 | + \ glob-unselect |
| 60 | + \ calcdirsize |
| 61 | + \ clearmaps |
| 62 | + \ copy |
| 63 | + \ cut |
| 64 | + \ paste |
| 65 | + \ clear |
| 66 | + \ sync |
| 67 | + \ draw |
| 68 | + \ redraw |
| 69 | + \ load |
| 70 | + \ reload |
| 71 | + \ echo |
| 72 | + \ echomsg |
| 73 | + \ echoerr |
| 74 | + \ cd |
| 75 | + \ select |
| 76 | + \ delete |
| 77 | + \ rename |
| 78 | + \ source |
| 79 | + \ push |
| 80 | + \ read |
| 81 | + \ shell |
| 82 | + \ shell-pipe |
| 83 | + \ shell-wait |
| 84 | + \ shell-async |
| 85 | + \ find |
| 86 | + \ find-back |
| 87 | + \ find-next |
| 88 | + \ find-prev |
| 89 | + \ search |
| 90 | + \ search-back |
| 91 | + \ search-next |
| 92 | + \ search-prev |
| 93 | + \ filter |
| 94 | + \ setfilter |
| 95 | + \ mark-save |
| 96 | + \ mark-load |
| 97 | + \ mark-remove |
| 98 | + \ tag |
| 99 | + \ tag-toggle |
| 100 | + \ cmd-escape |
| 101 | + \ cmd-complete |
| 102 | + \ cmd-menu-complete |
| 103 | + \ cmd-menu-complete-back |
| 104 | + \ cmd-menu-accept |
| 105 | + \ cmd-enter |
| 106 | + \ cmd-interrupt |
| 107 | + \ cmd-history-next |
| 108 | + \ cmd-history-prev |
| 109 | + \ cmd-left |
| 110 | + \ cmd-right |
| 111 | + \ cmd-home |
| 112 | + \ cmd-end |
| 113 | + \ cmd-delete |
| 114 | + \ cmd-delete-back |
| 115 | + \ cmd-delete-home |
| 116 | + \ cmd-delete-end |
| 117 | + \ cmd-delete-unix-word |
| 118 | + \ cmd-yank |
| 119 | + \ cmd-transpose |
| 120 | + \ cmd-transpose-word |
| 121 | + \ cmd-word |
| 122 | + \ cmd-word-back |
| 123 | + \ cmd-delete-word |
| 124 | + \ cmd-delete-word-back |
| 125 | + \ cmd-capitalize-word |
| 126 | + \ cmd-uppercase-word |
| 127 | + \ cmd-lowercase-word |
| 128 | + \ anchorfind |
| 129 | + \ autoquit |
| 130 | + \ borderfmt |
| 131 | + \ cleaner |
| 132 | + \ copyfmt |
| 133 | + \ cursoractivefmt |
| 134 | + \ cursorparentfmt |
| 135 | + \ cursorpreviewfmt |
| 136 | + \ cutfmt |
| 137 | + \ dircache |
| 138 | + \ dircounts |
| 139 | + \ dirfirst |
| 140 | + \ dironly |
| 141 | + \ dirpreviews |
| 142 | + \ drawbox |
| 143 | + \ dupfilefmt |
| 144 | + \ errorfmt |
| 145 | + \ filesep |
| 146 | + \ findlen |
| 147 | + \ globfilter |
| 148 | + \ globsearch |
| 149 | + \ hidden |
| 150 | + \ hiddenfiles |
| 151 | + \ hidecursorinactive |
| 152 | + \ history |
| 153 | + \ icons |
| 154 | + \ ifs |
| 155 | + \ ignorecase |
| 156 | + \ ignoredia |
| 157 | + \ incfilter |
| 158 | + \ incsearch |
| 159 | + \ info |
| 160 | + \ infotimefmtnew |
| 161 | + \ infotimefmtold |
| 162 | + \ mouse |
| 163 | + \ number |
| 164 | + \ numberfmt |
| 165 | + \ period |
| 166 | + \ preserve |
| 167 | + \ preview |
| 168 | + \ previewer |
| 169 | + \ promptfmt |
| 170 | + \ ratios |
| 171 | + \ relativenumber |
| 172 | + \ reverse |
| 173 | + \ roundbox |
| 174 | + \ ruler |
| 175 | + \ rulerfmt |
| 176 | + \ scrolloff |
| 177 | + \ selectfmt |
| 178 | + \ selmode |
| 179 | + \ shell |
| 180 | + \ shellflag |
| 181 | + \ shellopts |
| 182 | + \ sixel |
| 183 | + \ smartcase |
| 184 | + \ smartdia |
| 185 | + \ sortby |
| 186 | + \ statfmt |
| 187 | + \ tabstop |
| 188 | + \ tagfmt |
| 189 | + \ tempmarks |
| 190 | + \ timefmt |
| 191 | + \ truncatechar |
| 192 | + \ truncatepct |
| 193 | + \ waitmsg |
| 194 | + \ wrapscan |
| 195 | + \ wrapscroll |
| 196 | + \ pre-cd |
| 197 | + \ on-cd |
| 198 | + \ on-select |
| 199 | + \ on-redraw |
| 200 | + \ on-quit |
| 201 | +"}}} |
| 202 | + |
| 203 | +"{{{ Special Matching |
| 204 | +syn match lfSpecial '<.*>\|\\.' |
| 205 | +"}}} |
| 206 | + |
| 207 | +"{{{ Shell Script Matching for cmd |
| 208 | +let s:shell_syntax = get(g:, 'lf_shell_syntax', "syntax/sh.vim") |
| 209 | +let s:shell_syntax = get(b:, 'lf_shell_syntax', s:shell_syntax) |
| 210 | +unlet b:current_syntax |
| 211 | +exe 'syn include @Shell '.s:shell_syntax |
| 212 | +let b:current_syntax = "lf" |
| 213 | +syn region lfIgnore start=".{{\n" end="^}}" |
| 214 | + \ keepend contains=lfExternalShell,lfExternalPatch |
| 215 | +syn match lfShell '\$[a-zA-Z].*$ |
| 216 | + \\|:[a-zA-Z].*$ |
| 217 | + \\|%[a-zA-Z].*$ |
| 218 | + \\|![a-zA-Z].*$ |
| 219 | + \\|&[a-zA-Z].*$' |
| 220 | + \ transparent contains=@Shell,lfExternalPatch |
| 221 | +syn match lfExternalShell "^.*$" transparent contained contains=@Shell |
| 222 | +syn match lfExternalPatch "^\s*cmd\ .*\ .{{$\|^}}$" contained |
| 223 | +"}}} |
| 224 | + |
| 225 | +"{{{ Link Highlighting |
| 226 | +hi def link lfComment Comment |
| 227 | +hi def link lfVar Type |
| 228 | +hi def link lfSpecial Special |
| 229 | +hi def link lfString String |
| 230 | +hi def link lfKeyword Statement |
| 231 | +hi def link lfOptions Constant |
| 232 | +hi def link lfConstant Constant |
| 233 | +hi def link lfExternalShell Normal |
| 234 | +hi def link lfExternalPatch Special |
| 235 | +hi def link lfIgnore Special |
| 236 | +"}}} |
0 commit comments