Skip to content

Commit bf49e91

Browse files
mrmeszarosmichaelblyons
authored andcommitted
Add highlighting for top level (naked) options
Support options appearing before the first host/match.
1 parent e1012e9 commit bf49e91

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

SSH Config.sublime-syntax

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ contexts:
1212
- include: comments
1313
- include: host
1414
- include: match
15+
- include: naked-options
1516

1617
options:
1718
- include: comments
@@ -42,6 +43,13 @@ contexts:
4243
scope: meta.mapping.value.ssh_config
4344
pop: true
4445

46+
naked-options:
47+
- match: (?!^[ \t]*(?i:host|match)\b)
48+
push:
49+
- meta_scope: meta.block.naked.ssh_config
50+
- include: pop-before-next-host
51+
- include: options
52+
4553
# Host
4654
host:
4755
- match: ^[ \t]*((?i:host))\b

Tests/syntax_test_client.ssh_config

+17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# SYNTAX TEST "Packages/SSH Config/SSH Config.sublime-syntax"
22

3+
#<- meta.block.naked
4+
User foo
5+
# ^^^^^^ meta.block.naked
6+
# ^^ keyword.other
7+
# ^^^ string.unquoted
8+
Port 22
9+
# ^^^^^ meta.block.naked
10+
# ^^ keyword.other
11+
# ^^ constant.numeric
12+
Include ~/.ssh/config_*_cloud
13+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.naked
14+
# ^^^^^ keyword.other
15+
# ^^^^^^^^^^^^^^^^^^^^^ string.unquoted
16+
# ^ keyword.operator.wildcard
17+
18+
319
Match Host targ?t_host Exec not_inside_network User sue
20+
#<- - meta.block.naked
421
# ^^^ keyword.control.conditional
522
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.statement.conditional
623
# ^^^^ keyword.other

0 commit comments

Comments
 (0)