Fish#

The friendly interactive shell. Fish ships its own line editor (not readline), with syntax highlighting, autosuggestions, and abbreviation expansion enabled by default. Most readline-style emacs bindings still work because fish reuses the conventions; the differences are in suggestion-acceptance keys, the history pager, and fish-only widgets like prepend-sudo and edit-command-buffer.

Switch to vi-style editing with fish_vi_key_bindings; revert with fish_default_key_bindings. bind with no arguments lists every active binding; bind --list-modes lists keymaps. fish_config opens the web UI; funced <name> edits a function in $EDITOR.

For shell startup files, universal variables, and abbreviation configuration, see the fish documentation at https://fishshell.com/docs/current/.

Cursor Movement#

Key

Action

Ctrl-a

move to start of line (beginning-of-line)

Ctrl-e

move to end of line (end-of-line)

Ctrl-b

move back one character

Ctrl-f

accept autosuggestion (or move forward if none)

Alt-b

move back one word

Alt-f

move forward one word

Alt-Left

move back one path component

Alt-Right

move forward one path component

Autosuggestions#

Fish shows the most likely completion in dim grey as you type. Acceptance is the headline keybinding.

Key

Action

Right

accept entire autosuggestion

Ctrl-f

accept entire autosuggestion (same as Right)

Alt-Right

accept next word of autosuggestion

Alt-f

accept next word of autosuggestion

Esc

dismiss current autosuggestion

Editing#

Key

Action

Ctrl-d

delete character under cursor (EOF on empty line)

Ctrl-h

delete character before cursor

Backspace

delete character before cursor

Alt-d

delete word forward

Ctrl-w

delete word backward (whitespace-delimited)

Alt-Backspace

delete word backward (alphanumeric-aware)

Ctrl-k

kill (cut) to end of line

Ctrl-u

kill from cursor to start of line

Ctrl-y

yank (paste) last killed text

Alt-y

rotate to previous kill after Ctrl-y

Ctrl-t

transpose character with previous

Alt-t

transpose word with previous

Alt-u

uppercase word from cursor

Alt-l

lowercase word from cursor

Alt-c

capitalize word from cursor

Ctrl-_

undo last edit

Alt-/

redo (after undo)

History#

Up / Down search history with the current line as a prefix. Ctrl-r opens the searchable history pager.

Key

Action

Up / Ctrl-p

previous matching history entry (prefix search)

Down / Ctrl-n

next matching history entry

Ctrl-r

open history pager (searchable)

Alt-Up

move to previous token in history

Alt-Down

move to next token in history

Alt-.

insert last argument of previous command

history

print full history

history search <pattern>

search history non-interactively

history delete --exact "<cmd>"

delete a history entry

history merge

merge in writes from other fish sessions

Process Control#

Key

Action

Ctrl-c

cancel current line / send SIGINT to foreground

Ctrl-z

suspend foreground process (SIGTSTP)

Ctrl-d

send EOF; exit shell on empty line

Ctrl-l

clear screen (keeps current line)

Ctrl-s

pause terminal output (XOFF)

Ctrl-q

resume terminal output (XON)

Ctrl-\

send SIGQUIT (core dump)

Completion#

Tab cycles through completions inline; if there are many, the pager opens. Inside the pager use arrow keys; Enter accepts, Esc cancels.

Key

Action

Tab

complete / cycle next match (opens pager if many)

Shift-Tab

cycle previous match

Esc

close completion pager without selecting

Ctrl-c

close pager without selecting

Enter

accept the highlighted completion

Page Down / Page Up

scroll the pager

Ctrl-s

search next within pager

Ctrl-r

search previous within pager

Fish Specials#

Widgets and bindings unique to fish.

Key

Action

Alt-s

prepend sudo to the current command line (prepend-sudo)

Alt-e / Alt-v

edit current command in $EDITOR (edit-command-buffer)

Alt-l

run ls against current word (path listing peek)

Alt-w

run man against current word (help peek)

Alt-p

append | less ; (pager suffix)

Alt-h

history-pager-delete on current entry (in pager)

Ctrl-x

cut current line to the kill ring (whole-line cut)

Ctrl-Space

insert Tab literally (skip suggestion)

Vi Mode#

Enable with fish_vi_key_bindings. Two main modes: insert (default after enable) and default (Vim “normal”); visual adds selection. Esc exits insert to default.

Key

Action

Esc

enter default (command) mode

i

insert at cursor

a

append after cursor

A

append at end of line

I

insert at start of line

0 / ^

move to start / first non-blank

$

move to end of line

w / b / e

word forward / back / end

f<c> / F<c>

find next / previous c

x

delete character under cursor

dw / d$ / dd

delete word / to end / whole line

cw / c$ / cc

change word / to end / whole line

yw / y$ / yy

yank word / to end / whole line

p / P

paste after / before cursor

u

undo

v

enter visual mode

V

linewise visual mode

k / j

previous / next history line (in default mode)

/<pat> / ?<pat>

search history backward / forward

Config and Discovery#

Command

Action

bind

list every active binding

bind --list-modes

list keymap modes (default, insert, visual, paste)

bind --mode default --key f1 'do-thing'

bind a key in a specific mode

bind \cx 'kill-whole-line'

bind Ctrl-x to a named function

bind --erase \cx

remove a binding

fish_default_key_bindings

revert to emacs-style bindings

fish_vi_key_bindings

switch to vi-style bindings

fish_config

open the configuration web UI

funced <name>

edit a function in $EDITOR

functions <name>

print a function’s definition

functions --names

list every defined function

abbr

list abbreviations

abbr -a gco 'git checkout'

add an abbreviation

stty -a

list terminal-driver shortcuts (intr, susp, erase)