This is a plugin for oh-my-zsh that reminds you every time you type a command you have an alias for. It will also suggest aliases for commonly used commands.
1.) Clone the repository or download as a zip
git clone https://github.com/claymullis/alias-coach.git
or
wget https://github.com/claymullis/alias-coach/archive/master.zip
2.) Unzip if needed and move folder alias-coach to ~/.oh-my-zsh/plugins/
# unzip alias_coach.zip
mv alias-coach ~/.oh-my-zsh/plugins/
3.) Add the plugin to your ~/.oh-my-zsh/zshrc
plugins=(
#...
alias-coach
#...
)
For this ~/.zshrc
alias dir=ls
Here are the results of calling ls. Note the output --- Reminder: alias dir=ls ---
is appended to the results of the command.
> ls .
Folder
--- Reminder: alias dir=ls ---
After three failed attempts, program should interactively prompt you to change, delete or ignore the alias. Pressing enter with no input will ignore.
> ls
Folder
--- Reminder: `alias dir=ls` ---
> ls
Folder
--- Reminder: `alias dir=ls` ---
> ls
ls
Folder
--- Reminder: `alias dir=ls` ---
--- 3 failures. [c]hange/[d]elete/[I]gnore?
If you use the same command frequently you will be asked if you want to alias it.
Commonly aliased commands will have friendly commands suggested from an opinionated master-list of good aliases to have. Otherwise you will be asked to type an alias name.
> ls -al
.git
srcf
> ls -al
total 0
drwxr-xr-x 3 > staff 96 Nov 21 19:51 .
drwxr-xr-x+ 34 > staff 1088 Nov 24 05:43 ..
drwxr-xr-x+ 34 > staff 1088 Nov 24 05:43 .git
drwxr-xr-x 10 > staff 320 Nov 21 19:52 hello-world
> ls -al
total 0
drwxr-xr-x 3 > staff 96 Nov 21 19:51 .
drwxr-xr-x+ 34 > staff 1088 Nov 24 05:43 ..
drwxr-xr-x+ 34 > staff 1088 Nov 24 05:43 .git
drwxr-xr-x 10 > staff 320 Nov 21 19:52 hello-world
> ls -al
total 0
drwxr-xr-x 3 > staff 96 Nov 21 19:51 .
drwxr-xr-x+ 34 > staff 1088 Nov 24 05:43 ..
drwxr-xr-x+ 34 > staff 1088 Nov 24 05:43 .git
drwxr-xr-x 10 > staff 320 Nov 21 19:52 hello-world
--- Suggestion: `alias ls='ls -al'` ---
--- [c]reate/[e]dit/[I]gnore?
[c]reate
--- [c]reate/[e]dit/[I]gnore? c
--- Added alias `alias ls='ls -al'` to ~/.zshrc ---
>
[e]dit
--- [c]reate/[e]dit/[I]gnore? e
--- Enter custom alias name: ls_all
--- Added alias `alias ls_all='ls -al'` to ~/.zshrc ---
>
[I]gnore
--- [c]reate/[e]dit/[I]gnore? i
>
Written by Clay Mullis. MIT License, do whatever you want to with it.