Fish Shell Goodies
_____ _ _ | __|_|___| |_ | __| |_ -| | |__| |_|___|_|_|
Fish config with awesome flexible prompt, unicode symbols, better fzf integration and lot of handy functions.
- Lots of functions/ideas are easily portable to Bash/Zsh/your preffered shell
- Feel free to explore!
- This readme automatically generated from comments in scripts
- Please notify me if you notice any errors
- Works nice with my Kitty shell config and useful script collection
git clone [email protected]:dmi3/fish.git
- Install configs:
- All: run
./_install.fish⚠ this will remove
~/.config/fish! Backup before running
- Some: source files you are interested in your
- All: run
- Install fzf or run
fish -c update-fzf
- We also have Bash version, and portable Over-SSH version
- Create missing directories in path when calling
pathcommand to print full file path
rmmcommand to remove directories, but ask nicely
cppcommand to copy directories, but ask nicely
cpto ask when overwriting files
mvto ask when overwriting files
add-to-pathCommand to add current directory to path
- Human readable sizes for
free(i.e. Mb, Gb etc)
fscommand to show free space on physical drives
diskscommand to List disks
- Clearly shows which disks are mounted temporary
- I always run this command before
ddsd-card, to make 100% sure not to override system partition
partitionscommand to list partitions
sizeofcommand to show size of file or directory
connectcommand Connect to wifi from terminal
lockblockcommand to prevent screen locking untill next reboot
wgetto save file with provided name
unsetto unset enviroment variable
nanocommand if file is not editable by current user
- Warn if file does no exist
- If Sublime Text installed - use it instead of Gedit
- Show 3 (next and prev) months in
cal, start week on monday
- Use nicl in installed
- If sssh2 installed - use it instead of ssh
- If plug installed - use it for interactive mount/unmount of USB drives
icatShow images in kitty
ll"Scroll ll if theres more files that fit on screen"
mkcd"Create and cd to directory"
aumount"Unmount all mounted archive (and gvfs locations)"
copy"Copy pipe or argument"
copypath"Copy full file path"
reset_windows"Reset all windows size and bring it to main monitor. Useful if DE messes up in multiple monitor configuration"
run"Make file executable, then run it"
launch"Launch GUI program - hide output and don't close when terminal closes"
open"Open file by default application in new process"
b"Exec command in bash. Useful when copy-pasting commands with imcompatible syntax to fish "
c"Math using Python"
subl"Starts Sublime Text. Additionally supports piping (i.e.
ls | subl) and urls (i.e.
qr"Prints QR. E.g. super useful when you need to transfer private key to the phone without intermediaries
cat ~/.ssh/topsecret.pem | qr"
Dark theme. See screenshots.
Auto generate completion for todo script.
Search script for strings starting with
-- and add them
to Fish completion as arguments for
Entry point that includes all other configs
Functions useful for developers
ccatCat file, but with syntax highlighting
git-show-unpushed-commitsGit show unpushed commits
server-hereStart serving files in current directory and open browser
git-revert-file"Revert single file in git"
git-wat"Show 5 latest commits"
git-pr"Create PR on Github"
gradle"Use ./gradlew if exists"
src'Open/edit source of script or function located in $PATH' --wraps which
td"Add to ~/todo.md list"
bak"Copies (backups) file in same folder with .bak extension"
- See Official Fish documentation
- Clear input on
- Exit on
Escif single command mode enabled
- Convinient directory navigation using
- History back/forward/go to parent dir
- You can use Fish as file manager!
- Comes handy when you start typing command, then realize wrong dir
- Send terminate on
Cfor copy (in terminal settings). See https://developer.run/36
- Prints directory and currently running command in tab title ↓
Rshow fzf (fuzzy) history search where you can:
- Super advanched analog or
- Execute previos command
- Edit command before execution
- Delete history entry (very useful for no longer actual commands)
- Super advanched analog or
Ctrl+Eis better way to access previosly visited directories
fish_user_key_bindings"Key bindings. Go to functions definition for description. Use
fish_title"Prints directory and currently running command in tab title.
[email protected]in prompt when connected via ssh."
/var/run/motd.dynamicas greeting. Use in combination with headlines.sh to see top news"
show_exit_code"Show exit code on command failure" --on-event fish_postexec
what-did-just-happened"Show start time, and duration of last executed command"
save_dir"If command was executed if directory, save dir to Ctrl+E history for quick access." --on-event fish_postexec
fzf-history-widget"Ctrl+R for history"
FFuzzy recursive search files by name in current directory & append selection to current command"
Fsearch (fuzzy) file by contents"
Eto access most frequently visited directories."
update-fzf"Installs or updates fzf"
freq"Line frequency in piped input. See https://gist.github.com/rsvp/1859875"
!!to get last command"
!\$to get last command argument"
Two line prompt with full path and Git integration that scales nicely
- Prompts for single Fish command in left bottom corner of given application window
- To make benefit of Fish shell autocompletion and history
- Closes after one command is executed
- If command fails, leaves window to inspect error message
For example you want execute
git clone [email protected]:dmi3/bin.git in current directory from Double Commander:
Shift+F2and terminal window appears in left bottom corner of Double Commander window
- First you want
cloneto be autocompleted using Fish
- During clone process you want to see
gitcommand output to monitor progeress
- If everything is ok, promt will close
- In case of error you will have chance to read error message
sudo apt-get install fish wmctrl xterm
- Use Fish config that supports
- Argument is window title of any app:
singlecmd.fish "Sublime Text"
singlecmd.fish "IntelliJ IDEA"
- OR open Double Commander
Insert new button:
- Hot Key:
Calls to various CLI friendly web services
myipShows external ip
localipShows (local) internal ip
whereamiis like whoami but shows your external ip and geolocation
xkcdPrint color-adjusted xkcd in your terminal! See https://developer.run/40
albumartShow hi-res album art of currently playing song in Spotify
- Requires sp
random-name"Random name for registration on random websites. How about Helen Lovick? Roger Rice?"
random-alias"Docker-like alias generator:
boring_heisenberg. Don't know how to name file/project/branch/file? Use this!"
random-email"Random email for registration on random websites. Generate random email in one of Mailinator subdomains and provide link to check it. Useful when http://bugmenot.com/ is not available."
random-password"Generate random password" --argument-names 'length'
xsh"Prepend this to command to explain its syntax i.e.
xsh iptables -vnL --line-numbers"
transfer"Upload file to transfer.sh"
translate"Translate word using Yandex"
syn"Find synonyms for word"
emoji"Search emoji by name"
waitweb'Wait until web resource is available. Useful when you are waiting for internet to get back, or Spring to start' --argument-names 'url'