A repo with my Fish shell functions.
Some are very usable, yet some are just gimmicks and tinkering (e.g., cal
and
notify
), and some are simply outdated and irrelevant (e.g., vpn
).
Warning
Most of the functions here written for macOS as a platform. Yet some of them are entirely POSIX-compatible. Please check before use.
fish_prompt.fish
is a theme I currently use. Inspired by
Kenneth Reitz’ original theme for
Oh-my-ZSH.
Note
Not using it much these days because of Starship.
Activates Python's venv for current directory. A shorthand for
source ./bin/activate.fish
.
Usage: activate [-v]
Checks for asdf plugin newer versions.
Usage: asdf-check [--no-update]
Removes older asdf plugin versions.
Usage: asdf-prune [-f]
Updates asdf, its plugins, and reshims packages.
Usage: asdf-up [--prune] [--check-only]
Updates Homebrew, upgrades and cleans up packages, removes leftover deps.
Usage: brew-up
Handy wrapper to colorize current date in cal
. Arguments usage will reset layout to
normal.
Usage: cal [ARGS...]
Manages various utility configurations. For example: fish
, mise
, starship
.
Usage: config UTILITY
Utilities:
alacritty Opens the Alacritty config directory
bat Opens the bat config file
bottom, btm Opens the bottom config file
delta Opens the delta config file (same as Git)
fish Opens the Fish config directory
git Opens the Git global config file
hosts Opens the hosts config file [required: sudo]
jj Opens the jj config file
hx, helix Opens the Helix config directory
kube[ctl] Opens the kubectl config file
lsd Opens the lsd config directory
n[eo]vim Opens the Neovim config directory
rtx, mise Opens the mise-en-place (former rtx) config file
starship Opens the Starship config file
ssh Opens the SSH config file
Parameters:
UTILITY An utility name [required]
Measures time for a performed CURL request.
Usage: curl-time URL
Manages databases as containers (via Docker).
Usage: database COMMAND DATABASE [OPTS...]
Commands:
up/start Starts a new database container
down/stop Stops an existing database container
rm/remove Removes an existing database container
Mongo Commands:
dump Exports the content of a running server
restore Restores backups to a running server
Databases:
mongo Specifies MongoDB as a database
postgres Specifies Postgres as a database
redis Specifies Redis as a database
Mongo Dump/Restore Options:
--path=<PATH> Specifies a directory path or name
[default: "mongo-dump-<DATE>" and "."]
--db=<NAME> Specifies a database name
--coll=<NAME> Specifies a collection name
Parameters:
COMMAND A command name [required]
DATABASE A database name [required]
Displays current timestamp hash (hexadecimal representation).
Usage: date-hash
Displays the current date in ISO8601 (without milliseconds).
Usage: date-iso [--short]
Manages common DNS servers (Quad9 and Cloudflare) of a given network.
Usage: dns CMD [NAME]
Commands:
list/ls Lists current DNS servers of a network
add Adds common DNS servers to a network
rm/remove Removes common DNS servers from a network
clean Cleans all DNS servers of a network
Parameters:
CMD A command to perform [required]
NAME A network name [default: "Wi-Fi"]
Stops all containers, removes them and all images.
Usage: docker-reset
Flushes a macOS DNS cache.
Usage: flushdns
Interactive fuzzy finder.
It requires ripgrep
and fzf
or skim
.
Usage: fuzz [OPTS...] RG_QUERY [FZ_QUERY]
Options:
-s, --skim Use skim instead of fzf
Parameters:
RG_QUERY An initial filtering ripgrep query
FZ_QUERY A fuzzy finder query [optional]
Generates either an X.509 cert, SSH key, or random base64 string.
Usage: gen ENTITY [OPTS...]
Entities:
x509/cert Generate an X.509 certificate
ssh/key Generate an SSH key
base64/b64 Generate a random base64 string
X.509 Options:
--cn=<NAME> Certificate common name [default: "localhost"]
--days=<NUM> Certificate validity period [default: 365]
SSH Options:
--filename=<NAME> SSH key filename [default: "key"]
--comment=<TEXT> SSH key comment [default: "username@hosname"]
Base64 Options:
--bits=<NUM> Base64 binary bit-length [default: 32]
Parameters:
ENTITY An entity name [required]
Hides (or reveals) a given item (file, link, or directory) from GUI.
Usage: hide [--rev] PATH
Easier way to add a subnetwork in /etc/ppp/ip-up
. Usable for a selective VPN traffic.
Usage: ip-up-add SUBNET [COMMENT]
Kickstarts a new software development project.
Usage: kick [OPTS...] [TARGET]
Options:
--lang=python Creates a Python project [default]
--lang=go Creates a Go project
--lang=rust Creates a Rust project
--lang=zig Creates a Zig project
--name=<NAME> Specifies the project name [default: "unnamed"]
--lib Specifies the project is a library
--no-git Omits Git VCS initialization
--no-readme Omits README.md creation
Python Options:
-V, --no-venv Ignores Python virtual environment creation
Parameters:
TARGET A target directory [default: "."]
Displays or sets current Kube context.
Usage: kube-ctx [CTX]
Resets macOS Launchpad layout.
Usage: launchpad-reset
Checks for mise-en-place (former rtx) plugin newer versions.
Usage: mise-check [--verbose]
Updates mise-en-place (former rtx) packages (and reshims them).
Usage: mise-up [--check-only]
Configures a local mise-en-place (former rtx) Python with a virtual environment.
Usage: mise-venv
Displays network stuff (IP address(es), used port(s), etc).
Usage: net CMD [OPTS...]
Commands:
addrs Display the current public IP address(es)
ports Display the port(s) currently in use
Addresses Options:
-4, --ipv4 Prefer an IPv4 address
-6, --ipv6 Prefer an IPv6 address
Ports Options:
-p, --proto=<PROTO> A protocol to lookup [default: "TCP"]
-s, --state=<STATE> A state to lookup [default: "LISTEN"]
-n, --num PORT A port number to lookup
Displays a macOS notification.
Usage: notify MESSAGE [TITLE [SUBTITLE]]
Copies a GPG public key.
Usage: pbcopy-gpg [FINGERPRINT]
Copies an SSH public key (that starts with id_
).
Usage: pbcopy-ssh [TYPE]
A wrapper around the ping
with a default address (1.1.1.1).
Usage: ping [ARGS...]
Removes local Python packages, except the default ones.
It supports both pip
and uv
.
Usage: pip-reset
Updates local Python packages listed in the default packages file.
It supports both pip
and uv
.
Usage: pip-up
Cleans directory Python cache and pre-compiled modules recursively.
Usage: pyclean
Evaluates an actual semantic version for a Git Flow repo.
Usage: semver [-lv]
Runs a local Python SMTP DebuggingServer
.
Usage: smtp [PORT]
Updates macOS software.
Usage: soft-up [--check-only]
Exports variables from a POSIX-compatible environment file.
Usage: source-posix FILE [-v]
Calculates the subresource integrity hash for a given file.
Usage: sri-hash FILE
Displays current time in given timezones, e.g. US/Pacific
, UTC
, Asia/Bangkok
and
etc. See /usr/share/zoneinfo/
for more.
Usage: tztime TIMEZONE
Disables macOS Gatekeeper for a specified application.
Usage: unlock PATH [--sign]
Updates macOS software, Homebrew, mise-en-place, and local Python packages.
An alias for soft-up
, brew-up
, mise-up
, and pip-up
.
Usage: up-up [--all]
Simple wrapper for Python’s venv
module.
Usage: venv [--reset] [--rm]
Faster way to handle existing PPTP/L2TP connections in macOS. Not so usable for L2TP, because of a shared key.
Usage: vpn [list | start CONN | stop CONN | switch CONN]