Skip to content

Commit

Permalink
[sh] Add conditional direnv/zoxide initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
kneitinger committed Dec 25, 2024
1 parent 0e0767e commit e6a0432
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"
key[Esc-Period]="\e."
key[Ctrl-H]="^h"
key[Ctrl-J]="^j"
key[Ctrl-K]="^k"
key[Ctrl-T]="^t"
key[Alt-H]="^[h"
key[Alt-L]="^[l"
key[Alt-U]="^[u"
Expand Down Expand Up @@ -175,8 +177,24 @@ safe_bind Esc-Period insert-last-word

safe_bind Delete delete-char

if type zoxide &>/dev/null; then
eval "$(zoxide init zsh)"
zi-widget() { zi; }
zle -N zi-widget
safe_bind Ctrl-T zi-widget
safe_bind Ctrl-H zi-widget
else
echo "Skipping zoxide hook, zoxide not found"
fi

unfunction safe_bind

if type direnv &>/dev/null; then
eval "$(direnv hook zsh)"
else
echo "Skipping direnv hook, direnv not found"
fi

# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
Expand Down

0 comments on commit e6a0432

Please sign in to comment.