| name | bashd |
|---|---|
| section | 1 |
| date | 2025-09-28 |
| left-footer | bashd Manual |
| center-footer | User Commands |
bashd - Bash language server
bashd [OPTIONS]
bashd is a Language Server Protocol (LSP) implementation for Bash, built using the Go sh package and featuring ShellCheck integration for real-time linting.
-
-j, --json Log in JSON format.
-
-l, --logfile FILE Log to FILE instead of stderr.
-
-v, --verbose Increase log message verbosity with repeated usage up to -vvv.
-
-S, --severity SEVERITY-LEVEL Minimum severity used for diagnostics. SEVERITY_LEVEL must be one of style, info, warning or error. Default: style
-
--shellcheck-enable OPTIONAL-LINTS Enable shellcheck optional lints. See avaible optional lints with shellcheck --list-optional.
-
--shellcheck-exclude RULE-CODES Exclude shellcheck lints. RULES-COES is a comma separated list of rules.
-
--shellcheck-include RULE-CODES Only include shellcheck lints. RULES-CODES is a comma separated list of rules. All other rules will be disabled.
-
--fmt-binary-next-line On format, binary operators will appear on the next line when a binary command, such as a |, && or ||, spans multiple lines. A
\\will be used. -
--fmt-case-indent On format, switch cases will be indented. As such, switch case bodies will be two levels deeper than the switch itself.
-
--fmt-func-next-line On format, function opening braces are placed on a separate line.
-
--fmt-space-redirects On format, redirect operators such as > will be followed by a space.
-
-h, --help Print a help message.
-
-V, --version Print the version.
Minimum severity used for diagnostics. Must be one of style, info, warning or error. Default: style
-
include List of shellcheck rule codes. All other rules will be disabled.
-
exclude List of shellcheck rules codes.
-
enable List of shellcheck optional lints.
As the time of writing the following optional lints are available:
| Rule name | Description |
|---|---|
| add-default-case | Suggest adding a default case in case statements |
| avoid-negated-conditions | Suggest removing unnecessary comparison negations |
| avoid-nullary-conditions | Suggest explicitly using -n in [ $var ] |
| check-extra-masked-returns | Check for additional cases where exit codes are masked |
| check-set-e-suppressed | Notify when set -e is suppressed during function invocation |
| check-unassigned-uppercase | Warn when uppercase variables are unassigned |
| deprecate-which | Suggest command -v instead of which |
| quote-safe-variables | Suggest quoting variables without metacharacters |
| require-double-brackets | Require [[ and warn about [ in Bash/Ksh |
| require-variable-braces | Suggest putting braces around all variable references |
| useless-use-of-cat | Check for Useless Use Of Cat (UUOC) |
-
binary_next_line Binary operators will appear on the next line when a binary command, such as a |, && or ||, spans multiple lines. A
\\will be used between lines. -
case_indent Switch cases will be indented. As such, switch case bodies will be two levels deeper than the switch itself.
-
space_redirects Redirect operators such as > will be followed by a space.
-
func_next_line Function opening braces are placed on a separate line.
bashd -vvv --logfile <LOG-FILE-NAME>To do the same within Neovim, use
vim.lsp.config.bashd = {
cmd = { "bashd", "-vvv", "--logfile", "<LOG-FILE-NAME>" },
-- ...or in Helix via
[language-server.bashd]
command = "bashd"
args = [ "-vvv", "--logfile", "<LOG_FILE-NAME>"]
# ...vim.lsp.config.bashd = {
cmd = { "bashd" },
filetypes = { "bash", "sh" },
root_markers = { ".git" },
settings = {
bashd = {
severity = "style", -- Minimum severity of errors to consider (error, warning, info, style)
shellcheck = {
include = {}, -- Consider only given types of warnings
exclude = {}, -- Exclude types of warnings
enable = { -- List of optional checks to enable (or 'all')
"add-default-case", -- Suggest adding a default case in `case` statements
"avoid-negated-conditions", -- Suggest removing unnecessary comparison negations
"avoid-nullary-conditions", -- Suggest explicitly using -n in `[ $var ]`
"check-extra-masked-returns", -- Check for additional cases where exit codes are masked
"check-set-e-suppressed", -- Notify when set -e is suppressed during function invocation
"check-unassigned-uppercase", -- Warn when uppercase variables are unassigned
"deprecate-which", -- Suggest 'command -v' instead of 'which'
"quote-safe-variables", -- Suggest quoting variables without metacharacters
"require-double-brackets", -- Require [[ and warn about [ in Bash/Ksh
"require-variable-braces", -- Suggest putting braces around all variable references
"useless-use-of-cat", -- Check for Useless Use Of Cat (UUOC)
},
},
format = {
binary_next_line = true, -- Binary ops like && and | may start a line
case_indent = false, -- Switch cases will be indented
space_redirects = true, -- Redirect operators will be followed by a space
func_next_line = false, -- Function opening braces are placed on a separate line
}
}
}
}
vim.lsp.enable("bashd")[language-server.bashd]
command = "bashd"
[language-server.bashd.config.bashd]
severity = "style" # Minimum severity of errors to consider (error, warning, info, style)
shellcheck.include = [] # Consider only given types of warnings
shellcheck.exclude = [] # Exclude types of warnings
shellcheck.enable = [ # -- List of optional checks to enable (or 'all')
"add-default-case", # Suggest adding a default case in `case` statements
"avoid-negated-conditions", # Suggest removing unnecessary comparison negations
"avoid-nullary-conditions", # Suggest explicitly using -n in `[ $var ]`
"check-extra-masked-returns", # Check for additional cases where exit codes are masked
"check-set-e-suppressed", # Notify when set -e is suppressed during function invocation
"check-unassigned-uppercase", # Warn when uppercase variables are unassigned
"deprecate-which", # Suggest 'command -v' instead of 'which'
"quote-safe-variables", # Suggest quoting variables without metacharacters
"require-double-brackets", # Require [[ and warn about [ in Bash/Ksh
"require-variable-braces", # Suggest putting braces around all variable references
"useless-use-of-cat", # Check for Useless Use Of Cat (UUOC)
]
format.binary_next_line = true # Binary ops like && and | may start a line
format.case_indent = false # Switch cases will be indented
format.space_redirects = true # Redirect operators will be followed by a space
format.func_next_line = false # Function opening braces are placed on a separate line
[[language]]
name = "bash"
language-servers = [{ name = "bashd" }]sh(1), bash(1), shellcheck(1)