bash-mode
bash-mode: the major mode for Bash files (`.sh`, `.bash`, `.zsh`, `.fish`) — tree-sitter highlighting, folds, symbols, and text objects.
The major mode for Bash. Activates automatically on .sh, .bash, .zsh, .fish.
What it gives you
| Capability | Source |
|---|---|
| Syntax highlighting | tree-sitter-bash's highlight query |
Folds (zc / zo / zM / zR) | queries/bash/folds.scm |
Symbols (outline, :picker outline) | queries/bash/symbols.scm |
Text objects (af / if, ac / ic, …) | queries/bash/textobjects.scm |
All four come from tree-sitter, so they follow the real parse tree rather than indentation or regex heuristics — a fold or a function text object is the actual syntactic node, not a guess.
Also claims shell dotfiles that carry no extension at all — .bashrc, .zshrc, .profile, .kshrc and friends — matched by filename before the extension check runs.
Keybindings
None of its own. A language major mode names the language and supplies queries; it contributes no chords. Everything you press in one of these buffers is the universal vim grammar (modal-editing) plus whatever minors are active. The syntax text objects the queries feed — af / if for a function, ac / ic for a class — are bound by the grammar, not here; this mode is what makes them resolve to real syntax nodes.
Options
None. This mode contributes no option overrides, so every option in a Bash buffer resolves to its global or default value. Tab width, wrapping, line numbers and the rest are set globally or per buffer — see options and display.
There is no per-language settings mechanism today: you cannot say "tabs in Go, spaces in Python" through the mode. That is a real gap, not an omission from this page.
Activating it manually
Detection is by file extension, so a Bash file with an unusual name lands in text-mode. Set the mode directly:
:bash-mode
Every major mode has an auto-generated toggle named after it. To see what a buffer currently has, :describe-mode with no argument.
What it does not give you
- No LSP by itself. Language-server features — completion, diagnostics, go-to-definition — come from
lsp-mode, which is a separate per-buffer gate with its own activation. A major mode names the language; it does not start a server. - No formatting or indentation rules. Neither is wired to the major mode today.