My Shell Setup
I am too paranoid to share most of my actual dotfiles publicly, but I am also too obsessed with software and its customization not to share some details of my setup. On this page you will find information about some of my command line shell configuration.
I prefer Fish to other shells, as it is the most sensible option I have found for bread-and-butter use. There are other shells that have more radical ideas but none of them have really vibed with me and didn't gel with the way I work. If I was going to switch to a more radical shell (which I would like to eventually), I would prefer to switch to a graphical REPL for a good programming language like Common Lisp or Factor. If I'm going to spend time adjusting to a new shell, I would prefer to do so for something with enough changes to make it worth it. Revolution, not evolution.
In the meantime, Fish is reliable and pleasant for both scripting and interactive use. I definitely recommend it. Finally–a command line shell for the 90s! :-)
In addition to what I've described here, I've also published many of my scripts. The ones I've published are ones that I feel may be useful to others, and I have tried to make them user-friendly and easy to read and use. Many of them are written in Fish, but you of course don't need to actually set it as your default shell in order to use them; just having it installed and the scripts in your $PATH
suffices.
Anyway, here are some of the tools, scripts, aliases, and configurations I have set up for my command line shell.
Single-Letter Commands
Functionality that I use often enough to dedicate single-letter names to.
b
- "browse" - My script for invoking a browser. Currently, my primary browser is Vivaldi, but I plan to switch to Nyxt in the future.c
- "clipboard" - My script that wraps xclip on Linux, and pbpaste/pbcopy on macOS.d
- "delete" - Aliased to trash-put from trash-cli.e
- "edit" - My emacsclient wrapper script.j
- "jump" - Aliased topazi_cd
from pazi.l
- "ls" - Aliased to lsd.m
- "music" - My script that wraps mpc (MPD control).o
- "open" - Aliased to pso, a simpler/easier xdg-open alternative.p
- "play" - My script that wraps mpv.u
- "upload" - My script that uploads the files specified as arguments to a public directory on my webserver and copies the resulting URL to the clipboard.v
- "view" - My script that wraps nsxiv. In the future I may switch to using mpv as an image viewer instead as it is more customizable.y
- "yay" - Named after an AUR helper I used to use, however it is now aliased to paru instead.
More Commands and Aliases
Some others I use a lot:
ll
- Aliased tols -lh
.lst
- Aliased tols --sort=time
.mkcd
- Aliased tomkdir -p $argv[1]; cd $argv[1]
.pc
- Aliased top $(c)
.id3
- Aliased to eyeD3, a Python script to view/edit audio file id3 tags.ytdl
- Aliased to yt-dlp, which is basically youtube-dl except that it is still being maintained and developed.ytdlc
- Aliased toytdl $(c)
, which downloads the media from the URL saved in the clipboard.snds
- My script which prints a list of programs that are using audio devices.lanhosts
- Aliased tosudo nmap -sn '192.168.0.*'
, to get a list of hosts on the local network.taptempo
- Aliased to my Python script that tells you the tempo that you're tapping a key at.clock
- Aliased toncmpcpp -s clock
, to show a large clock.weather
- Aliased tocurl wttr.in
, to display the weather forecast.
Shell Configuration
Various options and environment variables that are not specific to Fish or tmux
.
If you're not familiar with Fish, note that set -x
is basically the same as export
in Bash/Zsh/etc.
set -x BLOCKSIZE human-readable
- Sodu
,df
, etc print human-readable units by default.set -x QUOTING_STYLE literal
- Preventls
from pointlessly printing quotes around filenames with spaces.set -x EDITOR e
- Set the default editor to myemacsclient
wrapper.set -x ALTERNATE_EDITOR zile
- If Emacs is not running, fall back to zile, a simple and fast Emacs-like editor.set -x VISUAL $EDITOR
,set -x SUDO_EDITOR $EDITOR
,set -x SYSTEMD_EDITOR $EDITOR
- No, seriously, just use the editor I set$EDITOR
to.set -x DIFFPROG ediff
- Use Emacs'ediff
for viewing/editing diffs.set -x MERGEPROG ediff
- Also useediff
for merging diffs.set -x BROWSER b
- Use my browser wrapper script to open URLs.set -x GREP_COLORS "mt=01;33"
- Make grep print the matching text in color if its output is not being piped to another program.set -x WLC_REPEAT_DELAY 190
- Wayland configuration. I don't have the time to wait for keyboard repeat to kick in!!!!!!!set -x WLC_REPEAT_RATE 50
- Wayland configuration. Make the keyboard repeat rate much faster.set -x WINEDLLOVERRIDES winemenubuilder.exe=d
- Prevent Wine from annoyingly associating its programs with file extensions. Why it does that by default for so many standard file types is beyond me!fish_add_path ~/misc/stow/scripts
- Add my scripts to$PATH
.Colorize
ls
output:if test -e ~/.dircolors; and command -qs dircolors eval (dircolors -c ~/.dircolors) end
Colorize various standard commands with grc:
if test -f /etc/grc.fish source /etc/grc.fish end
Fish Configuration
Fish-specific configuration.
bind \eC fish_clipboard_copy
- Alt+C to copy the current command line to the clipboard. By default, this is bound toCtrl+x
in Fish, but I prefer to useCtrl+x
as mytmux
prefix key.Bind
Page Up
andAlt+v
to scroll up one page withtmux
. Beware that this can prevent those keys from being usable in terminal programs if you haven't worked around that in your configuration. I have, though. :-)if contains "$TERM" 'screen' 'screen-256color'; and status is-interactive bind -k ppage 'tmux copy-mode -u' # page up bind \ev 'tmux copy-mode -u' # alt+v end
fish_greeting
- The text Fish displays on launch. I have this set to call scripts that warn me if the free space of any partitions are low, or if I haven't run a backup in a long time.fish_prompt
- The prompt. Unlike some shells, Fish is sane enough to use a function for this instead of forcing you to shove everything into a cryptic variable. My prompt is pretty simple, and typically looks likeuser@host:directory$ (exit_code_if_nonzero)
- for example,modula@obsclera:~/misc/images (127)
if the last program exited with status 127. It is also set up so that each host's prompt has a different color, to make it easier for me to see which host I'm about to run a command on.function host_bgcolor -d "The background color of the prompt for the current hostname." # This line generates a color from the md5 of the hostname, but I have also overridden it for a few hosts. echo $hostname | md5sum | string sub -l 6 end function host_fgcolor -d "The text color of the prompt for the current hostname." # Again, I've overridden this for a few hosts. # Ideally, this would auto-generate a color that contrasts with the prompt background. echo white end function fish_prompt -d "The prompt." set -l last_ret $status set -l bgcolor (host_bgcolor $hostname) set -l fgcolor (host_fgcolor $hostname) if test $last_ret -ne 0 set_color red echo -n '('$last_ret') ' end set_color $fgcolor -b $bgcolor echo -n $USER set_color normal -b $bgcolor echo -n '@' set_color $fgcolor -b $bgcolor echo -n $hostname set_color normal echo -n ':' set_color green echo -n (prompt_pwd) if fish_is_root_user set_color red echo -n '# ' else set_color blue echo -n '$ ' end set_color normal end
- Fisher
- done
- fish_tmsu
- trish
tmux
Configuration
tmux
-specific configuration.