Skip to content
$ shellfirm
Getting Started

Plugins and frameworks

Does shellfirm work with oh-my-zsh, powerlevel10k, starship, atuin, zsh-autosuggestions, zsh-syntax-highlighting, bash-preexec and fish plugins? Where to put the hook line, ble.sh, and the doctor plugin lines.

Most shell setups load plugins that change the prompt or rebind Enter. shellfirm is built for that: the zsh hook wraps Enter widgets again at every prompt, the bash hook wraps atuin's accept-line, and the fish hook chains Enter bindings after its check. One combination is not supported: bash with ble.sh.

Compatibility

Plugin or frameworkShellStatusNotes
oh-my-zshzshWorksAny position in .zshrc. oh-my-zsh turns on interactivecomments, so # starts a comment. Its git aliases (ggpush, gpsup) are expanded and checked.
powerlevel10kzshWorksInstant prompt: the hook prints nothing at startup, so no "console output during zsh initialization" warning. Transient prompt: a line is still checked, and a kept line after a cancel is redrawn.
starshipzsh, bash, fishWorks (tried in zsh)Prompt only; no Enter binding. doctor lists it in bash and zsh.
atuinzsh, bashWorksCtrl-R, then Enter on a history entry, is checked. With enter_accept = true the entry runs through shellfirm too.
atuinfishWorks when doctor is cleanatuin's enter_accept runs commandline -f execute. doctor warns if that is not checked (see below).
zsh-autosuggestionszshWorksAn accepted suggestion, and autosuggest-execute, are checked.
zsh-syntax-highlightingzshWorksHighlighting only.
zsh-vi-mode, zsh-abbrzshDetected by doctorEnter widgets they install are wrapped like any other; run shellfirm doctor to confirm.
fzf key bindingszsh, bash, fishDetected by doctorA line fzf puts on the command line is checked when you press Enter.
bash-preexecbashWorksAny order relative to the shellfirm line.
Transient prompt, tidefishDetected by doctorA bind \r to another function is chained after the check; doctor says whether a transient prompt's binding is checked.
ble.shbashNot supportedSee below.

"Works" means it was tried with a real setup: oh-my-zsh with zsh-autosuggestions and zsh-syntax-highlighting, powerlevel10k with instant and transient prompt, starship 1.27, atuin 18.24 (also with enter_accept = true) and bash-preexec. The other rows rely on the detection and wrapping built into the hooks.

Where to put the hook line

Anywhere in the rc file. shellfirm init appends it at the end:

~/.zshrc (end of file)
# Added by shellfirm init
eval "$(shellfirm init zsh)"
  • powerlevel10k: below the instant-prompt block is fine. The hook prints nothing at startup.
  • oh-my-zsh, atuin, starship: before or after them both work. shellfirm checks its key bindings again at each prompt, so a plugin that rebinds Enter after shellfirm loaded is wrapped again.
  • bash with atuin: before or after eval "$(atuin init bash)" both work.

Check the result in a new shell with shellfirm doctor.

doctor's plugin lines

shellfirm doctor lists the plugins it recognises in the shell it starts:

Output
  [--] plugin           atuin detected
  [--] plugin           zsh-autosuggestions detected
  [--] plugin           zsh-syntax-highlighting detected
  [--] plugin           powerlevel10k detected
LineMeaningWhat to do
[--] plugin <name> detectedInformation: a known plugin is loaded, and the hook handles it.Nothing.
[ok] plugin atuin enter_accept is checkedbash: atuin's accept-line is wrapped, so Ctrl-R + Enter goes through shellfirm.Nothing.
[!!] plugin atuin enter_accept runs commands unchecked (set `enter_accept = false` in atuin's config)bash: atuin's accept-line is not wrapped, so a history entry run with Enter skips the check.Set enter_accept = false in ~/.config/atuin/config.toml.
[ok] plugin transient prompt: its Enter binding runs after the checkfish: the transient-prompt binding is chained after shellfirm.Nothing.
[ok] plugin transient prompt: its `commandline -f execute` is checkedfish: the transient prompt runs commandline -f execute, and that is checked.Nothing.
[!!] execute_wrapper `commandline -f execute` (atuin enter_accept, transient prompts) is not checkedfish: a plugin that runs commandline -f execute (atuin enter_accept, a transient prompt) bypasses the check.Turn atuin's enter_accept off. If the line stays, open an issue with your config.fish.
[--] widgets `<widget>` was replaced or bound to Enter after shellfirm loaded (a plugin); shellfirm wrapped it at the prompt, so the line is still checked firstzsh: a plugin rebound Enter later, and shellfirm wrapped it.Nothing.
[!!] line_finish the zle-line-finish check is not in place …zsh older than 5.3, or a plugin replaced zle-line-finish: a plugin that binds Enter after the first prompt (zinit turbo, zsh-defer, sched) can run one command unchecked.Load such plugins without a delay, or update zsh.
[!!] plugin ble.sh replaces readline: the shellfirm key bindings are not usedbash with ble.sh, from the in-session check only (the default doctor does not see ble.sh).See below.

Any other [ok] plugin … line needs no action.

doctor checks a new interactive shell. To check the shell you are typing in (bindings changed after startup), run the command doctor prints at the end:

__shellfirm_doctor_probe | shellfirm doctor --stdin

ble.sh is not supported

ble.sh replaces bash's readline with its own line editor, so the key binding shellfirm installs for Enter is never used. With ble.sh loaded:

  • lines get extra characters appended and bash reports syntax errors such as syntax error near unexpected token '}';
  • each prompt prints shellfirm: warning: the last command did not pass through shellfirm (Enter was rebound) and was NOT checked; shellfirm bound Enter to the check again.;
  • or, without atuin, Enter does nothing at all: the line stays at the prompt (Ctrl-C or Ctrl-D gets you out);
  • commands are not checked.

Do not rely on doctor here. Its default check shows [ok] enter, because ble.sh does not attach in the shell doctor starts. The in-session check above does not help either: ble.sh garbles the line you type, so __shellfirm_doctor_probe | shellfirm doctor --stdin fails, and when it does run it still prints [ok] enter next to the ble.sh line.

To tell whether you are on ble.sh, run:

echo $BLE_VERSION

If it prints a version, ble.sh is loaded and commands are not checked. If Enter does nothing, run this from another shell (zsh, sh, or bash started with bash --norc) instead; a match means your bash loads ble.sh:

grep -n ble.sh ~/.bashrc

Use bash without ble.sh (for atuin, use its bash-preexec setup), or zsh or fish. Atuin's bash documentation lists ble.sh and bash-preexec as its two options; choose bash-preexec.

Still not sure?

  • Run shellfirm doctor in a new shell: no [!!] or [XX] line means Enter goes through shellfirm (except bash with ble.sh, see above).

  • Try a risky command where it can do no harm. First make a scratch repository with one modified file:

    cd "$(mktemp -d)" && git init -q && git checkout -q -b main && echo hi > a.txt && git add a.txt && git -c user.name=demo -c user.email=demo@example.com commit -qm init && echo change >> a.txt

    Then type git reset --hard and press Enter. It is High, so you get a challenge at every protection level except YOLO (Critical only). Press Esc: the command does not run. The line stays at the prompt; Ctrl-U clears it. (This is why the repository is made in a separate step: the whole line is checked before any of it runs.)

  • Report a plugin that breaks: open an issue with your rc file and the doctor output.