├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Shell-Unix-Generic.sublime-syntax ├── color_schemes ├── dark.sublime-color-scheme └── dark.tmTheme ├── menus └── Main.sublime-menu ├── messages.json ├── messages └── update_message.md ├── miscellaneous └── demo.sh └── syntax_test_shellscript.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | __pycache__ 3 | 4 | *.patch 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # ShellScript Improved 2 | 3 | 4 | ## 1.2.26 5 | 6 | - Add some executables. 7 | 8 | 9 | ## 1.2.25 10 | 11 | - Add highlight for string in array section. 12 | 13 | ```bash 14 | declare -A arr=( 15 | ["no msg"]='' 16 | ^^^^^^^^ string.quoted.double 17 | ) 18 | ``` 19 | 20 | 21 | ## 1.2.24 22 | 23 | - Add `dark.sublime-color-scheme` for ST >= 3149. 24 | - Add executables: `nproc`. 25 | - Update `dark.tmTheme` and `demo.sh`. 26 | 27 | 28 | ## 1.2.23 29 | 30 | - Add executables: `readlink`. 31 | - Highlight the executable which is privileged. 32 | 33 | ```bash 34 | sudo -s pip --upgrade install numpy 35 | #^^^ support.function.privilege.shell 36 | # ^^ support.command-switch.shell 37 | # ^^^ support.function.external.shell 38 | # ^^^^^^^^^ support.command-switch.shell 39 | ``` 40 | 41 | 42 | ## 1.2.22 43 | 44 | - Fix associative arrays with dashes in keys. 45 | 46 | ```bash 47 | foo[hello-world]="Hi" 48 | #^^^^^^^^^^^^^^^ meta.variable.assigned.shell 49 | # ^ keyword.operator.assign.shell 50 | ``` 51 | 52 | 53 | ## 1.2.21 54 | 55 | - Things inside `<<<"..."` are interpolate-able. 56 | - Fix some coloring issues with nested scopes. 57 | 58 | 59 | ## 1.2.20 60 | 61 | - (Dirty) Fix highlight for $(( ... ) ... > ... ) 62 | 63 | ```bash 64 | empty=$((echo hello) > output.txt) 65 | # ^^^^ support.function.builtin.shell 66 | # ^ keyword.operator.redirect.shell 67 | 68 | user="$((who -m) 2>&1)" 69 | # ^^^ support.function.external.shell 70 | # ^^ keyword.operator.redirect.shell 71 | ``` 72 | 73 | 74 | ## 1.2.19 75 | 76 | - Parameters after `--` are not switches. 77 | 78 | ```bash 79 | rm -f -- -filename_starts_with_dash 80 | # ^ punctuation.definition.command-switch.shell 81 | # ^^ support.command-switch.shell 82 | # ^^ punctuation.definition.command-switch-end.shell 83 | # ^ - punctuation.definition.command-switch.shell 84 | ``` 85 | 86 | 87 | ## 1.2.18 88 | 89 | - Add executbles: `bower`, `browserify`, `compass`, `dvips`, `grunt`, `gulp`, `latex`, `mkdocs`, `pdflatex`, `pdftex`, `pdftops`, `pelican`, `webpack`, `yarn` 90 | - Allow using any identifier for starting a simple heredoc. 91 | 92 | ```bash 93 | cat <<_ACEOF; 94 | # ^^ keyword.operator.heredoc.shell 95 | # ^^^^^^ keyword.control.heredoc-token.shell 96 | $variable 97 | # <- string.unquoted.heredoc.shell 98 | # ^ punctuation.definition.variable.shell 99 | _ACEOF 100 | # <- keyword.control.heredoc-token.shell 101 | ``` 102 | 103 | 104 | ## 1.2.17 105 | 106 | - Update the dark theme. 107 | - Fix parsing file descriptor at the end of backticks. 108 | 109 | ```bash 110 | `command -v autoconf >/dev/null 2>&1` 111 | # ^ constant.numeric.file-descriptor.shell 112 | # ^^ keyword.operator.redirect.shell 113 | # ^ constant.numeric.file-descriptor.shell 114 | ``` 115 | 116 | 117 | ## 1.2.16 118 | 119 | - Add highlight for an executable: `sendmail`. 120 | - Add a menu to `Preferences > Package Settings > ShellScript Improved`. 121 | 122 | 123 | ## 1.2.15 124 | 125 | - Fix Bash colored as string in a when using indirect reference and array default values. 126 | 127 | ```bash 128 | TEMP_VAR=(${!default+"${!default}"}) 129 | # ^ - string.quoted.double.shell 130 | # bug fix " 131 | ``` 132 | 133 | 134 | ## 1.2.14 135 | 136 | - Add support for command-line options with `+` prefix. 137 | - Add highlight for some executables. 138 | 139 | ```bash 140 | dig example.com +short +time=3 141 | # ^ punctuation.definition.command-switch.shell 142 | # ^^^^^^ support.command-switch.shell 143 | # ^ punctuation.definition.command-switch.shell 144 | # ^^^^^ support.command-switch.shell 145 | # ^ keyword.operator.assign.shell 146 | ``` 147 | 148 | 149 | ## 1.2.13 150 | 151 | - Better parsing parameter expansion flags for zsh. 152 | 153 | ```bash 154 | ${(ps.ps$sep.)val} 155 | # ^ punctuation.definition.flag.begin.shell 156 | # ^^ keyword.operator.expansion.flag.shell 157 | # ^ punctuation.definition.delimiter.begin.shell 158 | # ^^ - keyword.operator.expansion.flag.shell 159 | # ^^^^ variable.other.normal.shell 160 | # ^ punctuation.definition.delimiter.end.shell 161 | # ^ punctuation.definition.flag.end.shell 162 | 163 | ${(ps(ps$sep))val} 164 | # ^ punctuation.definition.flag.begin.shell 165 | # ^^ keyword.operator.expansion.flag.shell 166 | # ^ punctuation.definition.delimiter.begin.shell 167 | # ^^ - keyword.operator.expansion.flag.shell 168 | # ^^^^ variable.other.normal.shell 169 | # ^ punctuation.definition.delimiter.end.shell 170 | # ^ punctuation.definition.flag.end.shell 171 | 172 | ${(ps{ps$sep})val} 173 | # ^ punctuation.definition.flag.begin.shell 174 | # ^^ keyword.operator.expansion.flag.shell 175 | # ^ punctuation.definition.delimiter.begin.shell 176 | # ^^ - keyword.operator.expansion.flag.shell 177 | # ^^^^ variable.other.normal.shell 178 | # ^ punctuation.definition.delimiter.end.shell 179 | # ^ punctuation.definition.flag.end.shell 180 | ``` 181 | 182 | 183 | ## 1.2.12 184 | 185 | - Update the dark theme. 186 | - Fix highlihght for positional parameter expansion. 187 | 188 | ```bash 189 | ${1##*abc} 190 | # <- punctuation.definition.variable.shell 191 | # ^ variable.other.positional.shell 192 | # ^^ keyword.operator.substringremoval.shell 193 | # ^ punctuation.definition.variable.shell 194 | ``` 195 | 196 | - Add support for zsh parameter expansion flags. 197 | 198 | ```bash 199 | ${(L)foo} # Lower-case foo, equivalent to ${foo,,} in bash 200 | # ^ punctuation.definition.flag.begin.shell 201 | # ^ keyword.operator.expansion.flag.shell 202 | # ^ punctuation.definition.flag.end.shell 203 | 204 | ${(@)foo} # Separate elements of foo, equivalent to ${foo[@]} 205 | # ^ punctuation.definition.flag.begin.shell 206 | # ^ keyword.operator.expansion.flag.shell 207 | # ^ punctuation.definition.flag.end.shell 208 | 209 | ${(uU)foo[@]} # Filter foo for unique elements and upper-case each one 210 | # ^ punctuation.definition.flag.begin.shell 211 | # ^^ keyword.operator.expansion.flag.shell 212 | # ^ punctuation.definition.flag.end.shell 213 | 214 | ${(%)foo} # Apply prompt expansion to foo 215 | # ^ punctuation.definition.flag.begin.shell 216 | # ^ keyword.operator.expansion.flag.shell 217 | # ^ punctuation.definition.flag.end.shell 218 | 219 | ${(ps.ps$sep.)val} 220 | # ^ punctuation.definition.flag.begin.shell 221 | # ^^ keyword.operator.expansion.flag.shell 222 | # ^^ - keyword.operator.expansion.flag.shell 223 | # ^^^^ variable.other.normal.shell 224 | # ^ punctuation.definition.flag.end.shell 225 | ``` 226 | 227 | 228 | ## 1.2.11 229 | 230 | - Update the dark theme. 231 | - Add a scope (`meta.variable.assigned.shell`) for variables on assignment. 232 | - Fix 2nd and later variables in a pathname is not highlighted. 233 | 234 | ```bash 235 | ${foo}/${bar}/${exe} 236 | # ^^^ variable.other.bracket.shell 237 | # ^^^ variable.other.bracket.shell 238 | # ^^^ variable.other.bracket.shell 239 | ``` 240 | 241 | 242 | ## 1.2.10 243 | 244 | - Fix variables are not highlighted in bash array. 245 | 246 | ```bash 247 | OPTS+=(--prefix=$PREFIX) 248 | # ^ punctuation.definition.array.begin.shell 249 | # ^ punctuation.definition.variable.shell 250 | # ^^^^^^^ variable.other.normal.shell 251 | # ^ punctuation.definition.array.end.shell 252 | ``` 253 | 254 | - Fix string scope isn't starting properly in multiline array definition. 255 | 256 | ```bash 257 | declare -A ERROR_MESSAGES=( 258 | # ^ punctuation.definition.array.begin.shell 259 | [no msg]='' 260 | # ^ punctuation.section.array.shell 261 | # ^ punctuation.section.array.shell 262 | # ^ keyword.operator.assign.shell 263 | [unknown]='Unknown error happened.' 264 | # ^ punctuation.section.array.shell 265 | # ^ punctuation.section.array.shell 266 | # ^ keyword.operator.assign.shell 267 | [no util]="‘$util’ is required but wasn’t found on this system." 268 | # ^ punctuation.section.array.shell 269 | # ^ punctuation.section.array.shell 270 | # ^ keyword.operator.assign.shell 271 | # ^ punctuation.definition.variable.shell 272 | # ^^^^^ variable.other.normal.shell 273 | ) 274 | # <- punctuation.definition.array.end.shell 275 | ``` 276 | 277 | 278 | ## 1.2.9 279 | 280 | - Fix next pattern in the case statement isn't matched as case-pattern if previous clause ended with `;&`. 281 | 282 | ```bash 283 | case "${foo}" in 284 | ( help | h ) bar ;; 285 | # ^^ punctuation.terminator.case-clause.shell 286 | do1 ) foo1 ;& 287 | # ^^ punctuation.terminator.case-clause.shell 288 | do2 ) foo2 ;;& 289 | # ^^^ punctuation.terminator.case-clause.shell 290 | *) bar 291 | esac 292 | ``` 293 | 294 | - Fix equal sign (`=`) breaks backticks' subshell interpolation scope. 295 | 296 | ```bash 297 | ` findfs UUID=00000000 ` 298 | # ^ -string.interpolated.backtick.shell 299 | ``` 300 | 301 | - Fix variable scope which ends on first underscore in expansions 302 | 303 | ```bash 304 | $_ 305 | #^ variable.other.special.shell 306 | 307 | $__ 308 | #^^ variable.other.normal.shell 309 | 310 | $var_0 311 | #^^^^^ variable.other.normal.shell 312 | 313 | $_var0 314 | #^^^^^ variable.other.normal.shell 315 | 316 | $_0var_ 317 | #^^^^^^ variable.other.normal.shell 318 | ``` 319 | 320 | 321 | ## 1.2.8 322 | 323 | - Fix multi-line herestring is wrongly highlighted. 324 | 325 | ```bash 326 | cat <<<' 327 | line 1 328 | line 2 329 | ' 330 | # <- string.quoted.single.herestring.shell punctuation.definition.string.end.shell 331 | 332 | cat <<<" 333 | line 1 334 | line 2\"test 335 | line 3 336 | " 337 | # <- string.quoted.double.herestring.shell punctuation.definition.string.end.shell 338 | ``` 339 | 340 | 341 | ## 1.2.7 342 | 343 | - Fix variable interpretation in Regex in `[[ ... =~ ... ]]`. 344 | 345 | ```bash 346 | [[ "$str" =~ ^abc$repl$ ]] 347 | ^^^^^ variable.other.normal.shell 348 | 349 | [[ $str =~ ^$'\t' ]] 350 | # ^^^^^^ source.regexp 351 | ``` 352 | 353 | - Fix string scope on array element assignment. 354 | 355 | ```bash 356 | foo[jjj]="`<$file`" 357 | # ^ keyword.operator.assign.shell 358 | # ^ punctuation.definition.string.begin.shell 359 | # ^ punctuation.definition.string.end.shell 360 | ``` 361 | 362 | 363 | ## 1.2.6 364 | 365 | - Fix leading escaped char in Regex in `[[ ... =~ ... ]]`. 366 | 367 | ```bash 368 | [[ $str =~ \ ?[a-z]\ ]] 369 | # ^^ keyword.operator.logical.shell 370 | # ^^^^^^^^^^ source.regexp 371 | ``` 372 | 373 | 374 | ## 1.2.5 375 | 376 | - Add a scope for `+=` as `keyword.operator.append.shell`. 377 | 378 | ```bash 379 | foo+=" baz" 380 | # ^^ keyword.operator.append.shell 381 | ``` 382 | 383 | 384 | ## 1.2.4 385 | 386 | - Add an executables: `sudoedit`. 387 | - Privilege executables now have an exclusive scope: `support.function.privilege.shell` 388 | 389 | ```bash 390 | sudo ls -alHf / 391 | # <- support.function.privilege.shell 392 | ``` 393 | 394 | - Fix the scope for file descriptor in a interpolation. 395 | 396 | ```bash 397 | $(curl -I "https://google.com" 2> /dev/null) 398 | # ^ constant.numeric.file-descriptor.shell 399 | ``` 400 | 401 | - Fix subshell can be used in `$((...))`. 402 | 403 | ```bash 404 | plus=$(( $(echo "$errorCode") )) 405 | # ^ support.function.builtin.shell 406 | ``` 407 | 408 | 409 | ## 1.2.3 410 | 411 | - Add executables: `ldconfig` and `ssh-keygen`. 412 | - Fix highlighting within `[...]`. 413 | 414 | ```bash 415 | [ ! -f foo.$foo ] 416 | # <- punctuation.definition.logical-expression.shell 417 | # ^ keyword.operator.logical.shell 418 | # ^^ keyword.operator.logical.shell 419 | # ^ punctuation.definition.variable.shell 420 | # ^^^^ variable.other.normal.shell 421 | # ^ punctuation.definition.logical-expression.shell 422 | 423 | [ ! -f foo.$foo -a $foo -le 500 ] 424 | # <- punctuation.definition.logical-expression.shell 425 | # ^ keyword.operator.logical.shell 426 | # ^^ keyword.operator.logical.shell 427 | # ^ punctuation.definition.variable.shell 428 | # ^^^^ variable.other.normal.shell 429 | # ^^ keyword.operator.logical.shell 430 | # ^ punctuation.definition.variable.shell 431 | # ^^^^ variable.other.normal.shell 432 | # ^^ keyword.operator.logical.shell 433 | # ^ punctuation.definition.logical-expression.shell 434 | ``` 435 | 436 | - Fix the scope for command switches at the beginning of a new line. 437 | 438 | ```bash 439 | echo \ 440 | -e Hello 441 | # <- punctuation.definition.command-switch.shell 442 | #^ support.command-switch.shell 443 | ``` 444 | 445 | 446 | ## 1.2.2 447 | 448 | - Fix some typos in the syntax test file. 449 | - Fix keywords in case patterns are wrongly highlighted. 450 | 451 | ```bash 452 | case "${foo}" in 453 | do ) foo ;; 454 | # ^^ - keyword.control.shell 455 | *) bar 456 | esac 457 | ``` 458 | 459 | - Fix the scope for `:` which is next to `;`. 460 | 461 | ```bash 462 | while :; do 463 | # ^ support.function.builtin.shell 464 | break 465 | done 466 | ``` 467 | 468 | - Fix the scope for non-closed `;;` in the last case block. 469 | 470 | ```bash 471 | case "${foo}" in 472 | *) bar 473 | esac 474 | 475 | # <- - meta.scope.case-block.shell 476 | ``` 477 | 478 | 479 | ## 1.2.1 480 | 481 | - Fix a regression introduced when introducing `=true/false` highlighting. 482 | 483 | ```bash 484 | cd=cat 485 | # <- - support.function 486 | # ^^^ - support.function 487 | ``` 488 | 489 | - Fix scope for `;then`. 490 | 491 | ```bash 492 | if [ true ];then 493 | # ^^^^ meta.scope.if-block.shell keyword.control.shell 494 | echo "HELLO" 495 | fi 496 | ``` 497 | 498 | 499 | ## 1.2.0 500 | 501 | - Compatible with the new Regex engine in Sublime Text 3. 502 | That is, use no backref and no lookbehind. 503 | 504 | 505 | ## 1.1.6 506 | 507 | - Fix scopes about function definition. 508 | 509 | ```bash 510 | function x() { 511 | # ^^ punctuation.definition.arguments.shell 512 | echo "Hello" 513 | } 514 | ``` 515 | 516 | - Fix some issues within a backtick interpolation. 517 | 518 | ```bash 519 | if [[ ! "`git status 2> /dev/null`" ]]; then 520 | # Sublime bug fix: ` 521 | return 522 | # <- - string.quoted.double.shell 523 | fi 524 | ``` 525 | 526 | 527 | ## 1.1.5 528 | 529 | - Add executables: `gksu` and `gksudo`. 530 | - Drop support for `csh` and `tcsh`. 531 | Because the current support is not good and there is a 532 | [plugin](https://packagecontrol.io/packages/Tcsh%20and%20Csh%20Mode) 533 | just for that. 534 | 535 | 536 | ## 1.1.4 537 | 538 | - Update syntax test file. 539 | - Fix the scope of `true` in `var=true;` and so does `false`. 540 | - Fix a wrong parsing path issue in a nested `$(...)` interpolation. 541 | 542 | ```bash 543 | # The scope is correct just because of luck hence this fix. 544 | # There cannot be nested backtick interpolation but $(...) can be. 545 | $( foo $( bar $( baz ) ) ) 546 | # ^^ punctuation.definition.string.begin.shell 547 | ``` 548 | 549 | 550 | ## 1.1.3 551 | 552 | - Update syntax test file. 553 | - There must be a space after a `[` and before a `]` command. 554 | - Highlight the `-` in `-eq` and etc... 555 | - Add highlight for regex in `[[ ... =~ REGEX ]]`. 556 | 557 | ```bash 558 | [[ $str =~ ^(bar|baz)[abc0-9]{1,2}$ ]] 559 | # ^^^^^^^^^^^^^^^^^^^^^^^^ this is a regex 560 | ``` 561 | 562 | - Fix some highlighting involving `[[` or `]]`. 563 | 564 | ```bash 565 | # this command actually prints: [[ != bar ]] 566 | # so '[[', '!=' and ']]' should be plain text 567 | echo [[ "${foo}" != 'bar' ]] 568 | 569 | echo ]] echo 570 | # ^^^^ this 'echo' is plain text 571 | ``` 572 | 573 | 574 | ## 1.1.2 575 | 576 | - Update readme about color scheme. 577 | - Add a selectable dark color scheme. 578 | (If you are lazy customizing your own, you may use mine directly.) 579 | 580 | 581 | ## 1.1.1 582 | 583 | - Update syntax test file. 584 | - Add highlight for `true` and `false` in command switches. 585 | 586 | ```bash 587 | executable --switch=true 588 | ``` 589 | 590 | 591 | ## 1.1.0 592 | 593 | - Update readme. 594 | You may want to add some new scopes to your color scheme. 595 | They are `variable.other.true.shell` and `variable.other.false.shell`. 596 | - Rename `syntax_test_shellscript_human_eyes.sh` to `demo.sh`. 597 | - Add executables: `pkg-config` and `pkgdata`. 598 | - Add a syntax test file to prevent from regressions. 599 | - Fix a regression. (#7) 600 | - Fix a regression which is caused by removing backslash for escaping `-`. 601 | - Add scopes for `true` and `false` in assignment. (#7) 602 | 603 | ```bash 604 | var=true 605 | var=false 606 | ``` 607 | 608 | 609 | ## 1.0.21 610 | 611 | - Fix error loading syntax file for ST 3103. (#6) 612 | 613 | ``` 614 | Error loading syntax file "Packages/ShellScriptImproved/Shell-Unix-Generic.sublime-syntax": Error in regex: empty range in char class in regex \+{1,2}|-{1,2}|!|~|\*{1,2}|/|%|([=!*/%+-&^|]|<>?)?=|^|\|{1,2}|&{1,2}|[?:,<>] 615 | ``` 616 | 617 | 618 | ## 1.0.20 619 | 620 | - Fix a wrong ending scope caused by redirection in backticks. 621 | 622 | ```bash 623 | `echo "Hello" > output.txt` 624 | # the scope after this line should be "source.shell" 625 | ``` 626 | 627 | - Fix a wrong ending scope caused by `fi` in a function. 628 | 629 | ```bash 630 | msg () { if [ true ]; then echo "Hello"; fi; } 631 | # scope after this line should be "source.shell" 632 | ``` 633 | 634 | 635 | ## 1.0.19 636 | 637 | - Fix scopes for `}` and `fi`. 638 | 639 | ```bash 640 | print_info_text () { cat < cat 711 | # ^^^ this "cat" is not a external executable 712 | ``` 713 | 714 | 715 | ## 1.0.14 716 | 717 | - Update readme. 718 | You may want to add some new scopes to your color scheme. 719 | They are `variable.other.c-style.shell`, 720 | `punctuation.separator.pipe-sign.shell`, 721 | `punctuation.definition.case-pattern.shell` and 722 | `punctuation.terminator.case-clause.shell`. 723 | - Fix `/` in a path is wrongly scoped/highlighted in (...). 724 | 725 | ```bash 726 | if ( command > /dev/null 2>&1 ); then 727 | # ^ ^ they are not division 728 | echo Condition True 729 | fi 730 | ``` 731 | 732 | - Highlight variables without `$` in $((...)) and ((...)). 733 | 734 | ```bash 735 | $(( ( RANDOM * 100 ) / 5 )) 736 | # ^^^^^^ this is a variable 737 | ``` 738 | 739 | - Parenthesis in $((...)) is now no color along with parenthesis balancing. 740 | 741 | ```bash 742 | a=$(( (2*(250+1))/5 )) 743 | # ^ ^ ^^ these parenthesis are no color 744 | ``` 745 | 746 | - File descriptors in redirection are now highlighted like a number. 747 | 748 | ```bash 749 | echo Text 1>&2 750 | echo Text 1> filename 751 | # ^ ^ file descriptors are highlighted like a number. 752 | # scope: constant.numeric.file-descriptor.shell 753 | ``` 754 | 755 | - Fix the space before a comment is treated as if it is in comment. 756 | 757 | ```bash 758 | echo Text # this line will print "Text" 759 | # ^ this space is not a part of comment 760 | ``` 761 | 762 | - Add executables: `info`. 763 | 764 | 765 | ## 1.0.13 766 | 767 | - Revert "Fix highlighting for the heredoc ending token." 768 | (A space padding raises a warning but not an error.) 769 | - Fix heredoc in a non-compact command which does not start in a newline. 770 | (An regression which is introduced in 1.0.12.) 771 | 772 | ```bash 773 | fun () { cat <= 3143. 5 | 6 | 7 | Important Note 8 | ============== 9 | 10 | The official `ShellScript (Bash)` syntax has been rewritten. 11 | All following comparisons are with the one **BEFORE** rewritten. 12 | 13 | I deprecated this plugin because the new official Bash highlighting is 14 | much better than the former one (and better than this plugin). 15 | Thus, this plugin is no longer needed I guess. 16 | 17 | 18 | Pros 19 | ---- 20 | 21 | - It fixes quite lots of bugs which exist in the official `ShellScript (Bash)` syntax. 22 | - It parses things more grammatically while the official one is just like a keyword highlighter. 23 | 24 | 25 | Cons 26 | ---- 27 | 28 | - It is designed for Bash only while the official one is designed for general shell scripts. 29 | - You may have to add customized scopes to your color scheme if you do not want to use the bundled one. 30 | - Its source code is as messy as the official one's but this does not matter if you are not a maintainer. 31 | 32 | 33 | Screenshots 34 | =========== 35 | 36 | Left / Right = Official ShellScript (Bash) / ShellScript Improved 37 | ![screenshot](https://raw.githubusercontent.com/jfcherng/Sublime-ShellScriptImproved/gh-pages/images/screenshot/screenshot.png) 38 | 39 | 40 | Color scheme 41 | ============ 42 | 43 | There are quite a lot of scopes that may be missing in the color scheme you are using. 44 | If you want to add them by yourself, see the `Customization from Your Color Scheme` section. 45 | Or, you can set the syntax specific settings to use the color scheme which is shipped with this package. 46 | 47 | To do that, 48 | 49 | 1. Open a file with `ShellScript Improved` syntax. 50 | 1. Go to `Preferences` » `Settings - More` » `Syntax Specific - User` 51 | 1. Add the `color_scheme` item into the settings file and then save. 52 | 53 | ```javascript 54 | { 55 | // use a bundled .tmTheme file while writing shell scripts 56 | "color_scheme": "Packages/ShellScriptImproved/color_schemes/dark.tmTheme", 57 | // or, if you are using Sublime Text >= 3149, using a .sublime-color-scheme file is recommended 58 | "color_scheme": "Packages/ShellScriptImproved/color_schemes/dark.sublime-color-scheme", 59 | } 60 | ``` 61 | 62 | > That color scheme is the exact one I use in my Sublime Text so there is only a dark one. 63 | > You would get the same highlighting as shown in the screenshot. 64 | 65 | 66 | Customization from Your Color Scheme 67 | ==================================== 68 | 69 | Note that an extra rule is added to my `.tmTheme` in above screenshots in order to set text to its default color, i.e., white on dark theme and black on light theme mostly. (I just can not find other way to set text to the default text color...) This resets the color of `TEXT` in `$(echo TEXT)` and other things like that. 70 | 71 | ```xml 72 | 73 | 74 | name 75 | Embedded 76 | scope 77 | meta.embedded 78 | settings 79 | 80 | foreground 81 | #FFFFFF 82 | 83 | 84 | 85 | 86 | name 87 | Reset Color 88 | scope 89 | meta.reset.color 90 | settings 91 | 92 | foreground 93 | #FFFFFF 94 | 95 | 96 | ``` 97 | 98 | Also, those scopes may be missing in your theme. You may add/adjust them to get a better color highlighting. 99 | 100 | ```xml 101 | 102 | name 103 | Shell - variable 104 | scope 105 | variable.other.normal.shell, variable.other.positional.shell, variable.other.bracket.shell, variable.other.special.shell, variable.other.loop.shell, variable.other.c-style.shell,variable.other.positional.shell 106 | settings 107 | 108 | fontStyle 109 | bold 110 | foreground 111 | #AE81FF 112 | 113 | 114 | 115 | name 116 | Shell - bracket variable in meta.reset.color 117 | scope 118 | meta.reset.color variable.other.bracket.shell, meta.reset.color variable.other.bracket.shell variable.other.bracket.shell, meta.reset.color variable.other.bracket.shell variable.other.bracket.shell variable.other.bracket.shell 119 | settings 120 | 121 | fontStyle 122 | bold 123 | foreground 124 | #AE81FF 125 | 126 | 127 | 128 | name 129 | Shell - true 130 | scope 131 | variable.other.true.shell 132 | settings 133 | 134 | foreground 135 | #AAFFFF 136 | 137 | 138 | 139 | name 140 | Shell - false 141 | scope 142 | variable.other.false.shell 143 | settings 144 | 145 | foreground 146 | #FFAAFF 147 | 148 | 149 | 150 | name 151 | Shell - built-in command 152 | scope 153 | support.function.builtin.shell 154 | settings 155 | 156 | fontStyle 157 | bold 158 | foreground 159 | #50AAFF 160 | 161 | 162 | 163 | name 164 | Shell - privilege command 165 | scope 166 | support.function.privilege.shell 167 | settings 168 | 169 | fontStyle 170 | bold 171 | foreground 172 | #FF0000 173 | 174 | 175 | 176 | name 177 | Shell - external command 178 | scope 179 | support.function.external.shell 180 | settings 181 | 182 | fontStyle 183 | bold 184 | foreground 185 | #0684F4 186 | 187 | 188 | 189 | name 190 | Shell - punctuation variable 191 | scope 192 | punctuation.definition.variable.shell 193 | settings 194 | 195 | fontStyle 196 | bold 197 | foreground 198 | #AE81FF 199 | 200 | 201 | 202 | name 203 | Shell - punctuation definition 204 | scope 205 | punctuation.definition.string 206 | settings 207 | 208 | fontStyle 209 | bold 210 | foreground 211 | #E6DB74 212 | 213 | 214 | 215 | name 216 | Shell - pipe-sign/parentheses in `case` 217 | scope 218 | punctuation.separator.pipe-sign.shell, punctuation.definition.case-pattern.shell 219 | settings 220 | 221 | fontStyle 222 | bold 223 | foreground 224 | #F92672 225 | 226 | 227 | 228 | name 229 | Shell - `;;` in `case` 230 | scope 231 | punctuation.terminator.case-clause.shell 232 | settings 233 | 234 | fontStyle 235 | bold 236 | foreground 237 | #F92672 238 | 239 | 240 | 241 | name 242 | Shell - command switch 243 | scope 244 | support.command-switch.shell 245 | settings 246 | 247 | fontStyle 248 | bold italic 249 | 250 | 251 | ``` 252 | 253 | 254 | See Also 255 | ======== 256 | 257 | - [Tcsh and Csh Mode](https://packagecontrol.io/packages/Tcsh%20and%20Csh%20Mode) 258 | - [SublimeLinter-shellcheck](https://packagecontrol.io/packages/SublimeLinter-shellcheck) 259 | 260 | 261 | Supporters 262 | ========== 263 | 264 | Thank you guys for sending me some cups of coffee. 265 | 266 | - [deterenkelt](https://github.com/deterenkelt) 267 | -------------------------------------------------------------------------------- /Shell-Unix-Generic.sublime-syntax: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | # http://www.sublimetext.com/docs/3/syntax.html 4 | name: ShellScript Improved 5 | file_extensions: 6 | - bash 7 | - sh 8 | - zsh 9 | - .bash_aliases 10 | - .bash_functions 11 | - .bash_login 12 | - .bash_logout 13 | - .bash_profile 14 | - .bash_variables 15 | - .bashrc 16 | - .profile 17 | - .textmate_init 18 | - .zshrc 19 | first_line_match: ^#!.*\b(bash|zsh|sh)\b|^#\s*-\*-[^*]*mode:\s*shell-script[^*]*-\*- 20 | scope: source.shell 21 | variables: 22 | identifier: (?:[a-zA-Z_][0-9a-zA-Z_]*) 23 | 24 | version_string: (?:[0-9_.+\-][0-9a-zA-Z_.+\-]*) 25 | 26 | variable_name: |- 27 | (?x: 28 | (?: {{identifier}} ) 29 | (?: \[ (?: [${}\[\]0-9a-zA-Z_\-'"]+ ) \] )? 30 | ) 31 | 32 | cmd_unknown: (?:(?:[^/\\\s><&;|!()`]|\\.)+) 33 | 34 | cmd_privilege: |- 35 | (?x: 36 | gksudo | 37 | gksu | 38 | sudoedit | 39 | sudo | 40 | su 41 | ) 42 | 43 | cmd_external: |- 44 | (?x: 45 | ( 46 | apt | 47 | dbus | 48 | git | 49 | glib | 50 | gnutls | 51 | gpg | 52 | grub | 53 | ssh | 54 | yum 55 | )(?:-[a-zA-Z_]+)* 56 | 57 | | 58 | 59 | ( 60 | fc | 61 | php | 62 | system-config 63 | )-(?:[a-zA-Z_]+)* 64 | 65 | | 66 | 67 | 7z | 68 | 7za | 69 | apropos | 70 | aptitude | 71 | ar | 72 | aria2c | 73 | aspell | 74 | autoconf | 75 | automake | 76 | awk | 77 | base64 | 78 | basename | 79 | bash | 80 | bc | 81 | bower | 82 | brew | 83 | browserify | 84 | bzip2 | 85 | cal | 86 | cargo | 87 | cat | 88 | cc | 89 | cfdisk | 90 | chfn | 91 | chgrp | 92 | chkconfig | 93 | chmod | 94 | chown | 95 | chpasswd | 96 | chroot | 97 | chsh | 98 | cksum | 99 | clang | 100 | clang\+\+\ | 101 | clear | 102 | cmake | 103 | cmp | 104 | column | 105 | comm | 106 | compass | 107 | composer | 108 | cp | 109 | cron | 110 | crontab | 111 | csh | 112 | csplit | 113 | curl | 114 | cut | 115 | date | 116 | dc | 117 | dd | 118 | ddrescue | 119 | deb | 120 | depmod | 121 | df | 122 | diff | 123 | dig | 124 | dir | 125 | dircolors | 126 | dirname | 127 | dmesg | 128 | dpkg | 129 | du | 130 | dvips | 131 | easy_install | 132 | egrep | 133 | eject | 134 | emacs | 135 | env | 136 | expand | 137 | expect | 138 | expr | 139 | fdformat | 140 | fdisk | 141 | fgrep | 142 | file | 143 | find | 144 | finger | 145 | fmt | 146 | fold | 147 | format | 148 | free | 149 | fsck | 150 | ftp | 151 | function | 152 | fuser | 153 | fusermount | 154 | g\+\+ | 155 | gawk | 156 | gcc | 157 | gem | 158 | getfacl | 159 | gpasswd | 160 | grep | 161 | groupadd | 162 | groupdel | 163 | groupmd | 164 | groups | 165 | grunt | 166 | gulp | 167 | gzip | 168 | head | 169 | hg | 170 | homebrew | 171 | hostname | 172 | htop | 173 | iconv | 174 | id | 175 | ifconfig | 176 | ifdown | 177 | ifup | 178 | import | 179 | info | 180 | insmod | 181 | jar | 182 | java | 183 | javac | 184 | join | 185 | kermit | 186 | killall | 187 | kmod | 188 | latex | 189 | ldconfig | 190 | less | 191 | lftp | 192 | link | 193 | llvm | 194 | ln | 195 | locate | 196 | logname | 197 | look | 198 | loout | 199 | lpc | 200 | lpq | 201 | lpr | 202 | lprint | 203 | lprintd | 204 | lprintq | 205 | lprm | 206 | ls | 207 | lsb_release | 208 | lsod | 209 | lsof | 210 | lua | 211 | mail | 212 | mailx | 213 | make | 214 | man | 215 | mandb | 216 | md5sum | 217 | mesg | 218 | mf | 219 | mkdir | 220 | mkdocs | 221 | mkfifo | 222 | mkisofs | 223 | mknod | 224 | mktemp | 225 | mmv | 226 | modinfo | 227 | modprobe | 228 | more | 229 | most | 230 | mount | 231 | mtools | 232 | mtr | 233 | mutt | 234 | mv | 235 | mysql | 236 | mysqlaccess | 237 | mysqladmin | 238 | mysqlbinlog | 239 | mysqlbug | 240 | mysqlcheck | 241 | mysqldump | 242 | mysqldumpslow | 243 | mysqlhotcopy | 244 | mysqlimport | 245 | mysqlshow | 246 | mysqltest | 247 | mysqltestmanager | 248 | mysqltestmanager-pwgen | 249 | mysqltestmanagerc | 250 | netstat | 251 | nl | 252 | node | 253 | notify-se | 254 | npm | 255 | nproc | 256 | nslookup | 257 | nstat | 258 | op | 259 | open | 260 | openssl | 261 | pandoc | 262 | passwd | 263 | paste | 264 | patch | 265 | pathchk | 266 | pdflatex | 267 | pdftex | 268 | pdftops | 269 | pear | 270 | pecl | 271 | pelican | 272 | perl | 273 | php | 274 | php-cgi | 275 | php-config | 276 | php-fpm | 277 | phpize | 278 | ping | 279 | pip | 280 | pkg-config | 281 | pkgdata | 282 | pkill | 283 | pr | 284 | printcap | 285 | ps | 286 | pstree | 287 | pv | 288 | pwck | 289 | pwconv | 290 | pwunconv | 291 | py | 292 | python | 293 | qmake | 294 | quota | 295 | quotachec | 296 | quotactl | 297 | ram | 298 | rar | 299 | rcp | 300 | readlink | 301 | realpath | 302 | reboot | 303 | remsync | 304 | renae | 305 | renice | 306 | rev | 307 | rg | 308 | rm | 309 | rmdir | 310 | rmmod | 311 | rpm | 312 | rsync | 313 | ruby | 314 | scp | 315 | screen | 316 | sdiff | 317 | sed | 318 | select | 319 | sendmail | 320 | seq | 321 | service | 322 | setfacl | 323 | sftp | 324 | sh | 325 | shutdown | 326 | sleep | 327 | slocate | 328 | sort | 329 | split | 330 | sqlite | 331 | sshfs | 332 | stat | 333 | strace | 334 | subl | 335 | sum | 336 | susend | 337 | svn | 338 | sync | 339 | sysctl | 340 | systemctl | 341 | tac | 342 | tail | 343 | tar | 344 | tcsh | 345 | tee | 346 | thtool | 347 | tie | 348 | tig | 349 | timeout | 350 | top | 351 | touch | 352 | tput | 353 | tr | 354 | tracerout | 355 | tsort | 356 | tty | 357 | umount | 358 | uname | 359 | unexpand | 360 | unil | 361 | uniq | 362 | units | 363 | unix2dos | 364 | unix2mac | 365 | unlink | 366 | unpack | 367 | unprotoize | 368 | unrar | 369 | unrtf | 370 | unshar | 371 | untic | 372 | unwhiteout | 373 | unxz | 374 | unzip | 375 | unzipsfx | 376 | updatedb | 377 | uptime | 378 | useradd | 379 | userdel | 380 | usermod | 381 | users | 382 | uudecode | 383 | uuencode | 384 | vi | 385 | vim | 386 | visudo | 387 | vmstat | 388 | w | 389 | wall | 390 | watch | 391 | wc | 392 | webpack | 393 | wget | 394 | whatis | 395 | whereis | 396 | which | 397 | who | 398 | whoami | 399 | write | 400 | xargs | 401 | xdg-open | 402 | xkill | 403 | xxd | 404 | xz | 405 | yarn | 406 | yes | 407 | ypcat | 408 | ypchfn | 409 | ypchsh | 410 | yppasswd | 411 | yptest | 412 | ypwhich | 413 | zip | 414 | zsh 415 | )(?:{{version_string}}?) 416 | 417 | cmd_builtin: |- 418 | (?x: 419 | alias | 420 | bg | 421 | bind | 422 | builtin | 423 | caller | 424 | cd | 425 | command | 426 | compgen | 427 | complete | 428 | declare | 429 | dirs | 430 | disown | 431 | echo | 432 | enable | 433 | eval | 434 | exec | 435 | exit | 436 | export | 437 | false | 438 | fc | 439 | fg | 440 | getopts | 441 | hash | 442 | help | 443 | history | 444 | jobs | 445 | kill | 446 | let | 447 | local | 448 | logout | 449 | nice | 450 | nohup | 451 | popd | 452 | printf | 453 | pushd | 454 | pwd | 455 | readarray | 456 | readonly | 457 | read | 458 | setenv | 459 | set | 460 | shift | 461 | shopt | 462 | source | 463 | suspend | 464 | test | 465 | times | 466 | time | 467 | trap | 468 | true | 469 | typeset | 470 | type | 471 | ulimit | 472 | umask | 473 | unalias | 474 | unset | 475 | wait 476 | ) 477 | 478 | contexts: 479 | 480 | main: 481 | - include: main_except_execution 482 | - include: execution 483 | 484 | # backtick is deprecated and annoying to parse 485 | main_in_backtick: 486 | # all other things except an executable command 487 | - include: comment 488 | - include: pipeline 489 | - include: list 490 | - include: compound_command 491 | - include: loop 492 | - include: string 493 | - include: variable_in_backtick 494 | - include: interpolation_not_backtick 495 | - include: redirection_in_backtick 496 | - include: pathname_in_backtick 497 | - include: keyword 498 | - include: execution_in_backtick 499 | 500 | main_except_execution: 501 | # all other things except an executable command 502 | - include: comment 503 | - include: pipeline 504 | - include: list 505 | - include: compound_command 506 | - include: loop 507 | - include: function_definition 508 | - include: string 509 | - include: variable 510 | - include: interpolation 511 | - include: heredoc 512 | - include: herestring 513 | - include: redirection 514 | - include: pathname 515 | - include: keyword 516 | 517 | comment: 518 | - match: (\s|^)(?=#(?!\{)) 519 | push: 520 | - match: (#)(?!\{).*$ 521 | scope: comment.line.number-sign.shell 522 | captures: 523 | 1: punctuation.definition.comment.shell 524 | pop: true 525 | 526 | case_clause: 527 | - match: (?=\s?\S) 528 | push: 529 | - meta_scope: meta.scope.case-clause.shell 530 | - match: (?=(\s|^)(esac)(\s|$)) 531 | pop: true 532 | - match: ;(?:;&?|&) 533 | scope: punctuation.terminator.case-clause.shell 534 | pop: true 535 | - match: \) 536 | scope: punctuation.definition.case-pattern.shell 537 | push: 538 | - meta_scope: meta.scope.case-clause-body.shell 539 | - match: (?=(\s|^)(esac)(\s|$)) 540 | pop: true 541 | - match: (?=;(?:;&?|&)) 542 | pop: true 543 | - include: main 544 | - match: \(|(?=\S) 545 | scope: punctuation.definition.case-pattern.shell 546 | push: 547 | - meta_scope: meta.scope.case-pattern.shell 548 | - match: (?=\)) 549 | pop: true 550 | - match: \| 551 | scope: punctuation.separator.pipe-sign.shell 552 | - include: string 553 | - include: variable 554 | - include: interpolation 555 | - include: pathname 556 | 557 | compound_command: 558 | - match: \[{2}(?=\s) 559 | scope: punctuation.definition.logical-expression.shell 560 | push: 561 | - meta_scope: meta.scope.logical-expression.shell 562 | - match: \s(\]{2}) 563 | captures: 564 | 1: punctuation.definition.logical-expression.shell 565 | pop: true 566 | - include: double_square_pattern_matching 567 | - include: logical_expression 568 | - include: main_except_execution 569 | - match: \[(?=\s) 570 | scope: punctuation.definition.logical-expression.shell 571 | push: 572 | - meta_scope: meta.scope.logical-expression.shell 573 | - match: \s(\]) 574 | captures: 575 | 1: punctuation.definition.logical-expression.shell 576 | pop: true 577 | - include: logical_expression 578 | - include: main_except_execution 579 | - match: \({2} 580 | scope: punctuation.definition.string.begin.shell 581 | push: 582 | - match: \){2} 583 | scope: punctuation.definition.string.end.shell 584 | pop: true 585 | # variable without $ prefix 586 | - match: \b{{variable_name}}\b 587 | scope: variable.other.c-style.shell 588 | - include: math 589 | - match: \( 590 | scope: punctuation.definition.subshell.shell 591 | push: 592 | - meta_scope: meta.scope.subshell.shell 593 | - match: \) 594 | scope: punctuation.definition.subshell.shell 595 | pop: true 596 | - include: main 597 | - match: \{ 598 | scope: punctuation.definition.group.shell 599 | push: 600 | - meta_scope: meta.scope.group.shell 601 | - match: (?=.*;\s*\}$) 602 | set: in_compact_square_compound 603 | - match: '' 604 | set: in_non_compact_square_compound 605 | 606 | in_non_compact_square_compound: 607 | - meta_scope: meta.scope.group.shell 608 | - match: (^|;)\s*(\}) 609 | captures: 610 | 1: keyword.operator.list.shell 611 | 2: punctuation.definition.group.shell 612 | pop: true 613 | - include: main 614 | 615 | in_compact_square_compound: 616 | - match: (<<-?)\s*(EOF)(?=;|\s|$) 617 | captures: 618 | 1: keyword.operator.heredoc.shell 619 | 2: keyword.control.heredoc-token.shell 620 | set: 621 | - meta_scope: meta.scope.group.shell 622 | - match: $ 623 | set: in_heredoc_interpretive 624 | - match: (^|;)\s*(\}) 625 | captures: 626 | 1: keyword.operator.list.shell 627 | 2: punctuation.definition.group.shell 628 | set: in_heredoc_interpretive 629 | - include: main 630 | - match: >- 631 | (?x: 632 | (<<-?)\s* 633 | (?: "(EOF)" | '(EOF)' ) 634 | ) 635 | captures: 636 | 1: keyword.operator.heredoc.shell 637 | 2: keyword.control.heredoc-token.shell 638 | 3: keyword.control.heredoc-token.shell 639 | set: 640 | - meta_scope: meta.scope.group.shell 641 | - match: (^|;)\s*(\}) 642 | captures: 643 | 1: keyword.operator.list.shell 644 | 2: punctuation.definition.group.shell 645 | set: in_heredoc_non_interpretive 646 | - include: main 647 | - match: (^|;)\s*(\}) 648 | captures: 649 | 1: keyword.operator.list.shell 650 | 2: punctuation.definition.group.shell 651 | pop: true 652 | - include: main 653 | 654 | function_definition: 655 | - match: \b(function)\s+([^\s\\(]+)\s*(\(\s*\))? 656 | captures: 657 | 1: storage.type.function.shell 658 | 2: entity.name.function.shell 659 | 3: punctuation.definition.arguments.shell 660 | push: 661 | - meta_scope: meta.function.shell 662 | - match: ;|&|$ 663 | scope: punctuation.definition.function.shell 664 | pop: true 665 | - include: main 666 | - match: \b([^\s\\=]+)\s*(\(\)) 667 | captures: 668 | 1: entity.name.function.shell 669 | 2: punctuation.definition.arguments.shell 670 | push: 671 | - meta_scope: meta.function.shell 672 | - match: '[;&]|$' 673 | scope: punctuation.definition.function.shell 674 | pop: true 675 | - include: main 676 | 677 | heredoc: 678 | - include: heredoc_interpretive 679 | - include: heredoc_non_interpretive 680 | 681 | heredoc_simple: 682 | # the line ends with a heredoc identifier directly 683 | # for example: 684 | # cat <<_ACEOF 685 | # first print 686 | # _ACEOF 687 | - match: (?=<<-?\s*({{identifier}})\s*(?:;?\s*$)) 688 | push: 689 | # end of heredoc 690 | - match: ^\s*(\1)\s*$ 691 | captures: 692 | 1: keyword.control.heredoc-token.shell 693 | pop: true 694 | # start comsuming heredoc 695 | - match: (<<-?)\s* 696 | captures: 697 | 1: keyword.operator.heredoc.shell 698 | push: 699 | - match: ({{identifier}})(;?)\s*$ 700 | captures: 701 | 1: keyword.control.heredoc-token.shell 702 | 2: keyword.operator.list.shell 703 | set: in_heredoc_simple 704 | 705 | heredoc_interpretive: 706 | - include: heredoc_simple 707 | # the line does not end with a heredoc identifier directly 708 | # for example: 709 | # cat <- 725 | (?x: 726 | (<<-?)\s* 727 | (?: "(EOF)" | '(EOF)' ) 728 | ) 729 | captures: 730 | 1: keyword.operator.heredoc.shell 731 | 2: keyword.control.heredoc-token.shell 732 | 3: keyword.control.heredoc-token.shell 733 | push: 734 | - match: $ 735 | set: in_heredoc_non_interpretive 736 | - include: main 737 | 738 | in_heredoc_simple: 739 | - meta_content_scope: string.unquoted.heredoc.shell 740 | - match: (?=^\s*(\1)\s*$) 741 | pop: true 742 | # interpretive 743 | - include: escaped_char 744 | - include: variable 745 | - include: interpolation 746 | 747 | in_heredoc_interpretive: 748 | - meta_content_scope: string.unquoted.heredoc.shell 749 | - match: ^\s*(EOF)\s*$ 750 | captures: 751 | 1: keyword.control.heredoc-token.shell 752 | pop: true 753 | # interpretive 754 | - include: escaped_char 755 | - include: variable 756 | - include: interpolation 757 | 758 | in_heredoc_non_interpretive: 759 | - meta_content_scope: string.unquoted.heredoc.shell 760 | - match: ^\s*(EOF)\s*$ 761 | captures: 762 | 1: keyword.control.heredoc-token.shell 763 | pop: true 764 | 765 | herestring: 766 | - match: (<<<)(?=') 767 | scope: keyword.operator.herestring.shell 768 | push: 769 | - match: (') 770 | scope: punctuation.definition.string.begin.shell 771 | set: 772 | - meta_scope: meta.herestring.shell string.quoted.single.herestring.shell 773 | - match: (') 774 | scope: punctuation.definition.string.end.shell 775 | pop: true 776 | - match: (<<<)(?=") 777 | scope: keyword.operator.herestring.shell 778 | push: 779 | - match: (") 780 | scope: punctuation.definition.string.begin.shell 781 | set: 782 | - meta_scope: meta.herestring.shell string.quoted.double.herestring.shell 783 | - match: (") 784 | scope: punctuation.definition.string.end.shell 785 | pop: true 786 | - include: escaped_char 787 | - include: variable 788 | - include: interpolation 789 | - match: (<<<)(([^\s\\]|\\.)+) 790 | scope: meta.herestring.shell 791 | captures: 792 | 1: keyword.operator.herestring.shell 793 | 2: string.unquoted.herestring.shell 794 | 795 | interpolation: 796 | - include: interpolation_backtick 797 | - include: interpolation_not_backtick 798 | 799 | interpolation_not_backtick: 800 | # although "$((echo hello) > output.txt)" starts with "$((" 801 | # but the statement is actually an interpolation 802 | # rather than a "$((...))" expansion(c-style_manipulation) statement 803 | - match: '(?x: 804 | \$\({2} 805 | (?= 806 | ( 807 | [^\)] | 808 | \)(?![^>]*>[^>]*\)) 809 | )*$ 810 | ) 811 | )' 812 | scope: punctuation.definition.string.begin.shell 813 | push: c-style_manipulation 814 | - match: \$\( 815 | scope: punctuation.definition.string.begin.shell 816 | push: 817 | - meta_scope: string.interpolated.dollar.shell meta.embedded.interpolated.dollar.shell 818 | - match: \) 819 | scope: punctuation.definition.string.end.shell 820 | pop: true 821 | - include: main 822 | 823 | interpolation_backtick: 824 | - match: '`' 825 | scope: punctuation.definition.string.begin.shell 826 | push: 827 | - meta_scope: string.interpolated.backtick.shell meta.embedded.interpolated.backtick.shell 828 | - match: '`' 829 | scope: punctuation.definition.string.end.shell 830 | pop: true 831 | - match: \\[`\\$] 832 | scope: constant.character.escape.shell 833 | - include: main_in_backtick 834 | # there is no nested backtick interpolation in Bash 835 | 836 | c-style_manipulation: 837 | - meta_scope: string.other.math.shell 838 | - include: c-style_manipulation_parentheses_balancing 839 | - match: \){2} 840 | scope: punctuation.definition.string.end.shell 841 | pop: true 842 | - match: \) 843 | scope: punctuation.definition.string.end.shell 844 | set: 845 | - match: \) 846 | scope: punctuation.definition.string.end.shell 847 | pop: true 848 | - include: redirection 849 | - include: math 850 | - include: interpolation 851 | 852 | c-style_manipulation_parentheses_balancing: 853 | - match: \( 854 | scope: meta.reset.color 855 | push: 856 | - include: c-style_manipulation_parentheses_balancing 857 | - match: \) 858 | scope: meta.reset.color 859 | pop: true 860 | # variable without $ prefix 861 | - match: \b{{variable_name}}\b 862 | scope: variable.other.c-style.shell 863 | - include: math 864 | 865 | keyword: 866 | - match: (?:\s|^)(if|then|else|elif|fi|for|in|do|done|select|case|continue|break|esac|while|until|return)(?=\s|$) 867 | captures: 868 | 1: keyword.control.shell 869 | 870 | list: 871 | - match: (;)(then|do)(?=\s|$) 872 | captures: 873 | 1: keyword.operator.list.shell 874 | 2: keyword.control.shell 875 | - match: ;|&&|&(?!>)|\|\| 876 | scope: keyword.operator.list.shell 877 | 878 | double_square_pattern_matching: 879 | - match: =~(?=\s) 880 | scope: keyword.operator.logical.shell 881 | push: 882 | - match: (?=\s\]{2}) 883 | pop: true 884 | - include: string_no_escape 885 | - include: variable 886 | - include: interpolation 887 | - match: (?=[^\s]) 888 | push: scope:source.regexp 889 | with_prototype: 890 | - match: (?=\s\]{2}) 891 | pop: true 892 | - include: variable 893 | - include: interpolation 894 | 895 | logical_expression: 896 | - match: =[=~]?|!=?|<|>|&&|\|\| 897 | scope: keyword.operator.logical.shell 898 | - match: (?:\s|^)((-)(?:nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN]))(?=\s|$) 899 | captures: 900 | 1: keyword.operator.logical.shell 901 | 2: punctuation.definition.logical.shell 902 | 903 | loop: 904 | - match: (?:\s|^)(for)\s+(?=\({2}) 905 | captures: 906 | 1: keyword.control.shell 907 | push: 908 | - meta_scope: meta.scope.for-loop.shell 909 | - match: (?:\s|^)(done)(?=\s|$) 910 | captures: 911 | 1: keyword.control.shell 912 | pop: true 913 | - include: main 914 | - match: (?:\s|^)(for)\s+((?:[^\s\\]|\\.)+)(?=\s|$) 915 | captures: 916 | 1: keyword.control.shell 917 | 2: variable.other.loop.shell 918 | push: 919 | - meta_scope: meta.scope.for-in-loop.shell 920 | - match: (?:\s|^)(done)(?=\s|$) 921 | captures: 922 | 1: keyword.control.shell 923 | pop: true 924 | - include: main 925 | - match: (?:\s|^)(while|until)(?=\s|$) 926 | captures: 927 | 1: keyword.control.shell 928 | push: 929 | - meta_scope: meta.scope.while-loop.shell 930 | - match: (?:\s|^)(done)(?=\s|$) 931 | captures: 932 | 1: keyword.control.shell 933 | pop: true 934 | - include: main 935 | - match: '(?:\s|^)(select)\s+((?:[^\s\\]|\\.)+)(?=\s|$)' 936 | captures: 937 | 1: keyword.control.shell 938 | 2: variable.other.loop.shell 939 | push: 940 | - meta_scope: meta.scope.select-block.shell 941 | - match: (?:\s|^)(done)(?=\s|$) 942 | captures: 943 | 1: keyword.control.shell 944 | pop: true 945 | - include: main 946 | - match: (?:\s|^)(case)(?=\s|$) 947 | captures: 948 | 1: keyword.control.shell 949 | push: 950 | - meta_scope: meta.scope.case-block.shell 951 | - match: (?:\s|^)(esac)(?=\s|$) 952 | captures: 953 | 1: keyword.control.shell 954 | pop: true 955 | - match: (?:\s|^)(in)(?=\s|$) 956 | captures: 957 | 1: keyword.control.shell 958 | push: 959 | - meta_scope: meta.scope.case-body.shell 960 | - match: (?=(\s|^)(esac)(\s|$)) 961 | pop: true 962 | - include: comment 963 | - include: case_clause 964 | - include: main 965 | - include: main 966 | - match: (?:\s|^)(if)(?=\s|$) 967 | captures: 968 | 1: keyword.control.shell 969 | push: 970 | - meta_scope: meta.scope.if-block.shell 971 | - match: (?=.*;\s*(fi)$) 972 | set: in_compact_if 973 | - match: '' 974 | set: in_non_compact_if 975 | 976 | in_non_compact_if: 977 | - meta_scope: meta.scope.if-block.shell 978 | - match: (?:\s|^)(fi)(?=;|\s|$) 979 | captures: 980 | 1: keyword.control.shell 981 | pop: true 982 | - include: main 983 | 984 | in_compact_if: 985 | - match: (<<-?)\s*(EOF)(?=;|\s|$) 986 | captures: 987 | 1: keyword.operator.heredoc.shell 988 | 2: keyword.control.heredoc-token.shell 989 | set: 990 | - meta_scope: meta.scope.if-block.shell 991 | - match: $ 992 | set: in_heredoc_interpretive 993 | - match: (?:\s|^)(fi)(?=;|\s|$) 994 | captures: 995 | 1: keyword.control.shell 996 | set: in_heredoc_interpretive 997 | - include: main 998 | - match: (<<-?)\s*(["'])(EOF)\2 999 | captures: 1000 | 1: keyword.operator.heredoc.shell 1001 | 3: keyword.control.heredoc-token.shell 1002 | set: 1003 | - meta_scope: meta.scope.if-block.shell 1004 | - match: (?:\s|^)(fi)(?=;|\s|$) 1005 | captures: 1006 | 1: keyword.control.shell 1007 | set: in_heredoc_non_interpretive 1008 | - include: main 1009 | - match: (?:\s|^)(fi)(?=;|\s|$) 1010 | captures: 1011 | 1: keyword.control.shell 1012 | pop: true 1013 | - include: main 1014 | 1015 | math: 1016 | - include: variable 1017 | - match: \+{1,2}|-{1,2}|!|~|\*{1,2}|/|%|([=!*/%+\-&^|]|<>?)?=|^|\|{1,2}|&{1,2}|[?:,<>] 1018 | scope: keyword.operator.arithmetic.shell 1019 | - match: 0[xX]\h+ 1020 | scope: constant.numeric.hex.shell 1021 | - match: 0[0-9]+ 1022 | scope: constant.numeric.octal.shell 1023 | - match: '[0-9]{1,2}#[0-9a-zA-Z_@]+' 1024 | scope: constant.numeric.other.shell 1025 | - match: '[0-9]+' 1026 | scope: constant.numeric.integer.shell 1027 | 1028 | array: 1029 | - match: \( 1030 | scope: punctuation.definition.array.begin.shell 1031 | push: 1032 | - meta_scope: meta.structure.array.shell 1033 | - match: \) 1034 | scope: punctuation.definition.array.end.shell 1035 | pop: true 1036 | - match: (^|\s)(?=\[) 1037 | push: 1038 | - include: array_section_part 1039 | - match: '=' 1040 | scope: keyword.operator.assign.shell 1041 | push: 1042 | - include: string 1043 | - include: variable 1044 | - include: interpolation 1045 | - match: '' 1046 | pop: true 1047 | - match: '' 1048 | pop: true 1049 | - include: comment 1050 | - include: string 1051 | - include: variable 1052 | - include: interpolation 1053 | - match: '' 1054 | pop: true 1055 | 1056 | array_section_part: 1057 | - match: \[ 1058 | scope: punctuation.section.array.begin.shell 1059 | push: 1060 | - meta_scope: meta.structure.array-section.shell 1061 | - match: \] 1062 | scope: punctuation.section.array.end.shell 1063 | pop: true 1064 | - include: string 1065 | 1066 | pathname: 1067 | - match: ({{variable_name}})(=)(?=\s*$|[^\s]) 1068 | captures: 1069 | 1: meta.variable.assigned.shell 1070 | 2: keyword.operator.assign.shell 1071 | push: [ array, cmd_args, assigned_true_false ] 1072 | - match: ({{variable_name}})(\+=)(?=\s*$|[^\s]) 1073 | captures: 1074 | 1: meta.variable.assigned.shell 1075 | 2: keyword.operator.append.shell 1076 | push: [ array, cmd_args, assigned_true_false ] 1077 | - include: pathname_COMMON_PART 1078 | 1079 | pathname_in_backtick: 1080 | - match: ({{variable_name}})(=)(?=\s*$|[^\s]) 1081 | captures: 1082 | 1: meta.variable.assigned.shell 1083 | 2: keyword.operator.assign.shell 1084 | push: [ array, cmd_args_in_backtick, assigned_true_false ] 1085 | - match: ({{variable_name}})(\+=)(?=\s*$|[^\s]) 1086 | captures: 1087 | 1: meta.variable.assigned.shell 1088 | 2: keyword.operator.append.shell 1089 | push: [ array, cmd_args_in_backtick, assigned_true_false ] 1090 | - include: pathname_COMMON_PART 1091 | 1092 | pathname_COMMON_PART: 1093 | - match: '~' 1094 | scope: keyword.operator.tilde.shell 1095 | - match: '[*?]' 1096 | scope: keyword.operator.glob.shell 1097 | - match: ([?*+@!])(\() 1098 | captures: 1099 | 1: keyword.operator.extglob.shell 1100 | 2: punctuation.definition.extglob.shell 1101 | push: 1102 | - meta_scope: meta.structure.extglob.shell 1103 | - match: \) 1104 | scope: punctuation.definition.extglob.shell 1105 | pop: true 1106 | - include: main 1107 | 1108 | pipeline: 1109 | - match: '[|!]' 1110 | scope: keyword.operator.pipe.shell 1111 | 1112 | # ref: http://www.tldp.org/LDP/abs/html/io-redirection.html 1113 | redirection: 1114 | - match: '[><]\(' 1115 | scope: punctuation.definition.string.begin.shell 1116 | push: 1117 | - meta_scope: string.interpolated.process-substitution.shell meta.embedded.interpolated.process-substitution.shell 1118 | - match: \) 1119 | scope: punctuation.definition.string.end.shell 1120 | pop: true 1121 | - include: main 1122 | # from file-descriptor to file-descriptor 1123 | - match: ([0-9]+|[&])?((?:[<>]|>>|<<|<>)(?:[&]))\s*([0-9]+|[-])(?=[;|!)`]|\s|$) 1124 | captures: 1125 | 1: constant.numeric.file-descriptor.shell 1126 | 2: keyword.operator.redirect.shell 1127 | 3: constant.numeric.file-descriptor.shell 1128 | push: cmd_args 1129 | # from file-descriptor to file 1130 | # from file to file-descriptor 1131 | - match: ([0-9]+|[&])?((?:[<>]|>>|<<|<>)(?:[!|]?)) 1132 | captures: 1133 | 1: constant.numeric.file-descriptor.shell 1134 | 2: keyword.operator.redirect.shell 1135 | push: cmd_args 1136 | 1137 | redirection_in_backtick: 1138 | - match: '[><]\(' 1139 | scope: punctuation.definition.string.begin.shell 1140 | push: 1141 | - meta_scope: string.interpolated.process-substitution.shell meta.embedded.interpolated.process-substitution.shell 1142 | - match: \) 1143 | scope: punctuation.definition.string.end.shell 1144 | pop: true 1145 | - include: main 1146 | # from file-descriptor to file-descriptor 1147 | - match: ([0-9]+|[&])?((?:[<>]|>>|<<|<>)(?:[&]))\s*([0-9]+|[-])(?=[;|!)`]|\s|$) 1148 | captures: 1149 | 1: constant.numeric.file-descriptor.shell 1150 | 2: keyword.operator.redirect.shell 1151 | 3: constant.numeric.file-descriptor.shell 1152 | push: cmd_args_in_backtick 1153 | # from file-descriptor to file 1154 | # from file to file-descriptor 1155 | - match: ([0-9]+|[&])?((?:[<>]|>>|<<|<>)(?:[!|]?)) 1156 | captures: 1157 | 1: constant.numeric.file-descriptor.shell 1158 | 2: keyword.operator.redirect.shell 1159 | push: cmd_args_in_backtick 1160 | 1161 | escaped_char: 1162 | - match: \\. 1163 | scope: constant.character.escape.shell 1164 | 1165 | string: 1166 | - include: escaped_char 1167 | - include: string_no_escape 1168 | 1169 | string_no_escape: 1170 | - match: "'" 1171 | scope: punctuation.definition.string.begin.shell 1172 | push: 1173 | - meta_scope: string.quoted.single.shell 1174 | - match: "'" 1175 | scope: punctuation.definition.string.end.shell 1176 | pop: true 1177 | - match: \$?" 1178 | scope: punctuation.definition.string.begin.shell 1179 | push: 1180 | - meta_scope: string.quoted.double.shell 1181 | - match: '"' 1182 | scope: punctuation.definition.string.end.shell 1183 | pop: true 1184 | - match: \\[\$`"\\\n] 1185 | scope: constant.character.escape.shell 1186 | - include: variable 1187 | - include: interpolation 1188 | - match: \$' 1189 | scope: punctuation.definition.string.begin.shell 1190 | push: 1191 | - meta_scope: string.quoted.single.dollar.shell 1192 | - match: "'" 1193 | scope: punctuation.definition.string.end.shell 1194 | pop: true 1195 | - match: \\(a|b|e|f|n|r|t|v|\\|') 1196 | scope: constant.character.escape.ansi-c.shell 1197 | - match: \\[0-9]{3} 1198 | scope: constant.character.escape.octal.shell 1199 | - match: \\x[0-9a-fA-F]{2} 1200 | scope: constant.character.escape.hex.shell 1201 | - match: \\c. 1202 | scope: constant.character.escape.control-char.shell 1203 | 1204 | execution: 1205 | - match: (?:\s|^)([:.])(?=;|\s|$) 1206 | captures: 1207 | 1: support.function.builtin.shell 1208 | - match: ({{cmd_privilege}})(?=[\s><&;|`)]|\\\n|$) 1209 | scope: support.function.privilege.shell 1210 | set: [ main, cmd_privilege_parse ] 1211 | - match: ({{cmd_builtin}})(?=[\s><&;|`)]|\\\n|$) 1212 | scope: support.function.builtin.shell 1213 | push: cmd_args 1214 | - match: ({{cmd_external}})(?=[\s><&;|`)]|\\\n|$) 1215 | scope: support.function.external.shell 1216 | push: cmd_args 1217 | - match: ({{cmd_unknown}})(?=[\s><&;|`)]|\\\n|$) 1218 | push: cmd_args 1219 | 1220 | execution_in_backtick: 1221 | # the same with "execution" but calls "cmd_args_in_backtick" 1222 | - match: (?:\s|^)([:.])(?=;|\s|$) 1223 | captures: 1224 | 1: support.function.builtin.shell 1225 | - match: ({{cmd_privilege}})(?=[\s><&;|`)]|\\\n|$) 1226 | scope: support.function.privilege.shell 1227 | set: [ main_in_backtick, cmd_privilege_parse ] 1228 | - match: ({{cmd_builtin}})(?=[\s><&;|`)]|\\\n|$) 1229 | scope: support.function.builtin.shell 1230 | push: cmd_args_in_backtick 1231 | - match: ({{cmd_external}})(?=[\s><&;|`)]|\\\n|$) 1232 | scope: support.function.external.shell 1233 | push: cmd_args_in_backtick 1234 | - match: ({{cmd_unknown}})(?=[\s><&;|`)]|\\\n|$) 1235 | push: cmd_args_in_backtick 1236 | 1237 | cmd_privilege_parse: 1238 | # command switch 1239 | - match: (--)(?=[\s()<>&;|]|\n) 1240 | scope: punctuation.definition.command-switch-end.shell 1241 | pop: true 1242 | - include: cmd_switch 1243 | - match: '' 1244 | pop: true 1245 | 1246 | cmd_args: 1247 | - meta_content_scope: meta.reset.color 1248 | # cmd_args can have interpolations 1249 | - include: interpolation 1250 | - include: cmd_args_COMMAND_PART 1251 | - include: pathname 1252 | - include: redirection 1253 | # command switch 1254 | - match: (--)(?=[\s()<>&;|]|\n) 1255 | scope: punctuation.definition.command-switch-end.shell 1256 | set: cmd_args_no_command_switch 1257 | - include: cmd_switch 1258 | 1259 | cmd_args_no_command_switch: 1260 | - meta_content_scope: meta.reset.color 1261 | # cmd_args can have interpolations 1262 | - include: interpolation 1263 | - include: cmd_args_COMMAND_PART 1264 | - include: pathname 1265 | - include: redirection 1266 | 1267 | cmd_args_in_backtick: 1268 | - meta_content_scope: meta.reset.color 1269 | # "`" should result in popping 1270 | - match: (?=\s*[`]) 1271 | pop: true 1272 | - include: cmd_args_COMMAND_PART 1273 | - include: pathname_in_backtick 1274 | - include: redirection_in_backtick 1275 | # command switch 1276 | - match: (--)(?=[\s()<>&;|]|\n) 1277 | scope: punctuation.definition.command-switch-end.shell 1278 | set: cmd_args_in_backtick_no_command_switch 1279 | - include: cmd_switch 1280 | 1281 | cmd_args_in_backtick_no_command_switch: 1282 | - meta_content_scope: meta.reset.color 1283 | # "`" should result in popping 1284 | - match: (?=\s*[`]) 1285 | pop: true 1286 | - include: cmd_args_COMMAND_PART 1287 | - include: pathname_in_backtick 1288 | - include: redirection_in_backtick 1289 | 1290 | cmd_args_COMMAND_PART: 1291 | - match: (?=\s*[()<>&;|]|\n) 1292 | pop: true 1293 | - match: (\\)\n 1294 | captures: 1295 | 1: punctuation.definition.multiline.shell 1296 | - include: comment 1297 | - include: string 1298 | - include: variable 1299 | - include: heredoc 1300 | - include: herestring 1301 | 1302 | cmd_switch: 1303 | - match: '(^|\s)(?=[-+]+[^-+\s])' 1304 | push: 1305 | - meta_content_scope: support.command-switch.shell 1306 | - match: '[-+]+' 1307 | scope: punctuation.definition.command-switch.shell 1308 | set: 1309 | - match: '[0-9a-zA-Z_-]+' 1310 | scope: support.command-switch.shell 1311 | - match: '=' 1312 | scope: keyword.operator.assign.shell 1313 | push: assigned_true_false 1314 | - match: '' 1315 | pop: true 1316 | 1317 | assigned_true_false: 1318 | - match: (?i:true)(?=;|\s|$) 1319 | scope: variable.other.true.shell 1320 | pop: true 1321 | - match: (?i:false)(?=;|\s|$) 1322 | scope: variable.other.false.shell 1323 | pop: true 1324 | - match: '' 1325 | pop: true 1326 | 1327 | variable: 1328 | - match: (\$)[-*@#?$!0_](?=[\W]|$) 1329 | scope: variable.other.special.shell 1330 | captures: 1331 | 1: punctuation.definition.variable.shell 1332 | - match: (\$)[1-9] 1333 | scope: variable.other.positional.shell 1334 | captures: 1335 | 1: punctuation.definition.variable.shell 1336 | - match: (\$){{variable_name}} 1337 | scope: variable.other.normal.shell 1338 | captures: 1339 | 1: punctuation.definition.variable.shell 1340 | - match: \$\{ 1341 | scope: punctuation.definition.variable.shell 1342 | push: 1343 | - meta_scope: variable.other.bracket.shell 1344 | - match: \} 1345 | scope: punctuation.definition.variable.shell 1346 | pop: true 1347 | - include: array_section_part 1348 | - include: variable_first_match_operator 1349 | - include: variable_first_match_variable 1350 | - include: string 1351 | - include: variable 1352 | - include: interpolation 1353 | 1354 | variable_in_backtick: 1355 | - match: (\$)[-*@#?$!0_](?=[\W]|$) 1356 | scope: variable.other.special.shell 1357 | captures: 1358 | 1: punctuation.definition.variable.shell 1359 | - match: (\$)[1-9] 1360 | scope: variable.other.positional.shell 1361 | captures: 1362 | 1: punctuation.definition.variable.shell 1363 | - match: (\$){{variable_name}} 1364 | scope: variable.other.normal.shell 1365 | captures: 1366 | 1: punctuation.definition.variable.shell 1367 | - match: \$\{ 1368 | scope: punctuation.definition.variable.shell 1369 | push: 1370 | - meta_scope: variable.other.bracket.shell 1371 | - match: \} 1372 | scope: punctuation.definition.variable.shell 1373 | pop: true 1374 | - include: array_section_part 1375 | - include: variable_first_match_operator 1376 | - include: variable_first_match_variable 1377 | - include: string 1378 | - include: variable_in_backtick 1379 | - include: interpolation_not_backtick 1380 | 1381 | variable_first_match_operator: 1382 | # ${(...)...} is zsh only 1383 | - match: (\()([#%@AabcCDefFgikLnoOPQtuUvVwWXz0p~jlmrsZ_SIBEMNR]+) 1384 | captures: 1385 | 1: punctuation.definition.flag.begin.shell 1386 | 2: keyword.operator.expansion.flag.shell 1387 | push: 1388 | - meta_content_scope: meta.reset.color 1389 | - match: \) 1390 | scope: punctuation.definition.flag.end.shell 1391 | pop: true 1392 | # match the delimiter (normal) 1393 | - match: ([^a-zA-Z0-9(){}<>\[\]]) 1394 | scope: punctuation.definition.delimiter.begin.shell 1395 | push: 1396 | - match: \1 1397 | scope: punctuation.definition.delimiter.end.shell 1398 | pop: true 1399 | - include: variable_COMMON_INCLUDE 1400 | # match the delimiter (special) 1401 | - match: \( 1402 | scope: punctuation.definition.delimiter.begin.shell 1403 | push: 1404 | - match: \) 1405 | scope: punctuation.definition.delimiter.end.shell 1406 | pop: true 1407 | - include: variable_COMMON_INCLUDE 1408 | - match: \{ 1409 | scope: punctuation.definition.delimiter.begin.shell 1410 | push: 1411 | - match: \} 1412 | scope: punctuation.definition.delimiter.end.shell 1413 | pop: true 1414 | - include: variable_COMMON_INCLUDE 1415 | - match: '<' 1416 | scope: punctuation.definition.delimiter.begin.shell 1417 | push: 1418 | - match: '>' 1419 | scope: punctuation.definition.delimiter.end.shell 1420 | pop: true 1421 | - include: variable_COMMON_INCLUDE 1422 | - include: variable_COMMON_INCLUDE 1423 | - match: '#' 1424 | scope: keyword.operator.length.shell 1425 | - match: '!' 1426 | scope: keyword.operator.match.shell 1427 | 1428 | variable_COMMON_INCLUDE: 1429 | - include: string 1430 | - include: variable 1431 | - include: interpolation 1432 | 1433 | variable_first_match_variable: 1434 | - match: '[0-9]+' 1435 | scope: variable.other.positional.shell 1436 | push: 1437 | - meta_scope: variable.other.bracket.shell 1438 | - match: (?=}) 1439 | pop: true 1440 | - include: variable_substring_replacement 1441 | - include: variable_case_conversion 1442 | - include: variable_COMMON_INCLUDE 1443 | - match: '{{variable_name}}' 1444 | push: 1445 | - meta_scope: variable.other.bracket.shell 1446 | - match: (?=}) 1447 | pop: true 1448 | - match: '[*@]' 1449 | scope: keyword.operator.match.shell 1450 | pop: true # is this pop appropriate? 1451 | - include: variable_substring_replacement 1452 | - include: variable_case_conversion 1453 | - include: variable_COMMON_INCLUDE 1454 | 1455 | variable_substring_replacement: 1456 | # matching: ${var/Pattern/Replacement} 1457 | - match: /[#%/]? 1458 | scope: keyword.operator.substringreplacement.shell 1459 | push: 1460 | - meta_content_scope: meta.reset.color 1461 | - match: (?=}) 1462 | pop: true 1463 | - match: / 1464 | scope: keyword.operator.substringreplacement.shell 1465 | push: 1466 | - match: (?=}) 1467 | pop: true 1468 | - include: variable_COMMON_INCLUDE 1469 | - include: variable_COMMON_INCLUDE 1470 | # matching: ${var##Pattern} 1471 | - match: '[#%]{1,2}' 1472 | scope: keyword.operator.substringremoval.shell 1473 | push: 1474 | - meta_content_scope: meta.reset.color 1475 | - match: (?=}) 1476 | pop: true 1477 | - include: variable_COMMON_INCLUDE 1478 | # matching: ${foo:+bar} 1479 | - match: :?[+\-=?] 1480 | scope: keyword.operator.substringreplacement.shell 1481 | push: 1482 | - meta_content_scope: meta.reset.color 1483 | - match: (?=}) 1484 | pop: true 1485 | - include: variable_COMMON_INCLUDE 1486 | # matching: ${var:pos:len} 1487 | - match: ':' 1488 | scope: keyword.operator.expansion.shell 1489 | push: 1490 | - meta_content_scope: meta.reset.color 1491 | - match: (?=}) 1492 | pop: true 1493 | - match: ':' 1494 | scope: keyword.operator.expansion.shell 1495 | push: 1496 | - match: (?=}) 1497 | pop: true 1498 | - include: variable_COMMON_INCLUDE 1499 | - include: variable_COMMON_INCLUDE 1500 | 1501 | variable_case_conversion: 1502 | # matching: ${foo,,Pattern} 1503 | - match: ',{1,2}' 1504 | scope: keyword.operator.lowercase.shell 1505 | push: 1506 | - meta_content_scope: meta.reset.color 1507 | - match: (?=}) 1508 | pop: true 1509 | - include: variable_COMMON_INCLUDE 1510 | # matching: ${foo^^Pattern} 1511 | - match: \^{1,2} 1512 | scope: keyword.operator.uppercase.shell 1513 | push: 1514 | - meta_content_scope: meta.reset.color 1515 | - match: (?=}) 1516 | pop: true 1517 | - include: variable_COMMON_INCLUDE 1518 | -------------------------------------------------------------------------------- /color_schemes/dark.sublime-color-scheme: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Monokai Soda Mod", 3 | "author": "Jack Cherng (jfcherng)", 4 | "variables": { 5 | ////////// 6 | // base // 7 | ////////// 8 | "Black" : "#000" , 9 | "BlackLight" : "#111" , 10 | "BlackLighter" : "#222" , 11 | "BlackLightest" : "#333" , 12 | "BlueSaturated" : "#00F" , 13 | "CyanSaturated" : "#0FF" , 14 | "GreenSaturated" : "#0F0" , 15 | "PinkSaturated" : "#F0F" , 16 | "RedSaturated" : "#F00" , 17 | "White" : "#FFF" , 18 | "WhiteDark" : "#EEE" , 19 | "WhiteDarker" : "#DDD" , 20 | "WhiteDarkest" : "#CCC" , 21 | "YellowSaturated" : "#FF0" , 22 | ////////////////////////////////////////////////////////////////////// 23 | // material colors: https://material.io/guidelines/style/color.html // 24 | ////////////////////////////////////////////////////////////////////// 25 | // Red // Pink // Purple 26 | "Red050" : "#FFEBEE" , "Pink050" : "#FCE4EC" , "Purple050" : "#F3E5F5" , 27 | "Red100" : "#FFCDD2" , "Pink100" : "#F8BBD0" , "Purple100" : "#E1BEE7" , 28 | "Red200" : "#EF9A9A" , "Pink200" : "#F48FB1" , "Purple200" : "#CE93D8" , 29 | "Red300" : "#E57373" , "Pink300" : "#F06292" , "Purple300" : "#BA68C8" , 30 | "Red400" : "#EF5350" , "Pink400" : "#EC407A" , "Purple400" : "#AB47BC" , 31 | "Red500" : "#F44336" , "Pink500" : "#E91E63" , "Purple500" : "#9C27B0" , 32 | "Red600" : "#E53935" , "Pink600" : "#D81B60" , "Purple600" : "#8E24AA" , 33 | "Red700" : "#D32F2F" , "Pink700" : "#C2185B" , "Purple700" : "#7B1FA2" , 34 | "Red800" : "#C62828" , "Pink800" : "#AD1457" , "Purple800" : "#6A1B9A" , 35 | "Red900" : "#B71C1C" , "Pink900" : "#880E4F" , "Purple900" : "#4A148C" , 36 | "RedA100" : "#FF8A80" , "PinkA100" : "#FF80AB" , "PurpleA100" : "#EA80FC" , 37 | "RedA200" : "#FF5252" , "PinkA200" : "#FF4081" , "PurpleA200" : "#E040FB" , 38 | "RedA400" : "#FF1744" , "PinkA400" : "#F50057" , "PurpleA400" : "#D500F9" , 39 | "RedA700" : "#D50000" , "PinkA700" : "#C51162" , "PurpleA700" : "#AA00FF" , 40 | // DeepPurple // Indigo // Blue 41 | "DeepPurple050" : "#EDE7F6" , "Indigo050" : "#E8EAF6" , "Blue050" : "#E3F2FD" , 42 | "DeepPurple100" : "#D1C4E9" , "Indigo100" : "#C5CAE9" , "Blue100" : "#BBDEFB" , 43 | "DeepPurple200" : "#B39DDB" , "Indigo200" : "#9FA8DA" , "Blue200" : "#90CAF9" , 44 | "DeepPurple300" : "#9575CD" , "Indigo300" : "#7986CB" , "Blue300" : "#64B5F6" , 45 | "DeepPurple400" : "#7E57C2" , "Indigo400" : "#5C6BC0" , "Blue400" : "#42A5F5" , 46 | "DeepPurple500" : "#673AB7" , "Indigo500" : "#3F51B5" , "Blue500" : "#2196F3" , 47 | "DeepPurple600" : "#5E35B1" , "Indigo600" : "#3949AB" , "Blue600" : "#1E88E5" , 48 | "DeepPurple700" : "#512DA8" , "Indigo700" : "#303F9F" , "Blue700" : "#1976D2" , 49 | "DeepPurple800" : "#4527A0" , "Indigo800" : "#283593" , "Blue800" : "#1565C0" , 50 | "DeepPurple900" : "#311B92" , "Indigo900" : "#1A237E" , "Blue900" : "#0D47A1" , 51 | "DeepPurpleA100" : "#B388FF" , "IndigoA100" : "#8C9EFF" , "BlueA100" : "#82B1FF" , 52 | "DeepPurpleA200" : "#7C4DFF" , "IndigoA200" : "#536DFE" , "BlueA200" : "#448AFF" , 53 | "DeepPurpleA400" : "#651FFF" , "IndigoA400" : "#3D5AFE" , "BlueA400" : "#2979FF" , 54 | "DeepPurpleA700" : "#6200EA" , "IndigoA700" : "#304FFE" , "BlueA700" : "#2962FF" , 55 | // LightBlue // Cyan // Teal 56 | "LightBlue050" : "#E1F5FE" , "Cyan050" : "#E0F7FA" , "Teal050" : "#E0F2F1" , 57 | "LightBlue100" : "#B3E5FC" , "Cyan100" : "#B2EBF2" , "Teal100" : "#B2DFDB" , 58 | "LightBlue200" : "#81D4FA" , "Cyan200" : "#80DEEA" , "Teal200" : "#80CBC4" , 59 | "LightBlue300" : "#4FC3F7" , "Cyan300" : "#4DD0E1" , "Teal300" : "#4DB6AC" , 60 | "LightBlue400" : "#29B6F6" , "Cyan400" : "#26C6DA" , "Teal400" : "#26A69A" , 61 | "LightBlue500" : "#03A9F4" , "Cyan500" : "#00BCD4" , "Teal500" : "#009688" , 62 | "LightBlue600" : "#039BE5" , "Cyan600" : "#00ACC1" , "Teal600" : "#00897B" , 63 | "LightBlue700" : "#0288D1" , "Cyan700" : "#0097A7" , "Teal700" : "#00796B" , 64 | "LightBlue800" : "#0277BD" , "Cyan800" : "#00838F" , "Teal800" : "#00695C" , 65 | "LightBlue900" : "#01579B" , "Cyan900" : "#006064" , "Teal900" : "#004D40" , 66 | "LightBlueA100" : "#80D8FF" , "CyanA100" : "#84FFFF" , "TealA100" : "#A7FFEB" , 67 | "LightBlueA200" : "#40C4FF" , "CyanA200" : "#18FFFF" , "TealA200" : "#64FFDA" , 68 | "LightBlueA400" : "#00B0FF" , "CyanA400" : "#00E5FF" , "TealA400" : "#1DE9B6" , 69 | "LightBlueA700" : "#0091EA" , "CyanA700" : "#00B8D4" , "TealA700" : "#00BFA5" , 70 | // Green // LightGreen // Lime 71 | "Green050" : "#E8F5E9" , "LightGreen050" : "#F1F8E9" , "Lime050" : "#F9FBE7" , 72 | "Green100" : "#C8E6C9" , "LightGreen100" : "#DCEDC8" , "Lime100" : "#F0F4C3" , 73 | "Green200" : "#A5D6A7" , "LightGreen200" : "#C5E1A5" , "Lime200" : "#E6EE9C" , 74 | "Green300" : "#81C784" , "LightGreen300" : "#AED581" , "Lime300" : "#DCE775" , 75 | "Green400" : "#66BB6A" , "LightGreen400" : "#9CCC65" , "Lime400" : "#D4E157" , 76 | "Green500" : "#4CAF50" , "LightGreen500" : "#8BC34A" , "Lime500" : "#CDDC39" , 77 | "Green600" : "#43A047" , "LightGreen600" : "#7CB342" , "Lime600" : "#C0CA33" , 78 | "Green700" : "#388E3C" , "LightGreen700" : "#689F38" , "Lime700" : "#AFB42B" , 79 | "Green800" : "#2E7D32" , "LightGreen800" : "#558B2F" , "Lime800" : "#9E9D24" , 80 | "Green900" : "#1B5E20" , "LightGreen900" : "#33691E" , "Lime900" : "#827717" , 81 | "GreenA100" : "#B9F6CA" , "LightGreenA100" : "#CCFF90" , "LimeA100" : "#F4FF81" , 82 | "GreenA200" : "#69F0AE" , "LightGreenA200" : "#B2FF59" , "LimeA200" : "#EEFF41" , 83 | "GreenA400" : "#00E676" , "LightGreenA400" : "#76FF03" , "LimeA400" : "#C6FF00" , 84 | "GreenA700" : "#00C853" , "LightGreenA700" : "#64DD17" , "LimeA700" : "#AEEA00" , 85 | // Yellow // Amber // Orange 86 | "Yellow050" : "#FFFDE7" , "Amber050" : "#FFF8E1" , "Orange050" : "#FFF3E0" , 87 | "Yellow100" : "#FFF9C4" , "Amber100" : "#FFECB3" , "Orange100" : "#FFE0B2" , 88 | "Yellow200" : "#FFF59D" , "Amber200" : "#FFE082" , "Orange200" : "#FFCC80" , 89 | "Yellow300" : "#FFF176" , "Amber300" : "#FFD54F" , "Orange300" : "#FFB74D" , 90 | "Yellow400" : "#FFEE58" , "Amber400" : "#FFCA28" , "Orange400" : "#FFA726" , 91 | "Yellow500" : "#FFEB3B" , "Amber500" : "#FFC107" , "Orange500" : "#FF9800" , 92 | "Yellow600" : "#FDD835" , "Amber600" : "#FFB300" , "Orange600" : "#FB8C00" , 93 | "Yellow700" : "#FBC02D" , "Amber700" : "#FFA000" , "Orange700" : "#F57C00" , 94 | "Yellow800" : "#F9A825" , "Amber800" : "#FF8F00" , "Orange800" : "#EF6C00" , 95 | "Yellow900" : "#F57F17" , "Amber900" : "#FF6F00" , "Orange900" : "#E65100" , 96 | "YellowA100" : "#FFFF8D" , "AmberA100" : "#FFE57F" , "OrangeA100" : "#FFD180" , 97 | "YellowA200" : "#FFFF00" , "AmberA200" : "#FFD740" , "OrangeA200" : "#FFAB40" , 98 | "YellowA400" : "#FFEA00" , "AmberA400" : "#FFC400" , "OrangeA400" : "#FF9100" , 99 | "YellowA700" : "#FFD600" , "AmberA700" : "#FFAB00" , "OrangeA700" : "#FF6D00" , 100 | // DeepOrange 101 | "DeepOrange050" : "#FBE9E7" , 102 | "DeepOrange100" : "#FFCCBC" , 103 | "DeepOrange200" : "#FFAB91" , 104 | "DeepOrange300" : "#FF8A65" , 105 | "DeepOrange400" : "#FF7043" , 106 | "DeepOrange500" : "#FF5722" , 107 | "DeepOrange600" : "#F4511E" , 108 | "DeepOrange700" : "#E64A19" , 109 | "DeepOrange800" : "#D84315" , 110 | "DeepOrange900" : "#BF360C" , 111 | "DeepOrangeA100" : "#FF9E80" , 112 | "DeepOrangeA200" : "#FF6E40" , 113 | "DeepOrangeA400" : "#FF3D00" , 114 | "DeepOrangeA700" : "#DD2C00" , 115 | // Brown // Grey // BlueGrey 116 | "Brown050" : "#EFEBE9" , "Grey050" : "#FAFAFA" , "BlueGrey050" : "#ECEFF1" , 117 | "Brown100" : "#D7CCC8" , "Grey100" : "#F5F5F5" , "BlueGrey100" : "#CFD8DC" , 118 | "Brown200" : "#BCAAA4" , "Grey200" : "#EEEEEE" , "BlueGrey200" : "#B0BEC5" , 119 | "Brown300" : "#A1887F" , "Grey300" : "#E0E0E0" , "BlueGrey300" : "#90A4AE" , 120 | "Brown400" : "#8D6E63" , "Grey400" : "#BDBDBD" , "BlueGrey400" : "#78909C" , 121 | "Brown500" : "#795548" , "Grey500" : "#9E9E9E" , "BlueGrey500" : "#607D8B" , 122 | "Brown600" : "#6D4C41" , "Grey600" : "#757575" , "BlueGrey600" : "#546E7A" , 123 | "Brown700" : "#5D4037" , "Grey700" : "#616161" , "BlueGrey700" : "#455A64" , 124 | "Brown800" : "#4E342E" , "Grey800" : "#424242" , "BlueGrey800" : "#37474F" , 125 | "Brown900" : "#3E2723" , "Grey900" : "#212121" , "BlueGrey900" : "#263238" , 126 | // aliases 127 | "Red" : "var(Red500)" , 128 | "Pink" : "var(Pink500)" , 129 | "Purple" : "var(Purple500)" , 130 | "DeepPurple" : "var(DeepPurple500)" , 131 | "Indigo" : "var(Indigo500)" , 132 | "Blue" : "var(Blue500)" , 133 | "LightBlue" : "var(LightBlue500)" , 134 | "Cyan" : "var(Cyan500)" , 135 | "Teal" : "var(Teal500)" , 136 | "Green" : "var(Green500)" , 137 | "LightGreen" : "var(LightGreen500)" , 138 | "Lime" : "var(Lime500)" , 139 | "Yellow" : "var(Yellow500)" , 140 | "Amber" : "var(Amber500)" , 141 | "Orange" : "var(Orange500)" , 142 | "DeepOrange" : "var(DeepOrange500)" , 143 | "Brown" : "var(Brown500)" , 144 | "Grey" : "var(Grey500)" , 145 | "BlueGrey" : "var(BlueGrey500)" , 146 | }, 147 | "globals": { 148 | "active_guide": "color(White alpha(0.2))", 149 | "background": "var(Black)", 150 | "bracket_contents_foreground": "var(LightBlue300)", 151 | "bracket_contents_options": "underline", 152 | "brackets_foreground": "var(LightBlue300)", 153 | "brackets_options": "underline", 154 | "caret": "var(White)", 155 | "find_highlight": "var(YellowSaturated)", 156 | "find_highlight_foreground": "var(BlackLight)", 157 | "foreground": "var(White)", 158 | "guide": "color(White alpha(0.2))", 159 | "gutter": "var(BlackLight)", 160 | "gutter_foreground": "color(White blend(color(Black) 40%))", 161 | "highlight": "var(White)", 162 | "implicit_selection_foreground": "true", 163 | "inactive_selection": "color(White alpha(0.2))", 164 | "invisibles": "color(White blend(color(Black) 25%))", 165 | "line_highlight": "color(White blend(color(Black) 15%))", 166 | "misspelling": "var(Pink300)", 167 | "phantom_css": "html { color: var(--foreground); --yellowish: #FFC966; --background: #262626; --bluish: #75ADE6; --foreground: #E8E8E8; --greenish: #A9D274; --redish: #FF6673; --orangish: #FC9569; background-color: transparent; --purplish: #BF94E6; } a { color: var(--bluish); } #inline-error .error a { color: var(--foreground); background-color: color(var(--redish) blend(var(--background) 30%)); font-size: 1.1rem; font-weight: normal; } #inline-error .error-arrow { border-left-color: color(var(--redish) blend(var(--background) 30%)); } #inline-error .error { background-color: color(var(--redish) blend(var(--background) 30%)); }", 168 | "popup_css": "html { color: var(--foreground); --yellowish: #FFC966; --background: #262626; --bluish: #75ADE6; --foreground: #E8E8E8; --greenish: #A9D274; --redish: #FF6673; --orangish: #FC9569; background-color: color(var(--background) blend(#FFF 95%)); --purplish: #BF94E6; } a { color: var(--bluish); } html.light { background-color: color(var(--background) blend(#000 95%)); } #show-scope a { font-size: 1rem; } #show-scope { padding: 0.5rem; }", 169 | "selection": "color(White alpha(0.15))", 170 | "selection_border": "var(CyanSaturated)", 171 | "selection_foreground": "var(White)", 172 | "selection_corner_style": "square", 173 | "selection_corner_radius": "0", 174 | "shadow": "color(Black alpha(0.2))", 175 | "shadow_width": "8", 176 | "stack_guide": "color(White alpha(0.2))", 177 | "tags_foreground": "var(LightGreen300)", 178 | "tags_options": "stippled_underline", 179 | }, 180 | "rules": [ 181 | // hash style syntax highlight 182 | /* 183 | { 184 | "scope": "source - comment - string - keyword - punctuation - storage - entity - source.css", 185 | "foreground": ["var(BlueSaturated)", "var(GreenSaturated)", "var(RedSaturated)"], 186 | }, 187 | */ 188 | { 189 | "foreground": "var(Grey700)", 190 | "name": "Comment", 191 | "scope": "comment", 192 | "selection_foreground": "var(Grey600)", 193 | }, 194 | { 195 | "foreground": "var(AmberA100)", 196 | "name": "String", 197 | "scope": "string", 198 | }, 199 | { 200 | "foreground": "var(White)", 201 | "name": "Embedded", 202 | "scope": "meta.embedded", 203 | }, 204 | { 205 | "foreground": "var(White)", 206 | "name": "Reset Color", 207 | "scope": "meta.reset.color", 208 | }, 209 | { 210 | "foreground": "var(DeepPurple300)", 211 | "name": "Number", 212 | "scope": "constant.numeric", 213 | }, 214 | { 215 | "foreground": "var(DeepPurple300)", 216 | "name": "Built-in constant", 217 | "scope": "constant.language", 218 | }, 219 | { 220 | "foreground": "var(DeepPurple300)", 221 | "name": "User-defined constant", 222 | "scope": "constant.character, constant.other", 223 | }, 224 | { 225 | "font_style": "bold", 226 | "name": "Variable", 227 | "scope": "variable", 228 | }, 229 | { 230 | "font_style": "bold", 231 | "foreground": "var(Pink)", 232 | "name": "Keyword", 233 | "scope": "keyword", 234 | }, 235 | { 236 | "font_style": "bold", 237 | "foreground": "var(Pink)", 238 | "name": "Storage", 239 | "scope": "storage", 240 | }, 241 | { 242 | "font_style": "italic", 243 | "foreground": "var(Blue)", 244 | "name": "Storage type", 245 | "scope": "storage.type", 246 | }, 247 | { 248 | "font_style": "underline", 249 | "foreground": "var(White)", 250 | "name": "Class name", 251 | "scope": "entity.name.class", 252 | }, 253 | { 254 | "font_style": "italic underline", 255 | "foreground": "var(White)", 256 | "name": "Inherited class", 257 | "scope": "entity.other.inherited-class", 258 | }, 259 | { 260 | "font_style": "bold", 261 | "foreground": "var(Green)", 262 | "name": "Function name", 263 | "scope": "entity.name.function", 264 | }, 265 | { 266 | "font_style": "italic", 267 | "foreground": "var(Orange)", 268 | "name": "Function argument", 269 | "scope": "variable.parameter", 270 | }, 271 | { 272 | "font_style": "bold", 273 | "foreground": "var(Pink)", 274 | "name": "Tag name", 275 | "scope": "entity.name.tag", 276 | }, 277 | { 278 | "font_style": "bold", 279 | "foreground": "var(Green)", 280 | "name": "Tag attribute", 281 | "scope": "entity.other.attribute-name", 282 | }, 283 | { 284 | "font_style": "bold", 285 | "foreground": "var(Green)", 286 | "name": "Library function", 287 | "scope": "support.function", 288 | }, 289 | { 290 | "font_style": "bold", 291 | "foreground": "var(Green)", 292 | "name": "Function Name", 293 | "scope": "variable.function", 294 | }, 295 | { 296 | "font_style": "bold", 297 | "foreground": "var(Blue)", 298 | "name": "Library constant", 299 | "scope": "support.constant", 300 | }, 301 | { 302 | "font_style": "italic", 303 | "foreground": "var(Blue)", 304 | "name": "Library class/type", 305 | "scope": "support.type, support.class", 306 | }, 307 | { 308 | "font_style": "bold", 309 | "name": "Library variable", 310 | "scope": "support.other.variable", 311 | }, 312 | { 313 | "background": "var(Pink)", 314 | "font_style": "bold", 315 | "foreground": "var(White)", 316 | "name": "Invalid", 317 | "scope": "invalid", 318 | }, 319 | { 320 | "background": "var(DeepPurple300)", 321 | "foreground": "var(White)", 322 | "name": "Invalid deprecated", 323 | "scope": "invalid.deprecated", 324 | }, 325 | { 326 | "background": "var(Indigo900)", 327 | "foreground": "var(Orange)", 328 | "name": "meta.preprocessor", 329 | "scope": "meta.preprocessor", 330 | }, 331 | { 332 | "foreground": "var(AmberA100)", 333 | "name": "entity.name.type.include", 334 | "scope": "entity.name.type.include", 335 | }, 336 | { 337 | "foreground": "var(Orange)", 338 | "name": "Escaped Character", 339 | "scope": "constant.character.escape", 340 | }, 341 | { 342 | "foreground": "var(Pink)", 343 | "name": "Access Operator", 344 | "scope": "punctuation.accessor, punctuation.accessor", 345 | }, 346 | ///////////////// 347 | // other langs // 348 | ///////////////// 349 | { 350 | "font_style": "bold", 351 | "foreground": "var(DeepPurple300)", 352 | "name": "Tcl - variable", 353 | "scope": "variable.other.tcl", 354 | }, 355 | { 356 | "font_style": "bold", 357 | "foreground": "var(Green)", 358 | "name": "Python - function names", 359 | "scope": "meta.function-call.generic.python", 360 | }, 361 | { 362 | "font_style": "bold italic", 363 | "foreground": "var(Orange)", 364 | "name": "Perl - Variable in double quotes", 365 | "scope": "string.quoted.double.perl variable.other.readwrite.global.perl", 366 | }, 367 | { 368 | "font_style": "bold italic", 369 | "foreground": "var(Orange)", 370 | "name": "SCSS - Variable in double quotes", 371 | "scope": "variable.scss", 372 | }, 373 | { 374 | "font_style": "bold", 375 | "foreground": "var(Orange)", 376 | "name": "HTML - other tags", 377 | "scope": "entity.name.tag.other.html", 378 | }, 379 | { 380 | "font_style": "bold", 381 | "foreground": "var(Pink)", 382 | "name": "Sublime Settings - JSON key", 383 | "scope": "meta.mapping.key.json string.quoted.double.json", 384 | }, 385 | ////////////// 386 | // markdown // 387 | ////////////// 388 | { 389 | "font_style": "bold", 390 | "foreground": "var(Pink300)", 391 | "name": "Markdown - heading - punctuation", 392 | "scope": "punctuation.definition.heading.setext.markdown, punctuation.definition.heading.begin.markdown", 393 | }, 394 | { 395 | "font_style": "bold", 396 | "foreground": "var(Red)", 397 | "name": "Markdown - list - punctuation", 398 | "scope": "markup.list.numbered.bullet.markdown, punctuation.definition.list_item.markdown", 399 | }, 400 | { 401 | "foreground": "var(Amber100)", 402 | "name": "Markdown - list - paragraph", 403 | "scope": "meta.paragraph.list.markdown", 404 | }, 405 | { 406 | "foreground": "var(Blue)", 407 | "name": "Markdown - link - description", 408 | "scope": "meta.link.inline.description.markdown", 409 | }, 410 | { 411 | "foreground": "var(Teal300)", 412 | "name": "Markdown - image - description", 413 | "scope": "meta.image.inline.description.markdown", 414 | }, 415 | { 416 | "foreground": "var(Lime900)", 417 | "name": "Markdown - link - herf", 418 | "scope": "markup.underline.link.markdown, markup.underline.link.image.markdown, markup.underline.link.markdown-gfm", 419 | }, 420 | { 421 | "font_style": "bold", 422 | "foreground": "var(Grey500)", 423 | "name": "Markdown - link/image - punctuation", 424 | "scope": "punctuation.definition.image.begin.markdown, punctuation.definition.image.end.markdown, punctuation.definition.link.begin.markdown, punctuation.definition.link.end.markdown, punctuation.definition.metadata.begin.markdown, punctuation.definition.metadata.end.markdown", 425 | }, 426 | { 427 | "foreground": "var(Green)", 428 | "name": "Markdown - inline", 429 | "scope": "markup.raw.inline.markdown", 430 | }, 431 | { 432 | "font_style": "bold", 433 | "foreground": "var(Green)", 434 | "name": "Markdown - bold", 435 | "scope": "markup.bold.markdown", 436 | }, 437 | { 438 | "font_style": "italic", 439 | "foreground": "var(Green)", 440 | "name": "Markdown - italic", 441 | "scope": "markup.italic.markdown", 442 | }, 443 | { 444 | "background": "color(White alpha(0.08))", 445 | "name": "Markdown - code-fence", 446 | "scope": "markup.raw.code-fence.markdown-gfm", 447 | }, 448 | { 449 | "font_style": "bold", 450 | "foreground": "var(Red)", 451 | "name": "Markdown - table separator", 452 | "scope": "punctuation.separator.table-cell.markdown, punctuation.section.table-header.markdown", 453 | }, 454 | ///////// 455 | // c++ // 456 | ///////// 457 | { 458 | "foreground": "var(Green)", 459 | "name": "C/C++ - Function/Method Name", 460 | "scope": "variable.function.c, variable.function.c++, variable.function.member.c++", 461 | }, 462 | { 463 | "foreground": "var(White)", 464 | "name": "C/C++ - ()", 465 | "scope": "punctuation.definition.parameters.c, punctuation.definition.parameters.c++", 466 | }, 467 | { 468 | "font_style": "bold italic", 469 | "foreground": "var(Blue)", 470 | "name": "C++ - typedef type", 471 | "scope": "entity.name.type.typedef.c++", 472 | }, 473 | ///////// 474 | // php // 475 | ///////// 476 | { 477 | "font_style": "bold", 478 | "foreground": "var(Pink300)", 479 | "name": "PHP - PHPUnit annotations", 480 | "scope": "keyword.other.phpunit.php", 481 | }, 482 | { 483 | "foreground": "var(Pink)", 484 | "name": "PHP - Function Return Type Separator", 485 | "scope": "meta.function.return-type.php punctuation.separator.php", 486 | }, 487 | { 488 | "font_style": "bold", 489 | "foreground": "var(Orange)", 490 | "name": "PHP - Variable in double quotes", 491 | "scope": "string.quoted.double.php variable.language.php, string.quoted.double.php variable.other.global.php, string.quoted.double.php variable.other.global.safer.php, string.quoted.double.php variable.other.php, string.quoted.double.php variable.other.property.php, string.quoted.double.php variable.other.member.php, string.regexp.double-quoted.php variable.language.php, string.regexp.double-quoted.php variable.other.global.php, string.regexp.double-quoted.php variable.other.global.safer.php, string.regexp.double-quoted.php variable.other.php, string.regexp.double-quoted.php variable.other.property.php, string.regexp.double-quoted.php variable.other.member.php, string.unquoted.heredoc.php variable.language.php, string.unquoted.heredoc.php variable.other.global.php, string.unquoted.heredoc.php variable.other.global.safer.php, string.unquoted.heredoc.php variable.other.php, string.unquoted.heredoc.php variable.other.property.php, string.unquoted.heredoc.php variable.other.member.php", 492 | }, 493 | { 494 | "font_style": "bold", 495 | "name": "PHP - Internal Variables ($this, self, static)", 496 | "scope": "variable.language.php", 497 | }, 498 | { 499 | "font_style": "bold italic", 500 | "foreground": "var(DeepPurple300)", 501 | "name": "PHP - Constants", 502 | "scope": "constant.language.boolean.php, constant.language.null.php", 503 | }, 504 | { 505 | "font_style": "bold", 506 | "foreground": "var(Green)", 507 | "name": "PHP - RegExp - group names", 508 | "scope": "entity.name.other.group.regexp, punctuation.definition.group.capture.begin.regexp, punctuation.definition.group.capture.end.regexp", 509 | }, 510 | { 511 | "font_style": "bold", 512 | "foreground": "var(Pink)", 513 | "name": "PHP - RegExp - keyword punctuations", 514 | "scope": "punctuation.definition.group.begin.regexp, punctuation.definition.group.end.regexp, punctuation.definition.character-class.begin.regexp, punctuation.definition.character-class.end.regexp", 515 | }, 516 | /////////// 517 | // shell // 518 | /////////// 519 | { 520 | "font_style": "bold", 521 | "foreground": "var(DeepPurple300)", 522 | "name": "Shell - variable", 523 | "scope": "variable.other.normal.shell, variable.other.positional.shell, variable.other.bracket.shell, variable.other.special.shell, variable.other.loop.shell, variable.other.c-style.shell, variable.other.positional.shell, variable.other.readwrite.shell", 524 | }, 525 | { 526 | "font_style": "bold", 527 | "foreground": "var(DeepPurple300)", 528 | "name": "Shell - bracket variable in meta.reset.color", 529 | "scope": "meta.reset.color variable.other.bracket.shell, meta.reset.color variable.other.bracket.shell variable.other.bracket.shell, meta.reset.color variable.other.bracket.shell variable.other.bracket.shell variable.other.bracket.shell", 530 | }, 531 | { 532 | "foreground": "var(Cyan200)", 533 | "name": "Shell - true", 534 | "scope": "variable.other.true.shell", 535 | }, 536 | { 537 | "foreground": "var(Pink200)", 538 | "name": "Shell - false", 539 | "scope": "variable.other.false.shell", 540 | }, 541 | { 542 | "font_style": "bold", 543 | "foreground": "var(RedSaturated)", 544 | "name": "Shell - privilege command", 545 | "scope": "support.function.privilege.shell", 546 | }, 547 | { 548 | "font_style": "bold", 549 | "foreground": "var(Blue400)", 550 | "name": "Shell - built-in command", 551 | "scope": "support.function.builtin.shell, meta.function-call.shell support.function", 552 | }, 553 | { 554 | "font_style": "bold", 555 | "foreground": "var(Blue700)", 556 | "name": "Shell - external command", 557 | "scope": "support.function.external.shell, meta.function-call.shell variable.function", 558 | }, 559 | { 560 | "font_style": "bold", 561 | "foreground": "var(DeepPurple300)", 562 | "name": "Shell - punctuation variable", 563 | "scope": "punctuation.definition.variable.shell", 564 | }, 565 | { 566 | "font_style": "bold", 567 | "foreground": "var(AmberA100)", 568 | "name": "Shell - punctuation definition", 569 | "scope": "punctuation.definition.string", 570 | }, 571 | { 572 | "font_style": "bold", 573 | "foreground": "var(Pink)", 574 | "name": "Shell - pipe-sign/parentheses in `case`", 575 | "scope": "punctuation.separator.pipe-sign.shell, punctuation.definition.case-pattern.shell", 576 | }, 577 | { 578 | "font_style": "bold", 579 | "foreground": "var(Pink)", 580 | "name": "Shell - `;;` in `case`", 581 | "scope": "punctuation.terminator.case-clause.shell", 582 | }, 583 | { 584 | "font_style": "bold", 585 | "foreground": "var(Pink)", 586 | "name": "Shell - ${!varprefix>*<}", 587 | "scope": "variable.language.shell", 588 | }, 589 | { 590 | "font_style": "bold", 591 | "foreground": "var(Pink)", 592 | "name": "Shell - ${foo/>/<bar/baz}", 593 | "scope": "variable.parameter.switch.shell", 594 | }, 595 | { 596 | "font_style": "bold italic", 597 | "name": "Shell - command switch", 598 | "scope": "support.command-switch.shell", 599 | }, 600 | { 601 | "font_style": "bold", 602 | "foreground": "var(White)", 603 | "name": "Shell - meta", 604 | "scope": "meta.group.expansion.parameter.shell", 605 | }, 606 | { 607 | "font_style": "bold", 608 | "foreground": "var(White)", 609 | "name": "Shell - test punctuation", 610 | "scope": "support.function.test, support.function.double-brace", 611 | }, 612 | { 613 | "font_style": "bold", 614 | "foreground": "var(DeepPurple300)", 615 | "name": "Shell - variable punctuation", 616 | "scope": "punctuation.definition.variable.shell, meta.group.expansion punctuation.section, meta.group.arithmetic.shell, meta.group.expansion.arithmetic.shell", 617 | }, 618 | ////////// 619 | // diff // 620 | ////////// 621 | { 622 | "foreground": "var(White)", 623 | "name": "diff.header", 624 | "scope": "punctuation.definition.separator.diff", 625 | }, 626 | { 627 | "foreground": "var(Blue)", 628 | "name": "diff.header", 629 | "scope": "meta.diff, meta.diff.header", 630 | }, 631 | { 632 | "foreground": "var(Red)", 633 | "name": "diff.deleted", 634 | "scope": "markup.deleted, punctuation.definition.deleted.diff", 635 | }, 636 | { 637 | "foreground": "var(Green)", 638 | "name": "diff.inserted", 639 | "scope": "markup.inserted, punctuation.definition.inserted.diff", 640 | }, 641 | { 642 | "foreground": "var(Yellow)", 643 | "name": "diff.changed", 644 | "scope": "markup.changed, punctuation.definition.changed.diff", 645 | }, 646 | { 647 | "background": "var(Indigo900)", 648 | "font_style": "bold", 649 | "foreground": "var(Orange)", 650 | "scope": "meta.diff.header.from-file, punctuation.definition.from-file, meta.diff.header.to-file, punctuation.definition.to-file", 651 | }, 652 | //////////////////////// 653 | // brackethighlighter // 654 | //////////////////////// 655 | { 656 | "background": "#FFFFFF", 657 | "foreground": "#777777", 658 | "name": "Bracket Default", 659 | "scope": "brackethighlighter.default", 660 | }, 661 | { 662 | "background": "#66CC66", 663 | "foreground": "#993399", 664 | "name": "Bracket Tag", 665 | "scope": "brackethighlighter.tag", 666 | }, 667 | { 668 | "background": "#FFFFFF", 669 | "foreground": "#777777", 670 | "name": "Bracket C Define", 671 | "scope": "brackethighlighter.c_define", 672 | }, 673 | { 674 | "background": "#DDA0DD", 675 | "foreground": "#448F44", 676 | "name": "Bracket Curly", 677 | "scope": "brackethighlighter.curly", 678 | }, 679 | { 680 | "background": "#FFCC66", 681 | "foreground": "#0099CC", 682 | "name": "Bracket Round", 683 | "scope": "brackethighlighter.round", 684 | }, 685 | { 686 | "background": "#75ADE6", 687 | "foreground": "#A0522D", 688 | "name": "Bracket Square", 689 | "scope": "brackethighlighter.square", 690 | }, 691 | { 692 | "background": "#066EA8", 693 | "foreground": "#F99157", 694 | "name": "Bracket Angle", 695 | "scope": "brackethighlighter.angle", 696 | }, 697 | { 698 | "background": "#99CC99", 699 | "foreground": "#AA66AA", 700 | "name": "Bracket Quote", 701 | "scope": "brackethighlighter.quote", 702 | }, 703 | { 704 | "background": "#0D8885", 705 | "foreground": "#F2777A", 706 | "name": "Bracket Unmatched", 707 | "scope": "brackethighlighter.unmatched", 708 | }, 709 | /////////////////// 710 | // sublimelinter // 711 | /////////////////// 712 | { 713 | "foreground": "var(Red)", 714 | "name": "SublimeLinter Error", 715 | "scope": "sublimelinter.mark.error", 716 | }, 717 | { 718 | "foreground": "var(Yellow)", 719 | "name": "SublimeLinter Warning", 720 | "scope": "sublimelinter.mark.warning", 721 | }, 722 | { 723 | "foreground": "var(White)", 724 | "name": "SublimeLinter Gutter Mark", 725 | "scope": "sublimelinter.gutter-mark", 726 | }, 727 | ], 728 | } 729 | -------------------------------------------------------------------------------- /color_schemes/dark.tmTheme: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Monokai Soda Mod (jfcherng) 7 | settings 8 | 9 | 10 | settings 11 | 12 | implicitSelectionForeground 13 | true 14 | caret 15 | #ffffff 16 | gutter 17 | #111111 18 | gutterForeground 19 | #666666 20 | background 21 | #111111 22 | foreground 23 | #ffffff 24 | invisibles 25 | #333333 26 | lineHighlight 27 | #222222 28 | selection 29 | #ffffff30 30 | inactiveSelection 31 | #ffffff30 32 | selectionForeground 33 | #ffffff 34 | selectionBorder 35 | #fc9569 36 | findHighlight 37 | #ffff00 38 | findHighlightForeground 39 | #111111 40 | highlight 41 | #ffffff 42 | misspelling 43 | #ff6673 44 | popupCss 45 | html { color: var(--foreground); --yellowish: #ffc966; --background: #262626; --bluish: #75ade6; --foreground: #e8e8e8; --greenish: #a9d274; --redish: #ff6673; --orangish: #fc9569; background-color: color(var(--background) blend(#fff 95%)); --purplish: #bf94e6; } a { color: var(--bluish); } html.light { background-color: color(var(--background) blend(#000 95%)); } #show-scope a { font-size: 1rem; } #show-scope { padding: 0.5rem; } 46 | phantomCss 47 | html { color: var(--foreground); --yellowish: #ffc966; --background: #262626; --bluish: #75ade6; --foreground: #e8e8e8; --greenish: #a9d274; --redish: #ff6673; --orangish: #fc9569; background-color: transparent; --purplish: #bf94e6; } a { color: var(--bluish); } #inline-error .error a { color: var(--foreground); background-color: color(var(--redish) blend(var(--background) 30%)); font-size: 1.1rem; font-weight: normal; } #inline-error .error-arrow { border-left-color: color(var(--redish) blend(var(--background) 30%)); } #inline-error .error { background-color: color(var(--redish) blend(var(--background) 30%)); } 48 | guide 49 | #FFFFFF30 50 | activeGuide 51 | #FFFFFF30 52 | stackGuide 53 | #FFFFFF30 54 | bracketsOptions 55 | underline 56 | bracketsForeground 57 | #75ade6 58 | bracketContentsOptions 59 | underline 60 | bracketContentsForeground 61 | #75ade6 62 | tagsOptions 63 | stippled_underline 64 | tagsForeground 65 | #a9d274 66 | shadow 67 | #00000033 68 | shadowWidth 69 | 8 70 | 71 | 72 | 73 | name 74 | Comment 75 | scope 76 | comment 77 | settings 78 | 79 | foreground 80 | #555555 81 | selectionForeground 82 | #888 83 | 84 | 85 | 86 | name 87 | String 88 | scope 89 | string 90 | settings 91 | 92 | foreground 93 | #E6DB74 94 | 95 | 96 | 97 | 98 | name 99 | Embedded 100 | scope 101 | meta.embedded 102 | settings 103 | 104 | foreground 105 | #FFFFFF 106 | 107 | 108 | 109 | 110 | name 111 | Reset Color 112 | scope 113 | meta.reset.color 114 | settings 115 | 116 | foreground 117 | #FFFFFF 118 | 119 | 120 | 121 | name 122 | Number 123 | scope 124 | constant.numeric 125 | settings 126 | 127 | foreground 128 | #AE81FF 129 | 130 | 131 | 132 | name 133 | Built-in constant 134 | scope 135 | constant.language 136 | settings 137 | 138 | foreground 139 | #AE81FF 140 | 141 | 142 | 143 | name 144 | User-defined constant 145 | scope 146 | constant.character, constant.other 147 | settings 148 | 149 | foreground 150 | #AE81FF 151 | 152 | 153 | 154 | name 155 | Variable 156 | scope 157 | variable 158 | settings 159 | 160 | fontStyle 161 | bold 162 | 163 | 164 | 165 | name 166 | Keyword 167 | scope 168 | keyword 169 | settings 170 | 171 | fontStyle 172 | bold 173 | foreground 174 | #F92672 175 | 176 | 177 | 178 | name 179 | Storage 180 | scope 181 | storage 182 | settings 183 | 184 | fontStyle 185 | bold 186 | foreground 187 | #F92672 188 | 189 | 190 | 191 | name 192 | Storage type 193 | scope 194 | storage.type 195 | settings 196 | 197 | fontStyle 198 | italic 199 | foreground 200 | #50BEFF 201 | 202 | 203 | 204 | name 205 | Class name 206 | scope 207 | entity.name.class 208 | settings 209 | 210 | fontStyle 211 | underline 212 | foreground 213 | #FFFFFF 214 | 215 | 216 | 217 | name 218 | Inherited class 219 | scope 220 | entity.other.inherited-class 221 | settings 222 | 223 | fontStyle 224 | italic underline 225 | foreground 226 | #FFFFFF 227 | 228 | 229 | 230 | name 231 | Function name 232 | scope 233 | entity.name.function 234 | settings 235 | 236 | fontStyle 237 | bold 238 | foreground 239 | #A6E22E 240 | 241 | 242 | 243 | name 244 | Function argument 245 | scope 246 | variable.parameter 247 | settings 248 | 249 | fontStyle 250 | italic 251 | foreground 252 | #FD971F 253 | 254 | 255 | 256 | name 257 | Tag name 258 | scope 259 | entity.name.tag 260 | settings 261 | 262 | fontStyle 263 | bold 264 | foreground 265 | #F92672 266 | 267 | 268 | 269 | name 270 | Tag attribute 271 | scope 272 | entity.other.attribute-name 273 | settings 274 | 275 | fontStyle 276 | bold 277 | foreground 278 | #A6E22E 279 | 280 | 281 | 282 | name 283 | Library function 284 | scope 285 | support.function 286 | settings 287 | 288 | fontStyle 289 | bold 290 | foreground 291 | #A6E22E 292 | 293 | 294 | 295 | name 296 | Function Name 297 | scope 298 | variable.function 299 | settings 300 | 301 | fontStyle 302 | bold 303 | foreground 304 | #A6E22E 305 | 306 | 307 | 308 | name 309 | Library constant 310 | scope 311 | support.constant 312 | settings 313 | 314 | fontStyle 315 | bold 316 | foreground 317 | #50BEFF 318 | 319 | 320 | 321 | name 322 | Library class/type 323 | scope 324 | support.type, support.class 325 | settings 326 | 327 | fontStyle 328 | italic 329 | foreground 330 | #50BEFF 331 | 332 | 333 | 334 | name 335 | Library variable 336 | scope 337 | support.other.variable 338 | settings 339 | 340 | fontStyle 341 | bold 342 | 343 | 344 | 345 | name 346 | Invalid 347 | scope 348 | invalid 349 | settings 350 | 351 | foreground 352 | #FFFFFF 353 | background 354 | #F92672 355 | fontStyle 356 | bold 357 | 358 | 359 | 360 | name 361 | Invalid deprecated 362 | scope 363 | invalid.deprecated 364 | settings 365 | 366 | background 367 | #AE81FF 368 | foreground 369 | #FFFFFF 370 | 371 | 372 | 373 | name 374 | JSON String 375 | scope 376 | meta.structure.dictionary.json string.quoted.double.json 377 | settings 378 | 379 | foreground 380 | #CFCFC2 381 | 382 | 383 | 384 | name 385 | diff.header 386 | scope 387 | meta.diff, meta.diff.header 388 | settings 389 | 390 | foreground 391 | #75715E 392 | 393 | 394 | 395 | name 396 | diff.deleted 397 | scope 398 | markup.deleted, punctuation.definition.deleted.diff 399 | settings 400 | 401 | foreground 402 | #F92672 403 | 404 | 405 | 406 | name 407 | diff.inserted 408 | scope 409 | markup.inserted, punctuation.definition.inserted.diff 410 | settings 411 | 412 | foreground 413 | #A6E22E 414 | 415 | 416 | 417 | name 418 | diff.changed 419 | scope 420 | markup.changed, punctuation.definition.changed.diff 421 | settings 422 | 423 | foreground 424 | #E6DB74 425 | 426 | 427 | 428 | name 429 | Bracket Default 430 | scope 431 | brackethighlighter.default 432 | settings 433 | 434 | background 435 | #FFFFFF 436 | foreground 437 | #808080 438 | 439 | 440 | 441 | name 442 | Bracket Tag 443 | scope 444 | brackethighlighter.tag 445 | settings 446 | 447 | background 448 | #66CC66 449 | foreground 450 | #993399 451 | 452 | 453 | 454 | name 455 | Bracket C Define 456 | scope 457 | brackethighlighter.c_define 458 | settings 459 | 460 | background 461 | #FFFFFF 462 | foreground 463 | #808080 464 | 465 | 466 | 467 | name 468 | Bracket Curly 469 | scope 470 | brackethighlighter.curly 471 | settings 472 | 473 | background 474 | #dda0dd 475 | foreground 476 | #448F44 477 | 478 | 479 | 480 | name 481 | Bracket Round 482 | scope 483 | brackethighlighter.round 484 | settings 485 | 486 | background 487 | #FFCC66 488 | foreground 489 | #0099CC 490 | 491 | 492 | 493 | name 494 | Bracket Square 495 | scope 496 | brackethighlighter.square 497 | settings 498 | 499 | background 500 | #75ADE6 501 | foreground 502 | #A0522D 503 | 504 | 505 | 506 | name 507 | Bracket Angle 508 | scope 509 | brackethighlighter.angle 510 | settings 511 | 512 | background 513 | #066EA8 514 | foreground 515 | #F99157 516 | 517 | 518 | 519 | name 520 | Bracket Quote 521 | scope 522 | brackethighlighter.quote 523 | settings 524 | 525 | background 526 | #99CC99 527 | foreground 528 | #AA66AA 529 | 530 | 531 | 532 | name 533 | Bracket Unmatched 534 | scope 535 | brackethighlighter.unmatched 536 | settings 537 | 538 | background 539 | #0D8885 540 | foreground 541 | #F2777A 542 | 543 | 544 | 545 | name 546 | meta.preprocessor 547 | scope 548 | meta.preprocessor 549 | settings 550 | 551 | foreground 552 | #FD971F 553 | background 554 | #000080 555 | 556 | 557 | 558 | name 559 | entity.name.type.include 560 | scope 561 | entity.name.type.include 562 | settings 563 | 564 | foreground 565 | #E6DB74 566 | 567 | 568 | 569 | name 570 | SublimeLinter Error 571 | scope 572 | sublimelinter.mark.error 573 | settings 574 | 575 | foreground 576 | #D02000 577 | 578 | 579 | name 580 | SublimeLinter Warning 581 | scope 582 | sublimelinter.mark.warning 583 | settings 584 | 585 | foreground 586 | #DDB700 587 | 588 | 589 | name 590 | SublimeLinter Gutter Mark 591 | scope 592 | sublimelinter.gutter-mark 593 | settings 594 | 595 | foreground 596 | #FFFFFF 597 | 598 | 599 | 600 | name 601 | Escaped Character 602 | scope 603 | constant.character.escape 604 | settings 605 | 606 | foreground 607 | #FD971F 608 | 609 | 610 | 611 | name 612 | Access Operator 613 | scope 614 | punctuation.accessor, punctuation.accessor, punctuation.separator.dictionary.key-value.json 615 | settings 616 | 617 | foreground 618 | #F92672 619 | 620 | 621 | 622 | name 623 | Tcl - variable 624 | scope 625 | variable.other.tcl 626 | settings 627 | 628 | fontStyle 629 | bold 630 | foreground 631 | #AE81FF 632 | 633 | 634 | 635 | name 636 | Python - function names 637 | scope 638 | meta.function-call.generic.python 639 | settings 640 | 641 | fontStyle 642 | bold 643 | foreground 644 | #A6E22E 645 | 646 | 647 | 648 | name 649 | C/C++ - Function/Method Name 650 | scope 651 | variable.function.c, variable.function.c++, variable.function.member.c++ 652 | settings 653 | 654 | foreground 655 | #A6E22E 656 | 657 | 658 | 659 | name 660 | C/C++ - () 661 | scope 662 | punctuation.definition.parameters.c, punctuation.definition.parameters.c++ 663 | settings 664 | 665 | foreground 666 | #FFFFFF 667 | 668 | 669 | 670 | name 671 | C++ - typedef type 672 | scope 673 | entity.name.type.typedef.c++ 674 | settings 675 | 676 | fontStyle 677 | bold italic 678 | foreground 679 | #50BEFF 680 | 681 | 682 | 683 | name 684 | PHP - Function Return Type Separator 685 | scope 686 | meta.function.return-type.php punctuation.separator.php 687 | settings 688 | 689 | foreground 690 | #F92672 691 | 692 | 693 | 694 | name 695 | PHP - Variable in double quotes 696 | scope 697 | string.quoted.double.php variable.language.php, string.quoted.double.php variable.other.global.php, string.quoted.double.php variable.other.global.safer.php, string.quoted.double.php variable.other.php, string.quoted.double.php variable.other.property.php, string.quoted.double.php variable.other.member.php, string.regexp.double-quoted.php variable.language.php, string.regexp.double-quoted.php variable.other.global.php, string.regexp.double-quoted.php variable.other.global.safer.php, string.regexp.double-quoted.php variable.other.php, string.regexp.double-quoted.php variable.other.property.php, string.regexp.double-quoted.php variable.other.member.php, string.unquoted.heredoc.php variable.language.php, string.unquoted.heredoc.php variable.other.global.php, string.unquoted.heredoc.php variable.other.global.safer.php, string.unquoted.heredoc.php variable.other.php, string.unquoted.heredoc.php variable.other.property.php, string.unquoted.heredoc.php variable.other.member.php 698 | settings 699 | 700 | fontStyle 701 | bold 702 | foreground 703 | #FD971F 704 | 705 | 706 | 707 | name 708 | PHP - Internal Variables ($this, self, static) 709 | scope 710 | variable.language.php 711 | settings 712 | 713 | fontStyle 714 | bold 715 | 716 | 717 | 718 | name 719 | PHP - Constants 720 | scope 721 | constant.language.boolean.php, constant.language.null.php 722 | settings 723 | 724 | fontStyle 725 | bold italic 726 | foreground 727 | #AE81FF 728 | 729 | 730 | 731 | name 732 | Perl - Variable in double quotes 733 | scope 734 | string.quoted.double.perl variable.other.readwrite.global.perl 735 | settings 736 | 737 | fontStyle 738 | bold italic 739 | foreground 740 | #FD971F 741 | 742 | 743 | 744 | name 745 | SCSS - Variable in double quotes 746 | scope 747 | variable.scss 748 | settings 749 | 750 | fontStyle 751 | bold italic 752 | foreground 753 | #FD971F 754 | 755 | 756 | 757 | name 758 | HTML - other tags 759 | scope 760 | entity.name.tag.other.html 761 | settings 762 | 763 | fontStyle 764 | bold 765 | foreground 766 | #FD971F 767 | 768 | 769 | 770 | name 771 | Diff - filename 772 | scope 773 | meta.diff.header.from-file, punctuation.definition.from-file, meta.diff.header.to-file, punctuation.definition.to-file 774 | settings 775 | 776 | fontStyle 777 | bold 778 | foreground 779 | #FD971F 780 | background 781 | #000080 782 | 783 | 784 | 785 | name 786 | Markdown - inline 787 | scope 788 | markup.raw.inline.content.markdown 789 | settings 790 | 791 | fontStyle 792 | bold 793 | foreground 794 | #00FF00 795 | 796 | 797 | 798 | 799 | 800 | 801 | name 802 | Shell - variable 803 | scope 804 | variable.other.normal.shell, variable.other.positional.shell, variable.other.bracket.shell, variable.other.special.shell, variable.other.loop.shell, variable.other.c-style.shell,variable.other.positional.shell 805 | settings 806 | 807 | fontStyle 808 | bold 809 | foreground 810 | #AE81FF 811 | 812 | 813 | 814 | name 815 | Shell - bracket variable in meta.reset.color 816 | scope 817 | meta.reset.color variable.other.bracket.shell, meta.reset.color variable.other.bracket.shell variable.other.bracket.shell, meta.reset.color variable.other.bracket.shell variable.other.bracket.shell variable.other.bracket.shell 818 | settings 819 | 820 | fontStyle 821 | bold 822 | foreground 823 | #AE81FF 824 | 825 | 826 | 827 | name 828 | Shell - true 829 | scope 830 | variable.other.true.shell 831 | settings 832 | 833 | foreground 834 | #AAFFFF 835 | 836 | 837 | 838 | name 839 | Shell - false 840 | scope 841 | variable.other.false.shell 842 | settings 843 | 844 | foreground 845 | #FFAAFF 846 | 847 | 848 | 849 | name 850 | Shell - privilege command 851 | scope 852 | support.function.privilege.shell 853 | settings 854 | 855 | fontStyle 856 | bold 857 | foreground 858 | #FF0000 859 | 860 | 861 | 862 | name 863 | Shell - built-in command 864 | scope 865 | support.function.builtin.shell 866 | settings 867 | 868 | fontStyle 869 | bold 870 | foreground 871 | #50AAFF 872 | 873 | 874 | 875 | name 876 | Shell - external command 877 | scope 878 | support.function.external.shell 879 | settings 880 | 881 | fontStyle 882 | bold 883 | foreground 884 | #0684F4 885 | 886 | 887 | 888 | name 889 | Shell - punctuation variable 890 | scope 891 | punctuation.definition.variable.shell 892 | settings 893 | 894 | fontStyle 895 | bold 896 | foreground 897 | #AE81FF 898 | 899 | 900 | 901 | name 902 | Shell - punctuation definition 903 | scope 904 | punctuation.definition.string 905 | settings 906 | 907 | fontStyle 908 | bold 909 | foreground 910 | #E6DB74 911 | 912 | 913 | 914 | name 915 | Shell - pipe-sign/parentheses in "case" 916 | scope 917 | punctuation.separator.pipe-sign.shell, punctuation.definition.case-pattern.shell 918 | settings 919 | 920 | fontStyle 921 | bold 922 | foreground 923 | #F92672 924 | 925 | 926 | 927 | name 928 | Shell - ";;" in "case" 929 | scope 930 | punctuation.terminator.case-clause.shell 931 | settings 932 | 933 | fontStyle 934 | bold 935 | foreground 936 | #F92672 937 | 938 | 939 | 940 | name 941 | Shell - command switch 942 | scope 943 | support.command-switch.shell 944 | settings 945 | 946 | fontStyle 947 | bold italic 948 | 949 | 950 | 951 | 952 | 953 | 954 | name 955 | Shell - meta 956 | scope 957 | meta.group.expansion.parameter.shell 958 | settings 959 | 960 | fontStyle 961 | bold 962 | foreground 963 | #FFFFFF 964 | 965 | 966 | 967 | name 968 | Shell - test punctuation 969 | scope 970 | support.function.test, support.function.double-brace 971 | settings 972 | 973 | fontStyle 974 | bold 975 | foreground 976 | #FFFFFF 977 | 978 | 979 | 980 | name 981 | Shell - built-in command 982 | scope 983 | meta.function-call.shell support.function 984 | settings 985 | 986 | fontStyle 987 | bold 988 | foreground 989 | #50AAFF 990 | 991 | 992 | 993 | name 994 | Shell - external command 995 | scope 996 | meta.function-call.shell variable.function 997 | settings 998 | 999 | fontStyle 1000 | bold 1001 | foreground 1002 | #0684F4 1003 | 1004 | 1005 | 1006 | name 1007 | Shell - variable 1008 | scope 1009 | variable.other.readwrite.shell 1010 | settings 1011 | 1012 | fontStyle 1013 | bold 1014 | foreground 1015 | #AE81FF 1016 | 1017 | 1018 | 1019 | name 1020 | Shell - variable punctuation 1021 | scope 1022 | punctuation.definition.variable.shell, meta.group.expansion punctuation.section, meta.group.arithmetic.shell, meta.group.expansion.arithmetic.shell 1023 | settings 1024 | 1025 | fontStyle 1026 | bold 1027 | foreground 1028 | #AE81FF 1029 | 1030 | 1031 | 1032 | name 1033 | Shell - ${!varprefix>*<} 1034 | scope 1035 | variable.language.shell 1036 | settings 1037 | 1038 | fontStyle 1039 | bold 1040 | foreground 1041 | #F92672 1042 | 1043 | 1044 | 1045 | name 1046 | Shell - ${foo/>/<bar/baz} 1047 | scope 1048 | variable.parameter.switch.shell 1049 | settings 1050 | 1051 | fontStyle 1052 | bold 1053 | foreground 1054 | #F92672 1055 | 1056 | 1057 | 1058 | uuid 1059 | 5EAF4173-5DDE-4D64-A1E8-C1671C7EE339 1060 | 1061 | 1062 | -------------------------------------------------------------------------------- /menus/Main.sublime-menu: -------------------------------------------------------------------------------- 1 | [{ 2 | "id": "preferences", 3 | "children": [{ 4 | "caption": "Package Settings", 5 | "id": "package-settings", 6 | "children": [{ 7 | "caption": "ShellScript Improved", 8 | "children": [{ 9 | "caption": "-" 10 | }, { 11 | "caption": "README", 12 | "command": "open_file", 13 | "args": { 14 | "file": "${packages}/ShellScriptImproved/README.md" 15 | } 16 | }, { 17 | "caption": "Changelog", 18 | "command": "open_file", 19 | "args": { 20 | "file": "${packages}/ShellScriptImproved/CHANGELOG.md" 21 | } 22 | }, { 23 | "caption": "-" 24 | }, { 25 | "caption": "Open the demo file", 26 | "command": "open_file", 27 | "args": { 28 | "file": "${packages}/ShellScriptImproved/miscellaneous/demo.sh" 29 | } 30 | }, { 31 | "caption": "-" 32 | }] 33 | }] 34 | }] 35 | }] 36 | -------------------------------------------------------------------------------- /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "1.2.26": "messages/update_message.md", 3 | "install": "README.md" 4 | } 5 | -------------------------------------------------------------------------------- /messages/update_message.md: -------------------------------------------------------------------------------- 1 | ShellScript Improved has been updated. To see the changelog, visit 2 | Preferences » Package Settings » ShellScript Improved » Changelog 3 | -------------------------------------------------------------------------------- /miscellaneous/demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This file is a sort of test suite for bash syntax highlighting. It is not 4 | # intended to be parsed or run, just viewed in an editor. 5 | grep 'foo' <( bar "$( baz )" ) 6 | 7 | 8 | #################################################### 9 | # Strings and interpolation in parameter expansion # 10 | #################################################### 11 | 12 | # Strings appearing in expansion constructs should be treated as such. 13 | ${foo:-bar} # 'bar' is a literal string 14 | ${foo:='bar'} # "'bar'" is a literal string 15 | ${foo//bar/baz} # 'bar' and 'baz' are literal strings 16 | 17 | # Strings in expansion constructs should support interpolation. 18 | ${foo:=`bar`} # Command substitution should be recognized 19 | ${foo:=$( bar )} # Command substitution should be recognized 20 | ${foo:=$(( 1 + 1 ))} # Arithmetic substitution should be recognized 21 | ${foo:=$bar} # Variables should be recognized 22 | ${foo:="$bar"} # Variables should be recognized 23 | 24 | 25 | ################################# 26 | # Braces in parameter expansion # 27 | ################################# 28 | 29 | # The '\}' on the following line should be treated as a string literal (or 30 | # escape sequence); it should NOT terminate the expansion construct. 31 | ${foo//foo\}foo\/foo/foo} 32 | # The quoted part of the following line should be treated as a string, with the 33 | # '${bar}' part specifically being an interpolated variable. The closing '}' in 34 | # '${bar}' should NOT terminate the '${foo:=...}' expansion construct. 35 | ${foo:="${bar} baz"} 36 | 37 | # Sublime bug fix: " 38 | 39 | ${!varprefix*} 40 | ${!varprefix@} 41 | 42 | ${var#Pattern} 43 | ${var##Pattern} 44 | ${var###Pattern} 45 | ${var%Pattern} 46 | ${var%%Pattern} 47 | ${var%%%Pattern} 48 | 49 | 50 | #################################################################### 51 | # Parameter-expansion operators # 52 | # cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # 53 | #################################################################### 54 | 55 | # Parameter-expansion operators should be treated as such only where 56 | # appropriate. They should NOT be treated as unqualified operators anywhere they 57 | # appear in an expansion construct. 58 | ${foo//%/} # '%' is not an operator here 59 | ${foo//#/} # '#' is not an operator here 60 | ${foo//!/} # '!' is not an operator here 61 | ${foo//:/} # ':' is not an operator here 62 | ${foo//@/} # '@' is not an operator here 63 | 64 | # Expansion operators which can only appear before an identifier, such as '#' 65 | # and '!', should not be treated as expansion operators after an identifier. 66 | ${foo#} # duplicated with ${var#Pattern} where 'Pattern' is empty? 67 | ${foo!} # '!' is not a operator here indeed 68 | ${var:pos:len} 69 | 70 | # When using the replace operators ('/' and '//'), escaped and un-escaped 71 | # slashes in the needle and replacement strings should be handled correctly. 72 | # Slashes need be escaped only in the needle; escaping slashes in the 73 | # replacement is optional. 74 | ${foo//a\/b/c/d} 75 | # ^^ ^ These slashes are operators 76 | # ^ ^ These are not 77 | 78 | # The '^' and ',' expansion operators (and friends) should be treated as such, 79 | # where appropriate. 80 | ${foo^} # '^' is an operator (upper-case initial) 81 | ${foo,} # ',' is an operator (lower-case initial) 82 | ${foo^^} # '^^' is an operator (upper-case all) 83 | ${foo,,} # ',,' is an operator (lower-case all) 84 | 85 | ${foo,,,Pattern} 86 | ${foo,,Pattern} 87 | 88 | # The '-', '+', '=', and '?' expansion operators (and friends) should be treated 89 | # as such, where appropriate. 90 | ${foo-bar} # '-' is an operator (substitute if unset) 91 | ${foo:-bar} # ':-' is an operator (substitute if unset or null) 92 | ${foo+bar} # '+' is an operator (substitute if set) 93 | ${foo:+bar} # ':+' is an operator (substitute if set and not null) 94 | ${foo=bar} # '=' is an operator (set if not set) 95 | ${foo:=bar} # ':=' is an operator (set if not set or null) 96 | ${foo?bar} # '?' is an operator (abort if not set) 97 | ${foo:?bar} # ':=' is an operator (abort if not set or null) 98 | 99 | 100 | ################### 101 | # Misc. operators # 102 | ################### 103 | 104 | # The '=' in a variable assignment should be recognized as an assignment 105 | # operator. 106 | foo='bar' 107 | 108 | # The '=' in variable-related shell built-ins like 'export' should be recognized 109 | # as an assignment operator. 110 | export foo='bar' 111 | 112 | # Conditional operators in both double and single brackets should be recognized 113 | # as such. 114 | [ -n "${foo}" ] 115 | [[ -n "${foo}" ]] 116 | [ "${foo}" != 'bar' ] 117 | [[ "${foo}" != 'bar' ]] 118 | echo >> a 119 | 120 | anyprogram >>! fileb 121 | 122 | # this command actually prints: [[ != bar ]] 123 | # so '[[', '!=' and ']]' should be plain text 124 | echo [[ "${foo}" != 'bar' ]] 125 | 126 | echo ]] echo 127 | # ^^^^ this 'echo' is plain text 128 | 129 | # Semi-colons should be highlighted as operators in C-style loop constructs. 130 | foo; bar; baz 131 | 132 | 133 | #################### 134 | # Identifier names # 135 | #################### 136 | 137 | # The left side of a variable assignment should be recognized as a variable 138 | # name. 139 | foo='bar' 140 | 141 | # Variable names passed to variable-related shell built-ins like `declare`, 142 | # `export`, `local`, `readonly`, `typeset`, and `unset` should be treated as 143 | # such. (Note: What to do if they're quoted?) 144 | declare foo # 'foo' is a variable name 145 | declare -A foo bar # 'foo' and 'bar' are variable names 146 | export foo # 'foo' is a variable name 147 | export foo bar # 'foo' and 'bar' are variable names 148 | export foo='bar' # 'foo' is a variable name 149 | local foo bar # 'foo' and 'bar' are variable names 150 | local foo bar='baz' # 'foo' and 'bar' are variable names 151 | readonly foo # 'foo' is a variable name 152 | typeset foo # 'foo' is a variable name 153 | unset foo bar # 'foo' and 'bar' are variable names 154 | 155 | # The iteration variable name in a `for` loop should be treated as such. 156 | for i in "${foo[@]}"; do # 'i' is a variable name 157 | : 158 | done 159 | 160 | # Possibly the variable names passed to other shell built-ins known to support 161 | # them should be treated as such? (Note: What to do if they're quoted?) 162 | printf -v foo 'bar' # 'foo' is a variable name 163 | read -r foo bar baz # 'foo', 'bar', and 'baz' are variable names 164 | read -a foo # 'foo' is a variable name 165 | 166 | # Variable names in arithmetic and C-style loop constructs should be treated as 167 | # such. 168 | $(( foo + 2 )) # 'foo' is a variable name 169 | (( foo++ )) # 'foo' is a variable name 170 | 171 | for (( i = 0; i < RAND; i++ )); do # 'i' and 'RAND' are variable names 172 | : 173 | done 174 | 175 | 176 | ################################################ 177 | # Quoting, interpolation and nested constructs # 178 | ################################################ 179 | 180 | # Regular-expression patterns should be highlighted as regular expressions, or 181 | # at least strings. 182 | [[ $str =~ ^(bar|baz)[abc0-9]{1,2}$ ]] # this is a regex 183 | [[ $str =~ "^(bar|baz)[abc0-9]{1,2}$" ]] # this is a string!! 184 | [[ $str =~ $(echo $regex) ]] # interpolation 185 | [[ $str =~ $regex ]] # variable 186 | 187 | # The '<<-' heredoc operator should be recognized as such. 188 | : <<- EOF 189 | foo 190 | EOF 191 | 192 | # Heredoc bodies should be treated as interpolated strings. 193 | : << EOF 194 | $variable 195 | foo bar $( baz ) 196 | EOF 197 | 198 | # Bodies of heredocs in which the delimiter is single-quoted should be treated 199 | # as literal strings (no interpolation). 200 | : << 'EOF' 201 | $variable 202 | foo bar $( baz ) 203 | EOF 204 | 205 | # Redirection can be used right after heredoc 206 | cat << EOF > /tmp/yourfilehere 207 | $variable 208 | These contents will be written to the file. 209 | This line is indented. 210 | EOF 211 | 212 | 213 | ################################ 214 | # Heredoc with compact-command # 215 | ################################ 216 | 217 | print_info_text_compact () { cat <filename 263 | # Redirect and append stdout to file "filename." 264 | 1>>filename 265 | # Redirect both stdout and stderr to file "filename." 266 | # This operator is now functional, as of Bash 4, final release. 267 | &>filename 268 | # Redirects stderr to stdout. 269 | 2>&1 270 | # Close stdin. 271 | 0<&- 272 | <&- 273 | 274 | 275 | ############ 276 | # Subshell # 277 | ############ 278 | 279 | # Substitution constructs inside double-quotes should be recognized as such. 280 | "$( foo )" # $( foo ) should be interpolated 281 | "` foo `" # ` foo ` should be interpolated 282 | "$(( foo++ ))" # $(( foo++ )) should be interpolated 283 | 284 | # Substitution constructs should support nesting. 285 | $( foo $( bar $( baz ) ) ) 286 | $( foo ` bar ` ) 287 | $( foo "$(( bar + 1 ))" ) 288 | foo="$( bar "$( baz "$( qux )" )" )" 289 | $(( ( RANDOM * 100 ) / 5 )) 290 | $(( a=(2*(250+1))/5 )) 291 | 292 | 293 | ######### 294 | # Array # 295 | ######### 296 | 297 | # single line array 298 | OPTS+=(--prefix=$PREFIX) 299 | 300 | # multiline array 301 | declare -A ERROR_MESSAGES=( 302 | [no msg]='' 303 | [unknown]='Unknown error happened.' 304 | [no util]="‘$util’ is required but wasn’t found on this system." 305 | ) 306 | 307 | 308 | ################# 309 | # controversial # 310 | ################# 311 | 312 | empty=$((echo hello) > output.txt) 313 | # Sublime bug fix: )) 314 | empty=$( (echo hello) > output.txt) 315 | 316 | grep 'foo' <( bar "$( baz )" ) 317 | 318 | 319 | #################### 320 | # Command Switches # 321 | #################### 322 | 323 | echo -e Hello 324 | gcc input.c -o output.exe --verbose 325 | rm -f -- -filename_starts_with_dash 326 | 327 | ################## 328 | # Special Design # 329 | ################## 330 | 331 | # following "true" are scoped "variable.other.true.shell" 332 | var=true 333 | # following "false" are scoped "variable.other.false.shell" 334 | var=false; 335 | 336 | git --switch=true; 337 | git --switch=false 338 | 339 | sudo -s pip --upgrade install numpy 340 | 341 | ########################### 342 | # Misc. language features # 343 | ########################### 344 | 345 | # The `in` in a `case` statement should be highlighted as a control key word. 346 | case "${foo}" in 347 | ( help | h ) bar ;; 348 | do1 ) foo1 ;& 349 | do2 ) foo2 ;;& 350 | *) bar 351 | esac 352 | 353 | # `continue` and `break` should be highlighted as control key words. 354 | while :; do 355 | continue 356 | break 357 | done 358 | 359 | # Key words and names of built-ins should be treated as such only where 360 | # appropriate. It is NOT accurate to use patterns like '\bif\b'. 361 | if-up # 'if' is not a control key word here 362 | foo:if:bar # 'if' is not a control key word here 363 | func-while # 'while' is not a control key word here 364 | func_for # 'for' is not a control key word here 365 | func-for # 'for' is not a control key word here 366 | dd if=/dev/hda of=/dev/hdb # 'if' is not a control key word here 367 | 368 | # Test cases for shell grammar. 369 | rm -rf mkdir # 'mkdir' is not a control key word here 370 | echo do # 'do' is not a control key word here 371 | export cat # 'cat' is not an executable here 372 | export cat=1 # 'cat' is not an executable here 373 | export cat=$(git --version) # 'cat' is not an executable here 374 | cat=1 # 'cat' is not a executable here 375 | 376 | # Test cases for 'echo'. Things following 'echo' may be considered as strings. 377 | echo git rev-list "$(echo --all)" | grep -P 'c354a80' 378 | echo $(echo git --version) echo `$(echo git --version)` "$(echo git --version)" 379 | echo `echo git --version` 380 | echo echo $(git) "$(git)" `$(git)` `git` | grep -P 'c354a80' 381 | 382 | echo cat \ 383 | cat 384 | cat 385 | 386 | echo cat > cat \ 387 | cat 388 | cat 389 | 390 | echo `echo git --version` echo | grep -P 'c354a80' 391 | # ^^^^ this 'echo' should be a plain text 392 | 393 | rm -rf / 394 | -------------------------------------------------------------------------------- /syntax_test_shellscript.sh: -------------------------------------------------------------------------------- 1 | # SYNTAX TEST "Packages/ShellScriptImproved/Shell-Unix-Generic.sublime-syntax" 2 | 3 | 4 | ############# 5 | # Variables # 6 | ############# 7 | 8 | $_ 9 | #^ variable.other.special 10 | 11 | $__ 12 | #^^ variable.other.normal 13 | 14 | $var_0 15 | #^^^^^ variable.other.normal 16 | 17 | $_var0 18 | #^^^^^ variable.other.normal 19 | 20 | $_0var_ 21 | #^^^^^^ variable.other.normal 22 | 23 | ${foo}/${bar}/${exe} 24 | # ^^^ variable.other.bracket 25 | # ^^^ variable.other.bracket 26 | # ^^^ variable.other.bracket 27 | 28 | 29 | #################################################### 30 | # Strings and interpolation in parameter expansion # 31 | #################################################### 32 | 33 | ${foo:-bar} 34 | # <- punctuation.definition.variable 35 | # ^^ keyword.operator.substringreplacement 36 | # ^ punctuation.definition.variable 37 | 38 | ${foo:='bar'} 39 | # <- punctuation.definition.variable 40 | # ^^ keyword.operator.substringreplacement 41 | # ^ punctuation.definition.string.begin 42 | # ^^^^^ string.quoted.single 43 | # ^ punctuation.definition.string.end 44 | # ^ punctuation.definition.variable 45 | 46 | ${foo//bar/baz} 47 | # <- punctuation.definition.variable 48 | # ^^ keyword.operator.substringreplacement 49 | # ^ keyword.operator.substringreplacement 50 | # ^ punctuation.definition.variable 51 | 52 | ${foo:=`bar`} 53 | # <- punctuation.definition.variable 54 | # ^^ keyword.operator.substringreplacement 55 | # ^ punctuation.definition.string.begin 56 | # ^ punctuation.definition.string.end 57 | # ^ punctuation.definition.variable 58 | 59 | ${foo:=$( bar )} 60 | # <- punctuation.definition.variable 61 | # ^^ keyword.operator.substringreplacement 62 | # ^^ punctuation.definition.string.begin 63 | # ^ punctuation.definition.string.end 64 | # ^ punctuation.definition.variable 65 | 66 | ${foo:=$(( 1 + 1 ))} 67 | # <- punctuation.definition.variable 68 | # ^^ keyword.operator.substringreplacement 69 | # ^^^ punctuation.definition.string.begin 70 | # ^ constant.numeric.integer 71 | # ^ keyword.operator.arithmetic 72 | # ^ constant.numeric.integer 73 | # ^^ punctuation.definition.string.end 74 | # ^ punctuation.definition.variable 75 | 76 | ${foo:=$bar} 77 | # <- punctuation.definition.variable 78 | # ^^ keyword.operator.substringreplacement 79 | # ^ punctuation.definition.variable 80 | # ^^^ variable.other.normal 81 | # ^ punctuation.definition.variable 82 | 83 | ${foo:="$bar"} 84 | # <- punctuation.definition.variable 85 | # ^^ keyword.operator.substringreplacement 86 | # ^ punctuation.definition.string.begin 87 | # ^ punctuation.definition.variable 88 | # ^^^^ variable.other.normal 89 | # ^ punctuation.definition.string.end 90 | # ^ punctuation.definition.variable 91 | 92 | 93 | ################################# 94 | # Braces in parameter expansion # 95 | ################################# 96 | 97 | ${foo//foo\}foo\/foo/foo} 98 | # <- punctuation.definition.variable 99 | # ^^ keyword.operator.substringreplacement 100 | # ^^ constant.character.escape 101 | # ^^ constant.character.escape 102 | # ^ keyword.operator.substringreplacement 103 | # ^ punctuation.definition.variable 104 | 105 | ${foo:="${bar} baz"} 106 | # <- punctuation.definition.variable 107 | # ^^ keyword.operator.substringreplacement 108 | # ^ punctuation.definition.string.begin 109 | # ^ punctuation.definition.string.end 110 | # ^ punctuation.definition.variable 111 | 112 | # Sublime bug fix: " 113 | # ^ comment.line.number-sign 114 | 115 | ${!varprefix*} 116 | # <- punctuation.definition.variable 117 | # ^ keyword.operator.match 118 | # ^ keyword.operator.match 119 | # ^ punctuation.definition.variable 120 | 121 | ${!varprefix@} 122 | # <- punctuation.definition.variable 123 | # ^ keyword.operator.match 124 | # ^ keyword.operator.match 125 | # ^ punctuation.definition.variable 126 | 127 | ${var#Pattern} 128 | # <- punctuation.definition.variable 129 | # ^ keyword.operator.substringremoval 130 | # ^ punctuation.definition.variable 131 | 132 | ${var##Pattern} 133 | # <- punctuation.definition.variable 134 | # ^^ keyword.operator.substringremoval 135 | # ^ punctuation.definition.variable 136 | 137 | ${var###Pattern} 138 | # <- punctuation.definition.variable 139 | # ^^ keyword.operator.substringremoval 140 | # ^ - keyword.operator.substringremoval 141 | # ^ punctuation.definition.variable 142 | 143 | ${var%Pattern} 144 | # <- punctuation.definition.variable 145 | # ^ keyword.operator.substringremoval 146 | # ^ punctuation.definition.variable 147 | 148 | ${var%%Pattern} 149 | # <- punctuation.definition.variable 150 | # ^^ keyword.operator.substringremoval 151 | # ^ punctuation.definition.variable 152 | 153 | ${var%%%Pattern} 154 | # <- punctuation.definition.variable 155 | # ^^ keyword.operator.substringremoval 156 | # ^ - keyword.operator.substringremoval 157 | # ^ punctuation.definition.variable 158 | 159 | 160 | #################################################################### 161 | # Parameter-expansion operators # 162 | # cf. http://www.tldp.org/LDP/abs/html/parameter-substitution.html # 163 | #################################################################### 164 | 165 | ${foo//%/} 166 | # <- punctuation.definition.variable 167 | # ^^ keyword.operator.substringreplacement 168 | # ^ - keyword 169 | # ^ keyword.operator.substringreplacement 170 | # ^ punctuation.definition.variable 171 | 172 | ${foo//#/} 173 | # <- punctuation.definition.variable 174 | # ^^ keyword.operator.substringreplacement 175 | # ^ - keyword 176 | # ^ keyword.operator.substringreplacement 177 | # ^ punctuation.definition.variable 178 | 179 | ${foo//!/} 180 | # <- punctuation.definition.variable 181 | # ^^ keyword.operator.substringreplacement 182 | # ^ - keyword 183 | # ^ keyword.operator.substringreplacement 184 | # ^ punctuation.definition.variable 185 | 186 | ${foo//:/} 187 | # <- punctuation.definition.variable 188 | # ^^ keyword.operator.substringreplacement 189 | # ^ - keyword 190 | # ^ keyword.operator.substringreplacement 191 | # ^ punctuation.definition.variable 192 | 193 | ${foo//@/} 194 | # <- punctuation.definition.variable 195 | # ^^ keyword.operator.substringreplacement 196 | # ^ - keyword 197 | # ^ keyword.operator.substringreplacement 198 | # ^ punctuation.definition.variable 199 | 200 | ${foo#} 201 | # <- punctuation.definition.variable 202 | # ^ keyword.operator.substringremoval 203 | # ^ punctuation.definition.variable 204 | 205 | ${foo!} # "!" is not a operator here 206 | # <- punctuation.definition.variable 207 | # ^ variable.other.bracket 208 | # ^ punctuation.definition.variable 209 | 210 | ${var:pos:len} 211 | # <- punctuation.definition.variable 212 | # ^ keyword.operator.expansion 213 | # ^ keyword.operator.expansion 214 | # ^ punctuation.definition.variable 215 | 216 | ${foo//a\/b/c/d} 217 | # <- punctuation.definition.variable 218 | # ^^ keyword.operator.substringreplacement 219 | # ^^ constant.character.escape 220 | # ^ keyword.operator.substringreplacement 221 | # ^ - keyword.operator.substringreplacement 222 | # ^ punctuation.definition.variable 223 | 224 | ${foo^} 225 | # <- punctuation.definition.variable 226 | # ^ keyword.operator.uppercase 227 | # ^ punctuation.definition.variable 228 | 229 | ${foo,} 230 | # <- punctuation.definition.variable 231 | # ^ keyword.operator.lowercase 232 | # ^ punctuation.definition.variable 233 | 234 | ${foo^^} 235 | # <- punctuation.definition.variable 236 | # ^^ keyword.operator.uppercase 237 | # ^ punctuation.definition.variable 238 | 239 | ${foo,,} 240 | # <- punctuation.definition.variable 241 | # ^^ keyword.operator.lowercase 242 | # ^ punctuation.definition.variable 243 | 244 | ${foo,,,Pattern} 245 | # <- punctuation.definition.variable 246 | # ^^ keyword.operator.lowercase 247 | # ^ - keyword 248 | # ^ punctuation.definition.variable 249 | 250 | ${foo,,Pattern} 251 | # <- punctuation.definition.variable 252 | # ^^ keyword.operator.lowercase 253 | # ^ punctuation.definition.variable 254 | 255 | ${foo-bar} 256 | # <- punctuation.definition.variable 257 | # ^ keyword.operator.substringreplacement 258 | # ^ punctuation.definition.variable 259 | 260 | ${foo:-bar} 261 | # <- punctuation.definition.variable 262 | # ^^ keyword.operator.substringreplacement 263 | # ^ punctuation.definition.variable 264 | 265 | ${foo+bar} 266 | # <- punctuation.definition.variable 267 | # ^ keyword.operator.substringreplacement 268 | # ^ punctuation.definition.variable 269 | 270 | ${foo:+bar} 271 | # <- punctuation.definition.variable 272 | # ^^ keyword.operator.substringreplacement 273 | # ^ punctuation.definition.variable 274 | 275 | ${foo=bar} 276 | # <- punctuation.definition.variable 277 | # ^ keyword.operator.substringreplacement 278 | # ^ punctuation.definition.variable 279 | 280 | ${foo:=bar} 281 | # <- punctuation.definition.variable 282 | # ^^ keyword.operator.substringreplacement 283 | # ^ punctuation.definition.variable 284 | 285 | ${foo?bar} 286 | # <- punctuation.definition.variable 287 | # ^ keyword.operator.substringreplacement 288 | # ^ punctuation.definition.variable 289 | 290 | ${foo:?bar} 291 | # <- punctuation.definition.variable 292 | # ^^ keyword.operator.substringreplacement 293 | # ^ punctuation.definition.variable 294 | 295 | 296 | ################### 297 | # Misc. operators # 298 | ################### 299 | 300 | foo='bar' 301 | # ^ keyword.operator.assign 302 | 303 | foo[jjj]="`<$file`" 304 | # ^ keyword.operator.assign 305 | 306 | foo+=" baz" 307 | # ^^ keyword.operator.append 308 | 309 | export foo='bar' 310 | # ^ keyword.operator.assign 311 | 312 | [ -n "${foo}" ] 313 | # <- punctuation.definition.logical-expression 314 | # ^ punctuation.definition.logical 315 | # ^^ keyword.operator.logical 316 | # ^ punctuation.definition.string.begin 317 | # ^^ punctuation.definition.variable 318 | # ^^^ variable.other.bracket 319 | # ^ punctuation.definition.variable 320 | # ^ punctuation.definition.string.end 321 | # ^ punctuation.definition.logical-expression 322 | 323 | [[ -n "${foo}" ]] 324 | # <- meta.scope.logical-expression 325 | # ^ punctuation.definition.logical 326 | # ^^ keyword.operator.logical 327 | # ^ punctuation.definition.string.begin 328 | # ^^ punctuation.definition.variable 329 | # ^^^ variable.other.bracket 330 | # ^ punctuation.definition.variable 331 | # ^ punctuation.definition.string.end 332 | # ^^ meta.scope.logical-expression 333 | 334 | [ "${foo}" != 'bar' ] 335 | # <- meta.scope.logical-expression 336 | # ^ punctuation.definition.string.begin 337 | # ^^ punctuation.definition.variable 338 | # ^^^ variable.other.bracket 339 | # ^ punctuation.definition.variable 340 | # ^ punctuation.definition.string.end 341 | # ^^ keyword.operator.logical 342 | # ^ punctuation.definition.string.begin 343 | # ^^^^^ string.quoted.single 344 | # ^ punctuation.definition.string.end 345 | # ^ meta.scope.logical-expression 346 | 347 | [[ "${foo}" != 'bar' ]] 348 | # <- meta.scope.logical-expression 349 | # ^ punctuation.definition.string.begin 350 | # ^^ punctuation.definition.variable 351 | # ^^^ variable.other.bracket 352 | # ^ punctuation.definition.variable 353 | # ^ punctuation.definition.string.end 354 | # ^^ keyword.operator.logical 355 | # ^ punctuation.definition.string.begin 356 | # ^^^^^ string.quoted.single 357 | # ^ punctuation.definition.string.end 358 | # ^^ meta.scope.logical-expression 359 | 360 | echo >> echo 361 | # ^^ keyword.operator.redirect 362 | # ^^^^ - support.function 363 | 364 | anyprogram >>! echo 365 | # ^^^ keyword.operator.redirect 366 | # ^^^^ - support.function 367 | 368 | echo [[ "${foo}" != 'bar' ]] 369 | # <- support.function.builtin 370 | # ^^ - meta.scope.logical-expression 371 | # ^ punctuation.definition.string.begin 372 | # ^^ punctuation.definition.variable 373 | # ^^^ variable.other.bracket 374 | # ^ punctuation.definition.variable 375 | # ^ punctuation.definition.string.end 376 | # ^^ - keyword.operator.logical 377 | # ^ punctuation.definition.string.begin 378 | # ^^^^^ string.quoted.single 379 | # ^ punctuation.definition.string.end 380 | # ^^ - meta.scope.logical-expression 381 | 382 | echo ]] echo 383 | # ^^ - meta.scope.logical-expression 384 | # ^^^^ - support.function.builtin 385 | 386 | 387 | foo; bar; baz 388 | # ^ keyword.operator.list 389 | # ^ keyword.operator.list 390 | 391 | for (( i = 0; i < RAND; i++ )); do 392 | # <- keyword.control 393 | # ^ variable.other.c-style 394 | # ^ keyword.operator.arithmetic 395 | # ^ variable.other.c-style 396 | # ^ keyword.operator.arithmetic 397 | # ^^^^ variable.other.c-style 398 | # ^ variable.other.c-style 399 | # ^^ keyword.operator.arithmetic 400 | # ^ keyword.operator.list 401 | # ^^ keyword.control 402 | : 403 | done 404 | # <- keyword.control 405 | 406 | # <- - meta.scope.for-loop 407 | 408 | 409 | #################### 410 | # Identifier names # 411 | #################### 412 | 413 | $(( foo + 2 )) 414 | # ^^^ variable.other.c-style 415 | 416 | (( foo++ )) 417 | # ^^^ variable.other.c-style 418 | 419 | for i in "${foo[@]}"; do 420 | # ^ variable.other.loop 421 | : 422 | done 423 | 424 | 425 | ################################################ 426 | # Quoting, interpolation and nested constructs # 427 | ################################################ 428 | 429 | [ ! -f foo.$foo ] 430 | # <- punctuation.definition.logical-expression 431 | # ^ keyword.operator.logical 432 | # ^^ keyword.operator.logical 433 | # ^ punctuation.definition.variable 434 | # ^^^^ variable.other.normal 435 | # ^ punctuation.definition.logical-expression 436 | 437 | [ ! -f foo.$foo -a $foo -le 500 ] 438 | # <- punctuation.definition.logical-expression 439 | # ^ keyword.operator.logical 440 | # ^^ keyword.operator.logical 441 | # ^ punctuation.definition.variable 442 | # ^^^^ variable.other.normal 443 | # ^^ keyword.operator.logical 444 | # ^ punctuation.definition.variable 445 | # ^^^^ variable.other.normal 446 | # ^^ keyword.operator.logical 447 | # ^ punctuation.definition.logical-expression 448 | 449 | [[ $str =~ ^$'\t' ]] 450 | # ^^ keyword.operator.logical 451 | # ^^^^^^ source.regexp 452 | 453 | [[ $str =~ ^abc$var$ ]] 454 | # ^^ keyword.operator.logical 455 | # ^^^^ source.regexp 456 | # ^^^^ variable.other.normal 457 | # ^ source.regexp 458 | 459 | [[ $str =~ ^abc$(echo $var)$ ]] 460 | # ^^ keyword.operator.logical 461 | # ^^^^ source.regexp 462 | # ^^ punctuation.definition.string.begin 463 | # ^^^^ variable.other.normal 464 | # ^ source.regexp 465 | 466 | [[ $str =~ \ ?[a-z]\ ]] 467 | # ^^ keyword.operator.logical 468 | # ^^^^^^^^^^ source.regexp 469 | 470 | [[ $str =~ ^(bar|baz)[abc0-9]{1,2}$ ]] 471 | # ^^ keyword.operator.logical 472 | # ^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp 473 | 474 | [[ $str =~ "^(bar|baz)[abc0-9]{1,2}$" ]] 475 | # ^^ keyword.operator.logical 476 | # ^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double 477 | 478 | [[ $str =~ $(echo $regex) ]] 479 | # ^^ keyword.operator.logical 480 | # ^^ punctuation.definition.string.begin 481 | # ^^^^ support.function.builtin 482 | # ^ punctuation.definition.variable 483 | # ^^^^^^ variable.other.normal 484 | # ^ punctuation.definition.string.end 485 | 486 | [[ $str =~ $regex ]] 487 | # ^^ keyword.operator.logical 488 | # ^ punctuation.definition.variable 489 | # ^^^^^^ variable.other.normal 490 | 491 | : <<- EOF 492 | # ^^^ keyword.operator.heredoc 493 | # ^^^ keyword.control.heredoc-token 494 | foo 495 | # <- string.unquoted.heredoc 496 | EOF 497 | # <- keyword.control.heredoc-token 498 | 499 | : << EOF 500 | # ^^ keyword.operator.heredoc 501 | # ^^^ keyword.control.heredoc-token 502 | $variable 503 | # ^ punctuation.definition.variable 504 | # ^^^^^^^^^ variable.other.normal 505 | foo bar $( baz ) 506 | # <- string.unquoted.heredoc 507 | EOF 508 | # <- keyword.control.heredoc-token 509 | 510 | : << 'EOF' 511 | # ^^ keyword.operator.heredoc 512 | # ^^^ keyword.control.heredoc-token 513 | $variable 514 | # ^^^^^^^^^ string.unquoted.heredoc 515 | foo bar $( baz ) 516 | # <- string.unquoted.heredoc 517 | EOF 518 | # <- keyword.control.heredoc-token 519 | 520 | cat <<<' 521 | # ^^^ keyword.operator.herestring 522 | line 1 523 | line 2 524 | ' 525 | # <- string.quoted.single.herestring punctuation.definition.string.end 526 | 527 | cat <<<" 528 | # ^^^ keyword.operator.herestring 529 | line 1 530 | line 2\"test 531 | # ^^ constant.character.escape 532 | line 3 533 | " 534 | # <- string.quoted.double.herestring punctuation.definition.string.end 535 | 536 | cat <<_ACEOF; 537 | # ^^ keyword.operator.heredoc 538 | # ^^^^^^ keyword.control.heredoc-token 539 | $variable 540 | # <- string.unquoted.heredoc 541 | # ^ punctuation.definition.variable 542 | _ACEOF 543 | # <- keyword.control.heredoc-token 544 | 545 | cat << EOF > file 546 | # ^^ keyword.operator.heredoc 547 | # ^^^ keyword.control.heredoc-token 548 | # ^ keyword.operator.redirect 549 | # ^^^^ - string.unquoted.heredoc - support.function.external 550 | $variable 551 | # <- string.unquoted.heredoc 552 | # ^ punctuation.definition.variable 553 | # ^^^^^^^^^ variable.other.normal 554 | These contents will be written to the file. 555 | This line is indented. 556 | EOF 557 | # <- keyword.control.heredoc-token 558 | 559 | 560 | ################################ 561 | # Heredoc with compact-command # 562 | ################################ 563 | 564 | print_info_text_compact () { cat <filename 639 | # <- constant.numeric.file-descriptor 640 | #^ keyword.operator.redirect 641 | 642 | 1>>filename 643 | # <- constant.numeric.file-descriptor 644 | #^^ keyword.operator.redirect 645 | 646 | &>filename 647 | # <- constant.numeric.file-descriptor 648 | #^ keyword.operator.redirect 649 | 650 | 2>&1 651 | # <- constant.numeric.file-descriptor 652 | #^^ keyword.operator.redirect 653 | # ^ constant.numeric.file-descriptor 654 | 655 | 0<&- 656 | #^^ keyword.operator.redirect 657 | # <- constant.numeric.file-descriptor 658 | # ^ constant.numeric.file-descriptor 659 | 660 | <&- 661 | # <- keyword.operator.redirect 662 | # ^ constant.numeric.file-descriptor 663 | 664 | `command -v autoconf >/dev/null 2>&1` 665 | # ^ constant.numeric.file-descriptor 666 | # ^^ keyword.operator.redirect 667 | # ^ constant.numeric.file-descriptor 668 | 669 | $(curl -I "https://google.com" 2> /dev/null) 670 | # ^ constant.numeric.file-descriptor 671 | # ^ keyword.operator.redirect 672 | 673 | 674 | ############ 675 | # Subshell # 676 | ############ 677 | 678 | "$( foo )" 679 | #^ punctuation.definition.string.begin 680 | # ^ punctuation.definition.string.end 681 | 682 | "` foo `" 683 | #^ punctuation.definition.string.begin 684 | # ^ punctuation.definition.string.end 685 | 686 | "$(( foo++ ))" 687 | # ^^^ variable.other.c-style 688 | # ^^ keyword.operator.arithmetic 689 | 690 | $( foo $( bar $( baz ) ) ) 691 | # <- punctuation.definition.string.begin 692 | # ^^ punctuation.definition.string.begin 693 | # ^^ punctuation.definition.string.begin 694 | # ^ punctuation.definition.string.end 695 | # ^ punctuation.definition.string.end 696 | # ^ punctuation.definition.string.end 697 | 698 | $( foo ` bar ` ) 699 | # <- punctuation.definition.string.begin 700 | # ^ punctuation.definition.string.begin 701 | # ^ punctuation.definition.string.end 702 | # ^ punctuation.definition.string.end 703 | 704 | $( foo "$(( bar + 1 ))" ) 705 | # <- punctuation.definition.string.begin 706 | # ^^^ punctuation.definition.string.begin 707 | # ^^ punctuation.definition.string.end 708 | # ^ punctuation.definition.string.end 709 | 710 | foo="$( bar "$( baz "$( qux )" )" )" 711 | # ^^ punctuation.definition.string.begin 712 | # ^^ punctuation.definition.string.begin 713 | # ^^ punctuation.definition.string.begin 714 | # ^ punctuation.definition.string.end 715 | # ^ punctuation.definition.string.end 716 | # ^ punctuation.definition.string.end 717 | 718 | $(( ( RANDOM * 100 ) / 5 )) 719 | # <- punctuation.definition.string.begin 720 | # ^^^^^^ variable.other.c-style 721 | # ^ keyword.operator.arithmetic 722 | # ^^^ constant.numeric.integer 723 | # ^ keyword.operator.arithmetic 724 | # ^ constant.numeric.integer 725 | # ^^ punctuation.definition.string.end 726 | 727 | $(( a=(2*(250+1))/5 )) 728 | # <- punctuation.definition.string.begin 729 | # ^ variable.other.c-style 730 | # ^ keyword.operator.arithmetic 731 | # ^ keyword.operator.arithmetic 732 | # ^^^ constant.numeric.integer 733 | # ^ keyword.operator.arithmetic 734 | # ^ constant.numeric.integer 735 | # ^ keyword.operator.arithmetic 736 | # ^ constant.numeric.integer 737 | # ^^ punctuation.definition.string.end 738 | 739 | plus=$(( $(echo "$errorCode") )) 740 | # ^ support.function.builtin 741 | 742 | 743 | ######### 744 | # Array # 745 | ######### 746 | 747 | OPTS=(--prefix=$PREFIX) 748 | # ^ punctuation.definition.array.begin 749 | # ^ punctuation.definition.variable 750 | # ^^^^^^^ variable.other.normal 751 | # ^ punctuation.definition.array.end 752 | 753 | OPTS+=(--prefix=$PREFIX) 754 | # ^ punctuation.definition.array.begin 755 | # ^ punctuation.definition.variable 756 | # ^^^^^^^ variable.other.normal 757 | # ^ punctuation.definition.array.end 758 | 759 | declare -A ERROR_MESSAGES=( 760 | # ^ punctuation.definition.array.begin 761 | ["no msg"]='' 762 | # ^^^^^^^^^^ meta.structure.array-section 763 | # ^ punctuation.section.array.begin 764 | # ^^^^^^^^ string.quoted.double 765 | # ^ punctuation.section.array.end 766 | # ^ keyword.operator.assign 767 | [unknown]='Unknown error happened.' 768 | # ^^^^^^^^^ meta.structure.array-section 769 | # ^ punctuation.section.array.begin 770 | # ^ punctuation.section.array.end 771 | # ^ keyword.operator.assign 772 | [no util]="‘$util’ is required but wasn’t found on this system." 773 | # ^^^^^^^^^ meta.structure.array-section 774 | # ^ punctuation.section.array.begin 775 | # ^ punctuation.section.array.end 776 | # ^ keyword.operator.assign 777 | # ^ punctuation.definition.variable 778 | # ^^^^^ variable.other.normal 779 | ) 780 | # <- punctuation.definition.array.end 781 | 782 | 783 | 784 | ############ 785 | # Backtick # 786 | ############ 787 | 788 | if [[ ! "`git status 2> /dev/null`" ]]; then 789 | # Sublime bug fix: ` 790 | return 791 | # <- - string.quoted.double 792 | fi 793 | 794 | 795 | ################# 796 | # Controversial # 797 | ################# 798 | 799 | empty=$((echo hello) > output.txt) 800 | # ^^^^ support.function.builtin 801 | # ^ keyword.operator.redirect 802 | # Sublime bug fix: )) 803 | 804 | user="$((who -m) 2>&1)" 805 | # ^^^ support.function.external 806 | # ^^ keyword.operator.redirect 807 | # Sublime bug fix: )) 808 | # ^^ comment.line.number-sign 809 | 810 | empty=$( (echo hello) > output.txt) 811 | # ^^^^ support.function.builtin 812 | # ^ keyword.operator.redirect 813 | 814 | grep 'foo' <( bar "$( baz )" ) 815 | # ^^ punctuation.definition.string.begin 816 | # ^^ punctuation.definition.string.begin 817 | # ^ punctuation.definition.string.end 818 | # ^ punctuation.definition.string.end 819 | 820 | 821 | #################### 822 | # Command Switches # 823 | #################### 824 | 825 | echo -e Hello 826 | # ^ punctuation.definition.command-switch 827 | # ^^ support.command-switch 828 | 829 | echo\ 830 | -e Hello 831 | #^ punctuation.definition.command-switch 832 | #^^ support.command-switch 833 | 834 | echo \ 835 | -e Hello 836 | #^ punctuation.definition.command-switch 837 | #^^ support.command-switch 838 | 839 | echo \ 840 | -e Hello 841 | # <- punctuation.definition.command-switch 842 | #^ support.command-switch 843 | 844 | gcc input.c -o output.exe --verbose 845 | # ^ punctuation.definition.command-switch 846 | # ^^ support.command-switch 847 | # ^^ punctuation.definition.command-switch 848 | # ^^^^^^^^^ support.command-switch 849 | 850 | rm -f -- -filename_starts_with_dash 851 | # ^ punctuation.definition.command-switch 852 | # ^^ support.command-switch 853 | # ^^ punctuation.definition.command-switch-end 854 | # ^ - punctuation.definition.command-switch 855 | 856 | 857 | ################## 858 | # Special Design # 859 | ################## 860 | 861 | var=true 862 | # ^^^^ variable.other.true 863 | 864 | var=false; 865 | # ^^^^^ variable.other.false 866 | # ^ keyword.operator.list 867 | 868 | git --switch=true; 869 | # ^^^^ variable.other.true 870 | # ^ keyword.operator.list 871 | 872 | git --switch=false 873 | # ^^^^^ variable.other.false 874 | 875 | foo='bar' 876 | #^^ meta.variable.assigned 877 | # ^ keyword.operator.assign 878 | 879 | foo[$bar]="Hello" 880 | #^^^^^^^^ meta.variable.assigned 881 | # ^ keyword.operator.assign 882 | 883 | foo[hello-world]="Hi" 884 | #^^^^^^^^^^^^^^^ meta.variable.assigned 885 | # ^ keyword.operator.assign 886 | 887 | sudo -s pip --upgrade install numpy 888 | #^^^ support.function.privilege 889 | # ^^ support.command-switch 890 | # ^^^ support.function.external 891 | # ^^^^^^^^^ support.command-switch 892 | 893 | 894 | ########################### 895 | # Misc. language features # 896 | ########################### 897 | 898 | if [ true ];then 899 | # ^^^^ meta.scope.if-block keyword.control 900 | echo "HELLO" 901 | fi 902 | 903 | case "${foo}" in 904 | # <- keyword.control 905 | # ^^ punctuation.definition.variable 906 | # ^ punctuation.definition.variable 907 | # ^^ keyword.control 908 | ( help | h ) bar ;; 909 | # ^ punctuation.definition.case-pattern 910 | # ^ punctuation.separator.pipe-sign 911 | # ^ punctuation.definition.case-pattern 912 | # ^^ punctuation.terminator.case-clause 913 | do1 ) foo1 ;& 914 | # ^^ - keyword.control 915 | # ^^ punctuation.terminator.case-clause 916 | do2 ) foo2 ;;& 917 | # ^^ - keyword.control 918 | # ^^^ punctuation.terminator.case-clause 919 | *) bar 920 | # ^ keyword.operator.glob 921 | # ^ punctuation.definition.case-pattern 922 | esac 923 | # <- keyword.control 924 | 925 | # <- - meta.scope.case-block 926 | 927 | while :; do 928 | # <- keyword.control 929 | # ^ support.function.builtin 930 | # ^ keyword.operator.list 931 | # ^^ keyword.control 932 | continue 933 | # ^^^^^^^^ keyword.control 934 | break 935 | # ^^^^^ keyword.control 936 | done 937 | # <- keyword.control 938 | 939 | # <- - meta.scope.while-loop 940 | 941 | if-up 942 | # <- - keyword.control 943 | # ^ - keyword 944 | 945 | foo:if:bar 946 | # ^ - keyword 947 | # ^^ - keyword.control 948 | # ^ - keyword 949 | 950 | func-while 951 | # ^ - keyword 952 | # ^^^^^ - keyword.control 953 | 954 | func_for 955 | # ^^^ - keyword.control 956 | 957 | func-for 958 | # ^ - keyword 959 | # ^^^ - keyword.control 960 | 961 | dd if=/dev/hda of=/dev/hdb 962 | # ^^ - keyword.control 963 | # ^ keyword.operator.assign 964 | # ^ - keyword.control 965 | # ^ - keyword.control 966 | # ^ keyword.operator.assign 967 | # ^ - keyword.control 968 | # ^ - keyword.control 969 | 970 | rm -rf mkdir 971 | # ^^^^^ - support.function 972 | 973 | echo do 974 | # ^^ - keyword.control 975 | 976 | export cat 977 | # ^^^ - support.function 978 | 979 | export cat=1 980 | # ^^^ - support.function 981 | # ^ keyword.operator.assign 982 | 983 | export cat=$(git --version) 984 | # ^^^ - support.function 985 | # ^ keyword.operator.assign 986 | 987 | cat=1 988 | # <- - support.function 989 | # ^ keyword.operator.assign 990 | 991 | cd=cat 992 | # <- - support.function 993 | # ^^^ - support.function 994 | 995 | echo git rev-list "$(echo --all)" | grep -P 'c354a80' 996 | # <- support.function.builtin 997 | # ^^^ - support.function 998 | # ^^ punctuation.definition.string.begin 999 | # ^^^^ support.function.builtin 1000 | # ^ punctuation.definition.string.end 1001 | # ^ keyword.operator.pipe 1002 | # ^^^^ support.function.external 1003 | # ^^ support.command-switch 1004 | # ^ punctuation.definition.string.begin 1005 | # ^ punctuation.definition.string.end 1006 | 1007 | echo $(echo git --version) echo `$(echo git --version)` "$(echo git --version)" 1008 | # <- support.function.builtin 1009 | # ^^^^ support.function.builtin 1010 | # ^^^ - support.function 1011 | # ^^^^ - support.function 1012 | # ^^^^ support.function.builtin 1013 | # ^^^ - support.function 1014 | # ^^^^ support.function.builtin 1015 | # ^^^ - support.function 1016 | 1017 | echo `echo git --version` 1018 | # <- support.function.builtin 1019 | # ^^^^ support.function.builtin 1020 | 1021 | echo echo $(git) "$(git)" `$(git)` `git` | grep -P 'c354a80' 1022 | # <- support.function.builtin 1023 | # ^^^^ - support.function 1024 | # ^^^ support.function.external 1025 | # ^^^ support.function.external 1026 | # ^^^ support.function.external 1027 | # ^^^ support.function.external 1028 | # ^ keyword.operator.pipe 1029 | # ^^^^ support.function.external 1030 | # ^^ support.command-switch 1031 | # ^ punctuation.definition.string.begin 1032 | # ^ punctuation.definition.string.end 1033 | 1034 | echo cat \ 1035 | # <- support.function.builtin 1036 | # ^^^ - support.function 1037 | # ^ punctuation.definition.multiline 1038 | cat 1039 | cat 1040 | 1041 | echo cat \ 1042 | cat 1043 | # ^^^ - support.function 1044 | cat 1045 | # <- support.function.external 1046 | 1047 | echo cat > cat \ 1048 | # <- support.function.builtin 1049 | # ^^^ - support.function 1050 | # ^ keyword.operator.redirect 1051 | # ^^^ - support.function 1052 | # ^ punctuation.definition.multiline 1053 | cat 1054 | cat 1055 | 1056 | echo cat > cat \ 1057 | cat 1058 | # ^^^ - support.function 1059 | cat 1060 | # <- support.function.external 1061 | 1062 | echo `echo git --version` echo | grep -P 'c354a80' 1063 | # <- support.function.builtin 1064 | # ^^^^ support.function.builtin 1065 | # ^^^ - support.function 1066 | # ^^^^ - support.function 1067 | # ^ keyword.operator.pipe 1068 | # ^^^^ support.function.external 1069 | 1070 | 1071 | ############################# 1072 | # Others from Github issues # 1073 | ############################# 1074 | 1075 | ` findfs UUID=00000000 ` 1076 | # ^ -string.interpolated.backtick 1077 | 1078 | 1079 | ##################################### 1080 | ##################################### 1081 | ###### Not done by this syntax ###### 1082 | ##################################### 1083 | ##################################### 1084 | 1085 | #################### 1086 | # Identifier names # 1087 | #################### 1088 | 1089 | # Variable names passed to variable-related shell built-ins like `declare`, 1090 | # `export`, `local`, `readonly`, `typeset`, and `unset` should be treated as 1091 | # such. (Note: What to do if they're quoted?) 1092 | declare foo # 'foo' is a variable name 1093 | declare -A foo bar # 'foo' and 'bar' are variable names 1094 | export foo # 'foo' is a variable name 1095 | export foo bar # 'foo' and 'bar' are variable names 1096 | export foo='bar' # 'foo' is a variable name 1097 | local foo bar # 'foo' and 'bar' are variable names 1098 | local foo bar='baz' # 'foo' and 'bar' are variable names 1099 | readonly foo # 'foo' is a variable name 1100 | typeset foo # 'foo' is a variable name 1101 | unset foo bar # 'foo' and 'bar' are variable names 1102 | 1103 | # Possibly the variable names passed to other shell built-ins known to support 1104 | # them should be treated as such? (Note: What to do if they're quoted?) 1105 | printf -v foo 'bar' # 'foo' is a variable name 1106 | read -r foo bar baz # 'foo', 'bar', and 'baz' are variable names 1107 | read -a foo # 'foo' is a variable name 1108 | 1109 | # arbitrary heredoc identifier with extra compound commands 1110 | cat <<_ACEOF; echo hello; 1111 | world 1112 | _ACEOF 1113 | 1114 | # Note that the following is equivalent to "echo-e Hello" 1115 | # That is, the "-e" is not a command switch. 1116 | echo\ 1117 | -e Hello 1118 | --------------------------------------------------------------------------------