aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorObserverOfTime <chronobserver@disroot.org>2023-09-17 12:41:06 +0300
committerObserverOfTime <chronobserver@disroot.org>2023-09-18 11:38:56 +0300
commitc0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd (patch)
treea98445ba839ef0bbc751aaf31f0a85ab6c20440f
parentUpdate parsers: agda, wing (diff)
downloadnvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.tar
nvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.tar.gz
nvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.tar.bz2
nvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.tar.lz
nvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.tar.xz
nvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.tar.zst
nvim-treesitter-c0f4363b72ec4f3ca2e4ce5fcd81aa67925379fd.zip
feat: add ssh config
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/ssh_config/folds.scm4
-rw-r--r--queries/ssh_config/highlights.scm81
-rw-r--r--queries/ssh_config/indents.scm7
-rw-r--r--queries/ssh_config/injections.scm17
6 files changed, 121 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json
index 03f6603c5..1d91350e8 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -542,6 +542,9 @@
"squirrel": {
"revision": "e8b5835296f931bcaa1477d3c5a68a0c5c2ba034"
},
+ "ssh_config": {
+ "revision": "f1039c88c488f77a10a616c6de5ec1c4c6e8572f"
+ },
"starlark": {
"revision": "c45ce2b39062bbd12ea1c210bd200db250efb24a"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 75ca59436..2880edec7 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1597,6 +1597,15 @@ list.squirrel = {
maintainers = { "@amaanq" },
}
+list.ssh_config = {
+ install_info = {
+ url = "https://github.com/ObserverOfTime/tree-sitter-ssh-config",
+ files = { "src/parser.c" },
+ },
+ filetype = "sshconfig",
+ maintainers = { "@ObserverOfTime" },
+}
+
list.starlark = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-starlark",
diff --git a/queries/ssh_config/folds.scm b/queries/ssh_config/folds.scm
new file mode 100644
index 000000000..659835657
--- /dev/null
+++ b/queries/ssh_config/folds.scm
@@ -0,0 +1,4 @@
+[
+ (host_declaration)
+ (match_declaration)
+] @fold
diff --git a/queries/ssh_config/highlights.scm b/queries/ssh_config/highlights.scm
new file mode 100644
index 000000000..d6b060f56
--- /dev/null
+++ b/queries/ssh_config/highlights.scm
@@ -0,0 +1,81 @@
+; Literals
+
+(string) @string
+
+(pattern) @string.regex
+
+(token) @character
+
+[
+ (number)
+ (bytes)
+ (time)
+] @number
+
+[
+ (kex)
+ (mac)
+ (cipher)
+ (key_sig)
+] @parameter
+
+[
+ ; generic
+ "yes" "no"
+ "ask" "auto"
+ "none" "any"
+ ; ControlMaster
+ "autoask"
+ ; FingerprintHash
+ "md5" "sha256"
+ ; PubkeyAuthentication
+ "unbound" "host-bound"
+ ; RequestTTY
+ "force"
+ ; SessionType
+ "subsystem" "default"
+ ; StrictHostKeyChecking
+ "accept-new" "off"
+ ; Tunnel
+ "point-to-point" "ethernet"
+ (ipqos)
+ (verbosity)
+ (facility)
+ (authentication)
+] @constant.builtin
+
+(uri) @text.uri
+
+; Keywords
+
+[ "Host" "Match" ] @keyword
+
+(parameter keyword: _ @keyword)
+
+(host_declaration argument: _ @namespace)
+
+(match_declaration
+ (condition criteria: _ @attribute))
+
+"all" @attribute
+
+; Misc
+
+[
+ "SSH_AUTH_SOCK"
+ (variable)
+] @constant
+
+(comment) @comment @spell
+
+(ERROR) @error
+
+; Punctuation
+
+[ "${" "}" ] @punctuation.special
+
+[ "\"" "," ":" "@" ] @punctuation.delimiter
+
+[ "=" "!" "+" "-" "^" ] @operator
+
+[ "*" "?" ] @character.special
diff --git a/queries/ssh_config/indents.scm b/queries/ssh_config/indents.scm
new file mode 100644
index 000000000..0dd1eb6ca
--- /dev/null
+++ b/queries/ssh_config/indents.scm
@@ -0,0 +1,7 @@
+[
+ (host_declaration)
+ (match_declaration)
+] @indent.begin
+
+; incomplete declarations
+(ERROR . [ "Host" "Match" ]) @indent.begin
diff --git a/queries/ssh_config/injections.scm b/queries/ssh_config/injections.scm
new file mode 100644
index 000000000..b71988471
--- /dev/null
+++ b/queries/ssh_config/injections.scm
@@ -0,0 +1,17 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+((condition
+ criteria: "exec"
+ argument: (string) @injection.content)
+ (#set! injection.language "bash"))
+
+((parameter
+ keyword: [
+ "KnownHostsCommand"
+ "LocalCommand"
+ "RemoteCommand"
+ "ProxyCommand"
+ ]
+ argument: (string) @injection.content)
+ (#set! injection.language "bash"))