config.toml

 1name = "Shell Script"
 2code_fence_block_name = "bash"
 3grammar = "bash"
 4path_suffixes = ["sh", "bash", "bashrc", "bash_profile", "bash_aliases", "bash_logout", "bats", "profile", "zsh", "zshrc", "zshenv", "zsh_profile", "zsh_aliases", "zsh_histfile", "zlogin", "zprofile", ".env", "PKGBUILD", "APKBUILD"]
 5line_comments = ["# "]
 6first_line_pattern = '^#!.*\b(?:ash|bash|bats|dash|sh|zsh)\b'
 7autoclose_before = "}])"
 8brackets = [
 9    { start = "[", end = "]", close = true, newline = false },
10    { start = "(", end = ")", close = true, newline = true },
11    { start = "{", end = "}", close = true, newline = true },
12    { start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },
13    { start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
14    { start = "do", end = "done", close = false, newline = true, not_in = ["comment", "string"] },
15    { start = "then", end = "fi", close = false, newline = true, not_in = ["comment", "string"] },
16    { start = "then", end = "else", close = false, newline = true, not_in = ["comment", "string"] },
17    { start = "then", end = "elif", close = false, newline = true, not_in = ["comment", "string"] },
18    { start = "in", end = "esac", close = false, newline = true, not_in = ["comment", "string"] },
19]
20
21auto_indent_using_last_non_empty_line = false
22increase_indent_pattern = "^\\s*(\\b(else|elif)\\b|([^#]+\\b(do|then|in)\\b)|([\\w\\*]+\\)))\\s*$"
23decrease_indent_patterns = [
24  { pattern = "^\\s*elif\\b.*",    valid_after = ["if", "elif"] },
25  { pattern = "^\\s*else\\b.*",    valid_after = ["if", "elif", "for", "while"] },
26  { pattern = "^\\s*fi\\b.*",      valid_after = ["if", "elif", "else"] },
27  { pattern = "^\\s*done\\b.*",    valid_after = ["for", "while"] },
28  { pattern = "^\\s*esac\\b.*",    valid_after = ["case"] },
29  { pattern = "^\\s*[\\w\\*]+\\)\\s*$", valid_after = ["case_item"] },
30]
31
32# We can't use decrease_indent_patterns simply for elif, because
33# there is bug in tree sitter which throws ERROR on if match.
34#
35# This is workaround. That means, elif will outdents with despite
36# of wrong context. Like using elif after else.
37decrease_indent_pattern = "(^|\\s+|;)(elif)\\b.*$"