'zsh alias command for la or ls, not working
I've got a referenced file called ~/.zsh/aliases. Inside this file, I have an alias:
alias la='exa --icons -lah'
In my ~/.zshrc, I have sourced this file towards to bottom of the file:
source ~/.zsh/aliases
source ~/.zsh/path
source ~/.zsh/var
However, the la command is doing a "normal" la. I've tried with other aliases and they work. For example, alias gc='exa --icons -lah' will work. But if I assign la with something else, it also doesn't work. For example, alias la='git commit' doesn't work.
It seems like la is taken and can't be overwritten.
Solution 1:[1]
For me the problem was the position of the alias inside the .zshrc file, i solved that by putting it to the bottom of the file. Hope it works for you too
Solution 2:[2]
Fixed this issue by sourcing the referenced file from my terminal, rather than just inside .zshrc.
So, to work run this inside the terminal:
source ~/.zsh/aliases
Not sure why it wasn't getting picked up from .zshrc.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fedann |
| Solution 2 | Anthony Dellavecchia |
