From a32b8301dfa971da82fed65364a6c0495a6c9e2d Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Wed, 19 Apr 2023 00:30:15 +0800 Subject: [PATCH] Fix unexpected stdout --- .zshrc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.zshrc b/.zshrc index fee8f92..fbf82d5 100644 --- a/.zshrc +++ b/.zshrc @@ -76,7 +76,7 @@ setup_pyenv() { pyenv_loaded=0 setup_pyenv_on_demand() { setup_pyenv_once() { - if [[ ! -d "$PYENV_ROOT" ]] && ! which pip 2>&1 >/dev/null; then + if [[ ! -d "$PYENV_ROOT" ]] && ! which pip >/dev/null 2>/dev/null; then git clone https://github.com/pyenv/pyenv.git "$PYENV_ROOT" fi if [[ "$pyenv_loaded" != 1 ]]; then @@ -118,11 +118,11 @@ export NVM_DIR="$HOME/.nvm" setup_ruby() { export PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH" } -which ruby 2>&1 >/dev/null && setup_ruby +which ruby >/dev/null 2>/dev/null && setup_ruby setup_go() { export PATH="$(go env GOPATH)/bin:$PATH" } -which go 2>&1 >/dev/null && setup_go +which go >/dev/null 2>/dev/null && setup_go setup_g() { export PATH="$HOME/go/bin:$PATH" GOPATH="$HOME/go" GOROOT="$HOME/.go" # g-install: do NOT edit, see https://github.com/stefanmaric/g } @@ -143,7 +143,7 @@ setup_rbenv() { rbenv_loaded=0 setup_rbenv_on_demand() { setup_rbenv_once() { - if [[ ! -d "$RBENV_ROOT" ]] && ! which ruby 2>&1 >/dev/null; then + if [[ ! -d "$RBENV_ROOT" ]] && ! which ruby >/dev/null 2>/dev/null; then git clone https://github.com/rbenv/rbenv.git "$RBENV_ROOT" fi if [[ "$rbenv_loaded" != 1 ]]; then @@ -182,7 +182,7 @@ if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then alias icat="imgcat" alias ssh="TERM=xterm-256color ssh" fi -if [[ "$TERM" == "xterm-kitty" ]] && which kitty 2>&1 >/dev/null; then +if [[ "$TERM" == "xterm-kitty" ]] && which kitty >/dev/null 2>/dev/null; then alias icat="kitty +kitten icat" alias ssh="kitty +kitten ssh" fi @@ -227,10 +227,10 @@ setup_completion() { zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' # Setup fast apps - if which mc 2>&1 >/dev/null; then + if which mc >/dev/null 2>/dev/null; then complete -o nospace -C mc mc fi - if which earthly 2>&1 >/dev/null; then + if which earthly >/dev/null 2>/dev/null; then complete -o nospace -C earthly earthly fi } @@ -239,7 +239,7 @@ setup_completion_more() { # Depends: setup_completion - if which kubectl 2>&1 >/dev/null; then + if which kubectl >/dev/null 2>/dev/null; then source <(kubectl completion zsh) fi if [[ -d "$NVM_DIR" ]]; then @@ -257,7 +257,7 @@ alias lesscolor="less --RAW-CONTROL-CHARS" export LS_COLORS='no=00:fi=00:di=36:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.hpp=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.cl=32:*.sh=32:*.bash=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.go=32:*.sql=32:*.csv=32:*.sv=32:*.svh=32:*.v=32:*.vh=32:*.vhd=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.PNG=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.nef=33:*.NEF=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpeg=33:*.mpg=33:*.ogg=33:*.opus=33:*.ra=33:*.wav=33:*.anx=33:*.asf=33:*.avi=33:*.axv=33:*.flc=33:*.fli=33:*.flv=33:*.gl=33:*.m2v=33:*.m4v=33:*.mkv=33:*.mov=33:*.MOV=33:*.mp4=33:*.mp4v=33:*.mpeg=33:*.mpg=33:*.nuv=33:*.ogm=33:*.ogv=33:*.ogx=33:*.qt=33:*.rm=33:*.rmvb=33:*.swf=33:*.vob=33:*.webm=33:*.wmv=33:*.doc=31:*.docx=31:*.rtf=31:*.odt=31:*.dot=31:*.dotx=31:*.ott=31:*.xls=31:*.xlsx=31:*.ods=31:*.ots=31:*.ppt=31:*.pptx=31:*.odp=31:*.otp=31:*.fla=31:*.psd=31:*.7z=1;35:*.apk=1;35:*.arj=1;35:*.bin=1;35:*.bz=1;35:*.bz2=1;35:*.cab=1;35:*.deb=1;35:*.dmg=1;35:*.gem=1;35:*.gz=1;35:*.iso=1;35:*.jar=1;35:*.msi=1;35:*.rar=1;35:*.rpm=1;35:*.tar=1;35:*.tbz=1;35:*.tbz2=1;35:*.tgz=1;35:*.tx=1;35:*.war=1;35:*.xpi=1;35:*.xz=1;35:*.z=1;35:*.Z=1;35:*.zip=1;35:*.zst=1;35:*.ANSI-30-black=30:*.ANSI-01;30-brblack=01;30:*.ANSI-31-red=31:*.ANSI-01;31-brred=01;31:*.ANSI-32-green=32:*.ANSI-01;32-brgreen=01;32:*.ANSI-33-yellow=33:*.ANSI-01;33-bryellow=01;33:*.ANSI-34-blue=34:*.ANSI-01;34-brblue=01;34:*.ANSI-35-magenta=35:*.ANSI-01;35-brmagenta=01;35:*.ANSI-36-cyan=36:*.ANSI-01;36-brcyan=01;36:*.ANSI-37-white=37:*.ANSI-01;37-brwhite=01;37:*.log=01;32:*~=01;32:*#=01;32:*.bak=01;33:*.BAK=01;33:*.old=01;33:*.OLD=01;33:*.org_archive=01;33:*.off=01;33:*.OFF=01;33:*.dist=01;33:*.DIST=01;33:*.orig=01;33:*.ORIG=01;33:*.swp=01;33:*.swo=01;33:*.v=01;33:*.gpg=34:*.gpg=34:*.pgp=34:*.asc=34:*.3des=34:*.aes=34:*.enc=34:*.sqlite=34:' export CLICOLOR=1 export TIME_STYLE=iso -if which exa 2>&1 >/dev/null; then +if which exa >/dev/null 2>/dev/null; then alias ls=exa fi alias ll="ls -l" @@ -267,7 +267,7 @@ llp() { # grep -if which rg 2>&1 >/dev/null; then +if which rg >/dev/null 2>/dev/null; then rgp() { rg --line-number --heading --color=always "$@" | lesscolor } @@ -515,7 +515,7 @@ setup_assistance() { } slower_functions+=( setup_assistance ) setup_nope() { - if which thefuck 2>&1 >/dev/null; then + if which thefuck >/dev/null 2>/dev/null; then eval $(thefuck --alias nope) fi } @@ -565,7 +565,7 @@ function theme { fi setup_prompt if [[ -z "$SSH_CLIENT" ]]; then - if [[ $PLATFORM == linux ]] && which gsettings 2>&1 >/dev/null; then + if [[ $PLATFORM == linux ]] && which gsettings >/dev/null 2>/dev/null; then gsettings set org.gnome.desktop.interface gtk-theme $gnome_theme gsettings set org.gnome.desktop.interface color-scheme $gnome_color_scheme fi @@ -577,7 +577,7 @@ function theme { # gnupg -if which gpgconf 2>&1 >/dev/null; then +if which gpgconf >/dev/null 2>/dev/null; then if [[ -z "$SSH_CLIENT" ]] || [[ -z "$SSH_AUTH_SOCK" ]]; then # use gpg agent for SSH if not connected over SSH export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" @@ -586,7 +586,7 @@ if which gpgconf 2>&1 >/dev/null; then # start gpg agent for SSH access gpg-connect-agent /bye >/dev/null 2>&1 fi - if [[ $PLATFORM == macos ]] && which pinentry-mac 2>&1 >/dev/null; then + if [[ $PLATFORM == macos ]] && which pinentry-mac >/dev/null 2>/dev/null; then # if pinentry-mac exists, relink if not done # see https://github.com/Homebrew/linuxbrew-core/blob/fd3dadc66f11b7317035e76552992ef368adf7ea/Formula/gnupg.rb#L46 pinentry_configure="/usr/local/opt/pinentry/bin/pinentry"