Software Engineer at Supabase
March 13, 2024
Oh-My-Zsh simplifies the process of adding custom aliases to your Zsh configuration. Let's explore how to do this using Vim, a powerful terminal text editor, and how to edit the alias file visually:
Open a terminal and go to the custom directory within the Oh-My-Zsh configuration:
# bash
cd ~/.oh-my-zsh/customInside the custom directory, create a file to store your aliases. For example:
# bash
touch aliases.zshOpen the file with Vim:
# bash
vim aliases.zshIn Vim, press i to enter insert mode. Add your custom aliases to the file:
# bash
# ~/.oh-my-zsh/custom/aliases.zsh
alias ll='ls -alF'
alias myalias='some_command'After adding aliases, press Esc to exit insert mode, then type :wq and press Enter to save and quit Vim.
If you prefer to edit the file visually using a GUI text editor, you can open the file with the default editor:
# bash
xdg-open aliases.zsh # This command works on Linux with XDG# bash
open -e aliases.zsh # macOS# bash
start aliases.zsh # windowsFinally, apply the changes by reloading your Zsh configuration:
# bash
source ~/.zshrcYour custom aliases are now ready to use. Test them in the terminal:
# bash
llYou should see the result of ls -alF.
Hope this was helpful.