Skip to content

Commit 421bf75

Browse files
committed
feat: fix command aliases
1 parent 2f5271b commit 421bf75

3 files changed

Lines changed: 49 additions & 9 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
eval "$(mise activate zsh)"
1+
command -v mise >/dev/null && eval "$(mise activate zsh)"

roles/neovim/files/profile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
alias vim='nvim'
1+
vim() {
2+
if command -v nvim >/dev/null 2>&1; then
3+
nvim "$@"
4+
else
5+
command vim "$@"
6+
fi
7+
}

roles/zsh/templates/zshrc

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if [[ -z "$ZELLIJ" ]]; then
1+
if [[ -z "$ZELLIJ" ]] && command -v zellij >/dev/null; then
22
zellij attach -c main
33
fi
44

@@ -63,9 +63,43 @@ fi
6363
# Initialize starship prompt
6464
eval "$(starship init zsh)"
6565

66-
# Aliases
67-
alias cat='bat -p'
68-
alias ls='eza'
69-
alias ll='eza -l'
70-
alias la='eza -la'
71-
alias cd='z'
66+
# Command wrappers - check availability on each call for graceful fallback
67+
cat() {
68+
if command -v bat >/dev/null 2>&1; then
69+
bat -p "$@"
70+
else
71+
command cat "$@"
72+
fi
73+
}
74+
75+
ls() {
76+
if command -v eza >/dev/null 2>&1; then
77+
eza "$@"
78+
else
79+
command ls "$@"
80+
fi
81+
}
82+
83+
ll() {
84+
if command -v eza >/dev/null 2>&1; then
85+
eza -l "$@"
86+
else
87+
command ls -l "$@"
88+
fi
89+
}
90+
91+
la() {
92+
if command -v eza >/dev/null 2>&1; then
93+
eza -la "$@"
94+
else
95+
command ls -la "$@"
96+
fi
97+
}
98+
99+
cd() {
100+
if command -v zoxide >/dev/null 2>&1; then
101+
z "$@"
102+
else
103+
builtin cd "$@"
104+
fi
105+
}

0 commit comments

Comments
 (0)