Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Shell (Bash)

Install

macOS

npm install -g bash-language-server

Linux

npm install -g bash-language-server

Windows

npm install -g bash-language-server

Config

Catenary ships a built-in definition for bash-language-server — no [lsp.server.*] config is needed. If bash-language-server is on PATH, it works automatically.

Notes

  • The language ID is shellscript, not bash or sh
  • Works with .sh, .bash, .zsh files
  • Provides completions for commands, variables, and functions
  • Integrates with ShellCheck for linting (install separately)

Multi-server: PKGBUILD Files

For PKGBUILD and other packaging scripts, combine bash-language-server with termux-language-server for enhanced support:

[lsp.server.termux-language-server]
args = ["--stdio"]
file_patterns = ["PKGBUILD", "*.ebuild"]

[lsp.language.shellscript]
servers = ["termux-language-server", "bash-language-server"]

termux-language-server is tried first for PKGBUILD and ebuild files, with bash-language-server filling in for methods termux doesn’t handle. See Dispatch Filtering for details on file_patterns.

Optional: ShellCheck Integration

For better diagnostics, install ShellCheck:

# macOS
brew install shellcheck

# Linux (Debian/Ubuntu)
apt install shellcheck

# Linux (Arch)
pacman -S shellcheck

The language server will automatically use it if available.