1 unstable release
0.1.0 | May 16, 2023 |
---|
#22 in #nice
16KB
430 lines
format-aliases
This is a reimplementation of the OhMyZsh alias cheatsheet plugin.
$ alias
[nvim]
vim='nvim'
wiki='nvim +VimwikiIndex'
[vim]
emacs='vim'
vi='vim'
[ls]
l='ls -alh'
ll='ls -l'
[path]
spath='path --sort'
tpath='path --tree'
Installation
Cargo
cargo install format-aliases
Nix Flake
This repo is a flake. The derivation with the exec is format-aliases.packages.${system}.default
Setup
Run the format-aliases
init sequence in your shell's rc file. A new function will be included in your shell that overrides the alias
builtin.
# Posix shell example
alias() {
if [ $# -eq 0 ]; then
# Pipe the output of the builtin alias command to be formatted
builtin alias | format-aliases
else
# Pass the arguments to the builtin alias command
builtin alias ${@}
fi
}
Init sequences by shell
Zsh
eval "$(format-aliases init zsh)"
Bash
eval "$(format-aliases init bash)"
Bourne Shell (sh)
eval "$(format-aliases init sh)"
Usage
Run the new alias
command without any args to display all active aliases. Running with input args will pass args to the shell's alias
builtin.
Color control
Printing in color is enabled by default. Set env var NO_COLOR
to disable.
NO_COLOR alias
Dependencies
~5–17MB
~175K SLoC