zsh: cleanup command lookup

master
bretello 2024-04-05 15:01:10 +02:00
parent 7312c868b3
commit 114bbe758e
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
1 changed files with 6 additions and 10 deletions

View File

@ -18,19 +18,19 @@ antibody bundle < "$DOTFILES/antibody_plugins.txt"
source $DOTFILES/completion_style.zsh
source $DOTFILES/extras/fzf-tab-config.zsh
if command -vp fd >/dev/null; then
if [[ $+commands[fd] ]]; then
export FZF_CTRL_T_COMMAND='fd'
else
export FZF_CTRL_T_COMMAND='find'
fi
export FZF_CTRL_T_OPTS=" --preview-window=right,60% --preview \"bash -c 'if [[ -d \"{}\" ]]; then tree -C \"{}\"; else bat --style=plain --color=always \"{}\"; fi'\" --bind 'ctrl-/:change-preview-window(right,70%|down,40%,border-horizontal|hidden|right)'"
if [[ "$(command -v systemctl)" ]]; then
if [[ $+commands[systemctl] ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/systemd
fi
if [[ "$(command -v pacman)" ]]; then
if [[ $+commands[pacman] ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/archlinux
elif [[ "$(command -v apt-get)" ]]; then
elif [[ $+commands[apt-get] ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
fi
@ -82,12 +82,8 @@ export ZSH_AUTOSUGGEST_COMPLETION_IGNORE='* \#*' # prevent completion for commen
# less options
export LESS='-xRF-j12' # -j12: displays 12 lines before search results with / and ?
if [[ "$(command -v bat)" || "$(command -v batcat)" ]]; then
if [[ "$(command -v bat)" ]]; then
cmd=bat
else
cmd=batcat
fi
if [[ $+commands[bat] || $+commands[batcat] ]]; then
if [[ $+commands[bat] ]]; then cmd=bat else cmd=batcat fi
alias cat=$cmd
export PAGER=$cmd