Fish

· toad's blog


Fish is fun. It comes with batteries included. Which is nice because I'm lazy and don't keep proper backups or version control my configs. Auto complete, built in help and flag definitions.

Interactive use #

Fish is fun. It makes every day use easier with close to no configuration.

Bash lets you edit th ecurrent command with: Ctrl+x, Ctrl+e

In fish, you can edit the current command in your default $EDITOR with: Alt+e https://fishshell.com/docs/current/interactive.html#command-line-editor

Tab completions #

Tab completion is nicer with a Vim like wild menu of sorts that appears below the command

toad@t420 ~> ls -ltr
-1                                           (List one entry per line)
-A  --almost-all                         (Show hidden except . and ..)
-a  --all                                                (Show hidden)
-B  --ignore-backups                      (Ignore files ending with ~)
-b  --escape                (Octal escapes for non-graphic characters)
-C                                         (Force multi-column output)
-c                             (Sort by changed time, (-l) show ctime)
-D  --dired                                    (Generate dired output)
-d  --directory                  (List directories, not their content)
-F  --classify                    (Append filetype indicator (*/=>@|))
-f                                       (Unsorted output, enables -a)
-G  --no-group                         (Don't print group information)
-H  -L  --dereference  --dereference-command-line    (Follow symlinks)
-h  --human-readable                            (Human readable sizes)
-I  --ignore                           (Skip entries matching pattern)
-i  --inode                              (Print inode number of files)
-k                                              (Set blocksize to 1kB)
-l                                               (Long listing format)
-m                       (Comma-separated format, fills across screen)
-N  --literal                                  (Print raw entry names)
…and 36 more rows

Autosuggestions #

I like that previously executed commands are suggested based on history

https://fishshell.com/docs/current/interactive.html#autosuggestions

abbrevitations #

Also abbreviations are pretty cool. They're similar to aliases except they when typed they auto-expand the full command which is nice because it keeps shell history portable. You can add new abbreviations with the abbr command, the abbreviation, then the command. E.g.:

abbr cmdh 'command --help'

Here's some abbreviations I have set up

toad@t420 ~/blog> abbr
abbr -a -- gs 'git status'
abbr -a -- gp 'git pull'
abbr -a -- gl 'git log'
abbr -a -- gfa 'git-forgit add'
abbr -a -- gfl 'git-forgit log'
abbr -a -- cl 'tmux clear-history'
last updated: