A Zsh plugin that replicates Fish shell's word deletion, word movement, and directory navigation — matching Fish's per-operation boundary rules.
Note: The word deletion part of this plugin can be approximated by setting
WORDCHARSglobally in your.zshrc. However, Fish actually uses different word boundaries for different operations (path-component deletion vs. alphanumeric word movement), and this plugin replicates that distinction. It also bundles directory navigation and the dual-behaviorAlt+Left/Alt+Right.
Matches Fish's backward-kill-path-component. Removes back to the previous path separator, treating filenames like foo-bar.txt as a single unit:
- Stops at path separators (
/) and shell syntax characters (=,&,;,{,},<,>) - Preserves dots (
.), hyphens (-), and other filename characters
Matches Fish's kill-word. Uses strict alphanumeric word boundaries — stops at -, ., /, and all other non-alphanumeric characters.
Matches Fish's forward-word / backward-word. Same alphanumeric boundaries as word deletion.
Matches Fish's prevd-or-backward-word / nextd-or-forward-word — context-sensitive:
- Line has content: moves cursor by word (alphanumeric boundaries)
- Line is empty: navigates directory history
| Command | Description |
|---|---|
prevd |
Go to the previous directory |
nextd |
Go to the next directory |
dirh |
Print directory history |
zinit load OneNoted/zsh-fishy-deletionsSource the plugin file in your .zshrc:
source /path/to/zsh-fishy-deletions.plugin.zshSet these variables before loading the plugin.
export ZSH_FISHY_NO_BINDINGS=1Then bind the widgets yourself:
# Path-component deletion
bindkey '^W' _fishy_backward_kill_path
bindkey '^[^?' _fishy_backward_kill_path
# Word deletion
bindkey '^[d' _fishy_kill_word
bindkey '^[[3;3~' _fishy_kill_word
# Word movement
bindkey '^[f' _fishy_forward_word
bindkey '^[b' _fishy_backward_word
# Directory navigation / word movement
bindkey '^[[1;3D' _fishy_prevd_or_backward_word
bindkey '^[[1;3C' _fishy_nextd_or_forward_wordOverride which characters stop path-component deletion (default: \/=&;{}<>):
export ZSH_FISHY_PATH_CHARS_EXCLUDE="\/=&;"Other plugins that bring Fish-like behavior to Zsh:
- zsh-autosuggestions — ghost text suggestions
- zsh-syntax-highlighting — syntax coloring as you type
- zsh-abbr — Fish-style abbreviations
- zsh-history-substring-search / atuin — history substring search
MIT