Switch to proper if statements.

This commit is contained in:
Bartek Stalewski 2023-05-03 01:34:27 +02:00
parent a94de99041
commit e58497ec55
3 changed files with 42 additions and 12 deletions

View file

@ -1,5 +1,9 @@
# prepare directories
[ ! -L ~/.cache ] && { rm -rf ~/.cache; mkdir -p $XDG_CACHE_HOME; ln -sf $XDG_CACHE_HOME ~/.cache ; }
if [[ ! -L ~/.cache ]]; then
rm -rf ~/.cache
mkdir -p $XDG_CACHE_HOME
ln -sf $XDG_CACHE_HOME ~/.cache
fi
mkdir -p $XDG_DATA_HOME/zsh
mkdir -p $XDG_CACHE_HOME/zsh
@ -13,7 +17,9 @@ setopt HIST_REDUCE_BLANKS
setopt SHARE_HISTORY
setopt INC_APPEND_HISTORY
[ -z $DISPLAY ] && export PATH=~/.local/bin:$PATH
if [[ -z $DISPLAY ]]; then
export PATH=~/.local/bin:$PATH
fi
# source configuration
source $ZDOTDIR/aliases.zsh
@ -34,7 +40,11 @@ source $XDG_DATA_HOME/repos/zsh_modules/powerlevel10k/powerlevel10k.zsh-theme
if [[ -r "$XDG_CACHE_HOME/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "$XDG_CACHE_HOME/p10k-instant-prompt-${(%):-%n}.zsh"
fi
[ $(command -v vivid) ] && export LS_COLORS=$(vivid generate molokai) || unset LS_COLORS
if [[ $(command -v vivid) ]]; then
export LS_COLORS=$(vivid generate molokai)
else
unset LS_COLORS
fi
tabs 2
# completion
@ -42,7 +52,10 @@ zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors ''
autoload -Uz compinit
[ ! -e $XDG_DATA_HOME/zsh/zcompdump.zwc ] && autoload -Uz zrecompile && zrecompile -p -R $XDG_DATA_HOME/zsh/zcompdump
if [ ! -e $XDG_DATA_HOME/zsh/zcompdump.zwc ]; then
autoload -Uz zrecompile
zrecompile -p -R $XDG_DATA_HOME/zsh/zcompdump
fi
if [[ -n $XDG_DATA_HOME/zsh/zcompdump(#qN.mh+24) ]]; then
compinit -d $XDG_DATA_HOME/zsh/zcompdump
else
@ -50,11 +63,14 @@ else
fi
# quick note functionality
if [ -f ~/.note ]; then
if [[ -f ~/.note ]]; then
echo
cat ~/.note
echo
fi
# local settings
[ -f ~/.local/config/zsh ] && source ~/.local/config/zsh
if [[ -f ~/.local/config/zsh ]]; then
source ~/.local/config/zsh
fi

View file

@ -3,8 +3,11 @@ alias gae='git add .; git commit --amend; git push --force-with-lease'
alias less='less -R'
alias startx='xinit ~/.config/xinitrc -- /etc/X11/xinit/xserverrc :0 -ardelay 280 -arinterval 30'
[ $(command -v bat) ] && alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
if [ $(command -v exa) ]; then
if [[ $(command -v bat) ]]; then
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
fi
if [[ $(command -v exa) ]]; then
alias ls='exa --group-directories-first'
alias ll='ls -l --git --octal-permissions --no-permissions'
else
@ -14,9 +17,15 @@ else
esac
alias ll='ls -l'
fi
if [ $(command -v fd) ]; then
[ -f ~/.local/config/fd ] && alias fd='fd -H -L --ignore-file ~/.local/config/fd' || alias fd='fd -H -L'
if [[ $(command -v fd) ]]; then
if [[ -f ~/.local/config/fd ]]; then
alias fd='fd -H -L --ignore-file ~/.local/config/fd'
else
alias fd='fd -H -L'
fi
fi
if [ $(command -v nvim) ]; then
export EDITOR=nvim
export MANPAGER="nvim +Man!"
@ -27,7 +36,12 @@ elif [ $(command -v vim) ] ; then
else
export EDITOR=vi
fi
[ $(command -v rg) ] && alias grep='rg -i' || alias grep='grep --color'
if [[ $(command -v rg) ]]; then
alias grep='rg -i'
else
alias grep='grep --color'
fi
function ud() {
wd dots && git pull

View file

@ -1,4 +1,4 @@
if [ $(command -v fzf) ]; then
if [[ $(command -v fzf) ]]; then
case $(lsb_release -i | awk '{print $3}') in
Gentoo) source /usr/share/zsh/site-functions/_fzf ;;
VoidLinux) source /usr/share/fzf/completion.zsh ;;