Skip to content

Commit

Permalink
Restore the specific scope for plus options
Browse files Browse the repository at this point in the history
So users are able to target those +'s on a custom tmTheme and colorize
it differently than normal options. Like before the change tonight.
  • Loading branch information
victor-gp committed Nov 7, 2022
1 parent b4f1bc2 commit d2fd36a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions syntaxes/cmd-help.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ scope_variables: # last scope is matched first

- &OPTION_DEF_SCOPES
entity.name.function.option.cmd-help
- &PLUS_OPTION_DEF_SCOPES
entity.name.function.option.plus.cmd-help
- &OPTION_ARGUMENT_SCOPES
string.option-argument.cmd-help variable.other.option-argument.cmd-help
variable.parameter.option-argument.cmd-help
Expand Down Expand Up @@ -197,7 +199,7 @@ contexts:
scope: keyword.control.end-of-options.cmd-help
set: then-pop
- match: \+(?=[\s<[:alpha:]])
scope: *OPTION_DEF_SCOPES
scope: *PLUS_OPTION_DEF_SCOPES
set: plus-option-post
- match: -:(?={{option_break}})
scope: *OPTION_DEF_SCOPES
Expand Down Expand Up @@ -333,7 +335,7 @@ contexts:
set: then-pop
# e.g.: "+s, --no-sort" (from fzf)
- match: '[a-z]+'
scope: *OPTION_DEF_SCOPES
scope: *PLUS_OPTION_DEF_SCOPES
set: option-def-post
- include: else-pop

Expand Down
3 changes: 2 additions & 1 deletion tests/syntax/syntax_test_emacs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ Action options:
FILE visit FILE
#^^^ variable.parameter.other-value.cmd-help
+LINE go to line LINE in next FILE
# <- entity.name.function.option.cmd-help
# <- entity.name.function.option.plus.cmd-help
#^^^^ variable.parameter.option-argument.cmd-help
+LINE:COLUMN go to line LINE, column COLUMN, in next FILE
# <- entity.name.function.option.plus.cmd-help
#^^^^^^^^^^^ variable.parameter.option-argument.cmd-help
--directory, -L DIR prepend DIR to load-path (with :DIR, append DIR)
--eval EXPR evaluate Emacs Lisp expression EXPR
Expand Down
6 changes: 3 additions & 3 deletions tests/syntax/syntax_test_fzf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ usage: fzf [options]
-e, --exact Enable Exact-match
-i Case-insensitive match (default: smart-case match)
+i Case-sensitive match
# ^^ entity.name.function.option.cmd-help
# ^^ entity.name.function.option.plus.cmd-help
--scheme=SCHEME Scoring scheme [default|path|history]
--literal Do not normalize latin script letters before matching
-n, --nth=N[,..] Comma-separated list of field index expressions
Expand All @@ -18,8 +18,8 @@ usage: fzf [options]
field index expressions
-d, --delimiter=STR Field delimiter regex (default: AWK-style)
+s, --no-sort Do not sort the result
# ^^ entity.name.function.option.cmd-help
# ^^ - entity.name.function.option.cmd-help
# ^^ entity.name.function.option.plus.cmd-help
# ^^ - entity.name.function.option.plus.cmd-help
# ^^^^^^^^^ entity.name.function.option.cmd-help
--tac Reverse the order of the input
--disabled Do not perform search
Expand Down
4 changes: 2 additions & 2 deletions tests/syntax/syntax_test_vim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Arguments:
-o[N] Open N windows (default: one for each file)
-O[N] Like -o but split vertically
+ Start at end of file
# ^ entity.name.function.option.cmd-help
# ^ entity.name.function.option.plus.cmd-help
+<lnum> Start at line <lnum>
# ^ entity.name.function.option.cmd-help
# ^ entity.name.function.option.plus.cmd-help
# ^^^^^^ variable.parameter.option-argument.cmd-help
--cmd <command> Execute <command> before loading any vimrc file
-c <command> Execute <command> after loading the first file
Expand Down

0 comments on commit d2fd36a

Please sign in to comment.