Fish
Oh My Fish

Oh My Fish (omf)

Oh My Fish provides core infrastructure to allow you to install packages which extend or modify the look of your shell. It's fast, extensible and easy to use.

GitHub Repository

Install

⚠️️️

To use Oh-my-fish, you need install Fish shell fist.

As you can find on official repository, for install the Oh-my-fish, you only need to run the following command:

curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish

Commands

The first command I use is the help command, so: omf help - this will list all the commands and options for Oh-my-fish. The list below, show the commands I most use.

  • Install new package: omf install <package> (you can install multiple packages with only one command);
  • Search for packages: omf search <name-or-partial-name>;
  • List local/installed packages: omf list;
  • Remove/uninstall packages: omf remove <package>;
  • List themes: omf theme
  • Update Oh-my-fish: omf update;

Config

This is my personal configuration for Oh-my-fish, here you can find the alias and functions I created for my daily usage.

File: .config/fish/conf.d/omf.fish

⚠️️️

If you pretend to use any of my alias/functions, you need to add that specific code after the 4 fist lines and before of the last line (source ...)

Git Alias & Functions

.config/fish/conf.d/omf.fish
alias g="git"
alias gst="git status -sb"
alias gp="git push"
alias gl="git pull"
alias gco="git checkout"
alias gb="git branch"
alias gaa="git add ."
alias ga="git add"
alias grh="git reset --hard"
alias gr="git reset"
 
function goMain
    git checkout main
    git pull
end
 
function goMaster
    git checkout master
    git pull
end
 
function goBranch
    git checkout "$argv"
    git pull
end
 
function commt
    git add .
    git commit -m "$argv"
    git push
end

Homebrew Alias

.config/fish/conf.d/omf.fish
alias bci="brew install --cask"
alias bi="brew install"
alias bup="brew update"
alias bug="brew upgrade"
alias bcl="brew cleanup"
alias br="brew remove"
alias bsearch="brew search"

Linux (Debian distros) Alias

.config/fish/conf.d/omf.fish
alias aptI="sudo apt install"
alias aptR="sudo apt remove"
alias aptAR="sudo apt autoremove"
alias aptUp="sudo apt update -y"
alias aptUpg="sudo apt upgrade -y"

Docker Alias

.config/fish/conf.d/omf.fish
alias dps="docker ps --format '{{.Names}}'"
alias dpst="docker ps --format 'table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}'"
alias dpsl="docker ps --format='ID\t{{.ID}}\nNAME\t{{.Names}}\nIMAGE\t{{.Image}}\nPORTS\t{{.Ports}}\nCOMMAND\t{{.Command}}\nCREATED\t{{.CreatedAt}}\nSTATUS\t{{.Status}}\n'"
alias dvunused="docker volume ls -q -f 'dangling=true'"

Others

.config/fish/conf.d/omf.fish
# Navigation Alias
alias work="cd ~/Developer"
alias home="cd ~"
alias ..="cd .."
alias ...="cd ../.."
 
# Eza on LS
alias ls="eza --icons"
⚠️️️

As you can see I'm using a custom "ls", for that you need to install Eza (opens in a new tab)

Plugins

Plugins allow you to add new features to your shell. These are the list of plugins I'm currently use.

This git plugin add shortcuts for the most popular git commands.

GitHub Repository
  • How to install: omf install https://github.com/jhillyerd/plugin-git

But how to use it?

The list below contains some of the shortcuts and the respective full command or description.

  • gbD 👉 git branch -D;
  • gbda 👉 delete all branches merged in current HEAD;
  • ggsup 👉 git set upstream to origin/_current-branch_;
  • gcb 👉 git checkout -b;
  • gco 👉 git checkout;
  • gcm 👉 git commit -m;
  • gcam 👉 git commit -a -m;
  • gl 👉 git pull;
  • gp 👉 git push.