Skip to content

Commit ed09f70

Browse files
committed
feat: Add lesskey syntax highlighting
It's kind of broken at the moment.
1 parent 7c0006d commit ed09f70

File tree

6 files changed

+149
-0
lines changed

6 files changed

+149
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Syntax highlighting for
3131
- jq
3232
- JSON5
3333
- jsonl
34+
- lesskey
3435
- Linker Scripts
3536
- LLVM IR
3637
- Log
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"comments": {
3+
"lineComment": "# ",
4+
},
5+
"autoClosingPairs": [
6+
{
7+
"open": "{",
8+
"close": "}",
9+
"notIn": [
10+
"string"
11+
]
12+
},
13+
{
14+
"open": "[",
15+
"close": "]",
16+
"notIn": [
17+
"string"
18+
]
19+
},
20+
{
21+
"open": "(",
22+
"close": ")",
23+
"notIn": [
24+
"string"
25+
]
26+
},
27+
{
28+
"open": "'",
29+
"close": "'",
30+
"notIn": [
31+
"string"
32+
]
33+
},
34+
{
35+
"open": "\"",
36+
"close": "\"",
37+
"notIn": [
38+
"string",
39+
"comment"
40+
]
41+
},
42+
{
43+
"open": "`",
44+
"close": "`",
45+
"notIn": [
46+
"string",
47+
"comment"
48+
]
49+
}
50+
]
51+
}

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,16 @@
423423
],
424424
"configuration": "./language-configuration/jsonl.language-configuration.json"
425425
},
426+
{
427+
"id": "lesskey",
428+
"aliases": [
429+
"lesskey"
430+
],
431+
"extensions": [
432+
".lesskey"
433+
],
434+
"configuration": "./language-configuration/lesskey.language-configuration.json"
435+
},
426436
{
427437
"id": "linkerscript",
428438
"aliases": [
@@ -983,6 +993,11 @@
983993
},
984994
"path": "./syntaxes/jsonl.tmLanguage.json"
985995
},
996+
{
997+
"language": "lesskey",
998+
"scopeName": "source.lesskey",
999+
"path": "./syntaxes/lesskey.tmLanguage.json"
1000+
},
9861001
{
9871002
"language": "linkerscript",
9881003
"scopeName": "source.ld",
@@ -1148,6 +1163,7 @@
11481163
"*.sublime-snippet": "xml",
11491164
"*.hbs": "html",
11501165
"*.ejs": "html",
1166+
"lesskey": "lesskey",
11511167
"*.Xresources": "xdefaults",
11521168
"i3/config": "i3",
11531169
"i3/*.conf": "i3",

syntaxes/lesskey.tmLanguage.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "lesskey configuration file",
3+
"patterns": [
4+
{
5+
"include": "#sections"
6+
},
7+
{
8+
"include": "#section-keys"
9+
},
10+
{
11+
"include": "#section-env"
12+
},
13+
{
14+
"include": "#comments"
15+
}
16+
],
17+
"repository": {
18+
"sections": {
19+
"patterns": [
20+
{
21+
"name": "entity.name.section",
22+
"match": "^#(command|line-edit|env)[ \t]*$"
23+
}
24+
]
25+
},
26+
"section-keys": {
27+
"patterns": [
28+
{
29+
"name": "entity.assignment",
30+
"match": "^\\s*\\w\\s+\\s"
31+
}
32+
]
33+
},
34+
"section-env": {
35+
"patterns": [
36+
{
37+
"name": "entity.assignment",
38+
"match": "^\\s*\\w\\s*=\\s*\\w"
39+
}
40+
]
41+
},
42+
"comments": {
43+
"patterns": [
44+
{
45+
"name": "comment.line",
46+
"match": "^\\s*#.*\\n"
47+
}
48+
]
49+
}
50+
},
51+
"scopeName": "source.lesskey",
52+
"uuid": "dde9500d-f769-40fd-80dc-4a08f06ff35e"
53+
}

testdata/1.lesskey

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#command
2+
3+
#line-edit
4+
5+
#env
6+
a = b
7+
LESS = -FRQ
8+
LESS_ADVANCED_PREPROCESSOR=1 # lesspipe.sh
9+
# export LESSOPEN="|source-highlight-esc.sh %s"
10+
LESSHISTSIZE='32768'
11+
LESSHISTFILE="$XDG_STATE_HOME/history/less_history"
12+
LESS_TERMCAP_mb=$'\e[1;31m' # start blink
13+
LESS_TERMCAP_md=$'\e[1;36m' # start bold
14+
LESS_TERMCAP_me=$'\e[0m' # end all
15+
LESS_TERMCAP_so=$'\e[01;44;33m' # start reverse video
16+
LESS_TERMCAP_se=$'\e[0m' # end reverse video
17+
LESS_TERMCAP_us=$'\e[1;32m' # start underline
18+
LESS_TERMCAP_ue=$'\e[0m' # end underline
19+
LESS_TERMCAP_us=$'\e[1;32m' # start underline

testdata/lesskey

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#command
2+
3+
#line-edit
4+
5+
#env
6+
LESS = -FRQ
7+
LESS_ADVANCED_PREPROCESSOR = 1
8+
LESSOPEN= |source-highlight-esc.sh\ %s
9+
LESSHISTSIZE= 32768

0 commit comments

Comments
 (0)