Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest your config #24

Open
black7375 opened this issue Mar 21, 2021 · 7 comments
Open

Suggest your config #24

black7375 opened this issue Mar 21, 2021 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@black7375
Copy link
Owner

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

Recommend it!

@black7375 black7375 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 21, 2021
@black7375 black7375 pinned this issue Mar 28, 2021
@sagarkar10
Copy link

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.

@black7375
Copy link
Owner Author

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

@sagarkar10
Copy link

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.

@black7375
Copy link
Owner Author

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.

@sagarkar10
Copy link

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

@sagarkar10
Copy link

Can i have your complete zsh setup to test?

@black7375
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants