BlaCk-Void-Zsh icon indicating copy to clipboard operation
BlaCk-Void-Zsh copied to clipboard

Suggest your config

Open black7375 opened this issue 3 years ago • 7 comments

Is there anything useful in the existing Bash or Zsh settings that you have?

Recommend it!

black7375 avatar Mar 21 '21 06:03 black7375


if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

ZSH_DISABLE_COMPFIX="true"
if [[ $(uname) != "Linux" ]]
then
    export ZSH="$HOME"/.oh-my-zsh
fi

ZSH_THEME="powerlevel10k/powerlevel10k"
COMPLETION_WAITING_DOTS="true"
plugins=(
  zsh-autosuggestions
  git
  wd
  python
  autojump 
  zsh-syntax-highlighting
  docker
)

source $ZSH/oh-my-zsh.sh
export LANG=en_US.UTF-8

 if [[ -n $SSH_CONNECTION ]]; then
   export EDITOR='vim'
 else
   export EDITOR='vim'
 fi

# non-specific
source ~/.zsh_aliases
source ~/.tmuxinator/tmuxinator.zsh
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
setopt HIST_SAVE_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS

# autojump
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh

# everything FZF
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='fd --type f'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_COMPLETION_TRIGGER='**'

export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border --info=inline'

_fzf_compgen_path() {
  fd --hidden --follow --exclude ".git" . "$1"
}

_fzf_compgen_dir() {
  fd --type d --hidden --follow --exclude ".git" . "$1"
}

_fzf_comprun() {
  local command=$1
  shift

  case "$command" in
    cd)           fzf "$@" --preview 'tree -C {} | head -200' ;;
    export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;;
    ssh)          fzf "$@" --preview 'dig {}' ;;
    vi|vim)           fzf "$@" --preview 'bat --style=numbers --color=always --line-range :500 {}' ;;
    *)            fzf "$@" ;;
  esac
}

# auto suggest bindings
bindkey "^[[1;3B" backward-kill-word
bindkey "^[[1;3D" backward-word
bindkey "^[[1;3C" forward-word
bindkey "^[[1;9B" backward-kill-word
bindkey "^[[1;9D" backward-word
bindkey "^[[1;9C" forward-word

export PATH="/usr/local/sbin:$PATH"

# powerline
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# conda setup
__conda_setup="$('/Users/sagarkar/conda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/sagarkar/conda/etc/profile.d/conda.sh" ]; then
        . "/Users/sagarkar/conda/etc/profile.d/conda.sh"
    else
        export PATH="/Users/sagarkar/conda/bin:$PATH"
    fi
fi
unset __conda_setup

Let me know if you think something is off or can be modified.

sagarkar10 avatar Nov 21 '21 04:11 sagarkar10

It's a concise setup, and I don't think there's much to tweak.

But I can give you some advice as far as I know.


Typically this setting in ~/.zshenv

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

And there are some settings that can make startup slower.

OMZ is slow to load. You can use a plugin manager like zinit.

plugins=(
  zsh-autosuggestions
  git
  wd
  python
  autojump 
  zsh-syntax-highlighting
  docker
)
source $ZSH/oh-my-zsh.sh

It may take a lot of time to eval.

After executing eval only once, it is a good idea to save it to a file and load it.

__conda_setup="$('/Users/sagarkar/conda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/sagarkar/conda/etc/profile.d/conda.sh" ]; then
        . "/Users/sagarkar/conda/etc/profile.d/conda.sh"
    else
        export PATH="/Users/sagarkar/conda/bin:$PATH"
    fi
fi
unset __conda_setup

This is my fzf setting https://github.com/black7375/BlaCk-Void-Zsh/blob/master/lib/fzf-set.zsh

black7375 avatar Nov 22 '21 13:11 black7375

Thanks a lot for your advice.

The eval is running the first time only or if someone deletes the file. If you are saying something different please clarify.

sagarkar10 avatar Nov 23 '21 10:11 sagarkar10

My intention was this part.

__conda_setup="$('/Users/sagarkar/conda/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"

For example, When profiling in the past, $(brew --prefix) was very slow. Some external processes can be bottlenecks.

black7375 avatar Nov 24 '21 01:11 black7375

Got it. Will look it up. Thanks a lot. Any document about the bootup speed comparison for omz vs zint or similar.

sagarkar10 avatar Nov 24 '21 03:11 sagarkar10

Can i have your complete zsh setup to test?

sagarkar10 avatar Nov 25 '21 17:11 sagarkar10

My basic zsh configuration is based on this repo. There's nothing much to it.

source /home/black7375/.zsh/BlaCk-Void.zshrc
# export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $1; exit;}'):0
export DISPLAY=:0
xhost +

alias rust=evcxr

black7375 avatar Nov 27 '21 11:11 black7375