Too many aliases? Pshaw! There's no such thing
Buckets of aliases
I've put a few aliases in my .zshrc
or .bashrc
to simplify all the
things—translation: I'm too lazy to type that much.
I also use oh-my-zsh, and
plugins for oh-my-zsh. For example, in my .zshrc
I have the
following plugins that generate many useful aliases:
plugins=(bower brew bundler capistrano copydir copyfile django
fabric gem git git-extras gitignore heroku node npm nvm pip
postgres python rails rsync ruby safe-paste ssh-agent tmux
tmuxinator virtualenv virtualenvwrapper vundle xcode)
Chunking alias with ack
Occasionally, I need to see a list, and typing alias
will print that list,
but that list is now long so I take advantage of grep
, or more often
ack, to return a chunk of aliases like so:
# Print out a paginated list of all aliases that start with the letter "r"
alias|grep "^r"|less
I show grep
first because everyone using a POSIX-compliant OS has
it, but I prefer use ack
because it's better. I even have an
.ackrc
full of useful options.
So now I can just type:
alias|ack "r"
or just put 1 function and 1 more alias in my .zshrc
(I know. Crazy right?):
ack_alias() {
alias|ack "^$1"
}
alias ackk=ack_alias
and in a new shell source .zshrc
and voilà: typing ackk r
now produces a much shorter, paginated list of
aliases that begin with the letter "r".