Skip to content

Commit 3b86cd7

Browse files
committedDec 15, 2024·
Fixes some embedded shell annoyances
Incorporates a lot of robballou#16 Co-Authored-By: @keith-hall
1 parent e33a574 commit 3b86cd7

7 files changed

+21
-18
lines changed
 

‎Embeddings/Shell (for SSH Config KnownHostsCommand).sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ hidden: true
77
extends: Shell (for SSH Config).sublime-syntax
88

99
variables:
10-
tokens: (?:%[%CdfHhIiKkLlnprtu])
10+
ssh_config_character_escapes: (?:%[%CdfHhIiKkLlnprtu])

‎Embeddings/Shell (for SSH Config LocalCommand).sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ hidden: true
77
extends: Shell (for SSH Config).sublime-syntax
88

99
variables:
10-
tokens: (?:%[%CdhikLlnpruT])
10+
ssh_config_character_escapes: (?:%[%CdhikLlnpruT])

‎Embeddings/Shell (for SSH Config ProxyCommand).sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ hidden: true
77
extends: Shell (for SSH Config).sublime-syntax
88

99
variables:
10-
tokens: (?:%[%hnpr])
10+
ssh_config_character_escapes: (?:%[%hnpr])

‎Embeddings/Shell (for SSH Config).sublime-syntax

+13-10
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ hidden: true
66

77
extends: Packages/ShellScript/Shell-Unix-Generic.sublime-syntax
88

9-
variables:
10-
tokens: (?:%[%CdhikLlnpru])
11-
129
contexts:
1310

14-
prototype:
11+
expansions-parameter:
1512
- meta_prepend: true
16-
- match: '%%'
17-
scope: constant.character.escape.ssh
18-
- match: '{{tokens}}'
19-
scope: constant.other.placeholder.ssh
13+
- include: ssh-config-char-escapes
2014

21-
string-path-pattern-body:
15+
string-prototype:
2216
- meta_prepend: true
17+
- include: ssh-config-char-escapes
18+
19+
ssh-config-char-escapes:
2320
- match: '%%'
2421
scope: constant.character.escape.ssh
25-
- match: '{{tokens}}'
22+
- match: '{{ssh_config_character_escapes}}'
2623
scope: constant.other.placeholder.ssh
24+
25+
variables:
26+
# lazy escaping from heredoc as shell maybe indented
27+
no_indent: ^\s*
28+
tab_indent: ^\s*
29+
ssh_config_character_escapes: (?:%[%CdhikLlnpru])

‎Embeddings/Shell (for SSHD Config AuthorizedKeysCommand).sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ hidden: true
77
extends: Shell (for SSH Config).sublime-syntax
88

99
variables:
10-
tokens: (?:%[%CDfhkstUu])
10+
ssh_config_character_escapes: (?:%[%CDfhkstUu])

‎Embeddings/Shell (for SSHD Config AuthorizedPrincipalsCommand).sublime-syntax

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ hidden: true
77
extends: Shell (for SSH Config).sublime-syntax
88

99
variables:
10-
tokens: (?:%[%CDFfhiKksTtUu])
10+
ssh_config_character_escapes: (?:%[%CDFfhiKksTtUu])

‎Tests/syntax_test_client.ssh_config

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ Match Host targ?t_host Exec not_inside_network User sue
4242
# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell
4343
# ^^ meta.parameter.option.shell variable.parameter.option.shell
4444
# ^ punctuation.definition.parameter.shell
45-
# ^^^ meta.string.shell string.unquoted.shell
45+
# ^^^^^ meta.string string.unquoted.shell
4646
# ^^ constant.other.placeholder.ssh
4747
# ^^ constant.other.placeholder.ssh
48-
# ^^^^^^^^^^^^ meta.string.shell string.unquoted.shell
48+
# ^^^^^^^^^^^^ meta.string string.unquoted.shell
4949
# @@@ reference
5050
## ^^ meta.string.shell string.unquoted.shell
5151

@@ -129,7 +129,7 @@ Host server serverino !other-pat?ern
129129
# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell
130130
# ^^ meta.parameter.option.shell variable.parameter.option.shell
131131
# ^ punctuation.definition.parameter.shell
132-
# ^^^^^^^^^^^^^^ meta.string.shell string.unquoted.shell
132+
# ^^^^^^^^^^^^^^ meta.string string.unquoted.shell
133133
# ^^ constant.other.placeholder.ssh
134134
# ^^ constant.other.placeholder.ssh
135135
# ^ - source.shell

0 commit comments

Comments
 (0)
Please sign in to comment.