Skip to content

Instantly share code, notes, and snippets.

@VictorQueiroz
Created December 3, 2024 22:25
Show Gist options
  • Select an option

  • Save VictorQueiroz/dc5dbec49f6a55fe74780093aac83b93 to your computer and use it in GitHub Desktop.

Select an option

Save VictorQueiroz/dc5dbec49f6a55fe74780093aac83b93 to your computer and use it in GitHub Desktop.
My ZSH configuration using Znap, Oh My ZSH, and more plugins.
## Download Znap, if it's not there yet.
[[ -r ~/Repos/znap/znap.zsh ]] ||
git clone --depth 1 -- \
https://github.com/marlonrichert/zsh-snap.git ~/Repos/znap
source ~/Repos/znap/znap.zsh # Start Znap Load Znap
# Load Oh My Zsh
znap source ohmyzsh/ohmyzsh
# znap source sorin-ionescu/prezto modules/{environment,history}
znap source marlonrichert/zsh-edit
# Load `zsh-completions` plugin
znap source zsh-users/zsh-completions
# Load `zsh-autosuggestions`
ZSH_AUTOSUGGEST_STRATEGY=( history )
znap source zsh-users/zsh-autosuggestions
# Load `zsh-syntax-highlighting`
ZSH_HIGHLIGHT_HIGHLIGHTERS=( main brackets )
znap source zsh-users/zsh-syntax-highlighting
# You may need to manually set your language environment
export LANG='en_US.UTF-8'
# Preferred language order
export LC_ALL="$LANG"
# Configure command history
HISTFILE="$HOME/.zsh_history"
HISTSIZE=80000000
SAVEHIST=$HISTSIZE
setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS # Do not display a line previously found.
setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file.
setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry.
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
setopt HIST_BEEP # Beep when accessing nonexistent history.
# Alias `open` to `xdg-open`
alias open=xdg-open
# Set OMZ theme
ZSH_THEME="agnoster"
# Load Oh My Zsh
source ~/Repos/ohmyzsh/ohmyzsh/oh-my-zsh.sh
znap source marlonrichert/zcolors
znap eval marlonrichert/zcolors "zcolors ${(q)LS_COLORS}"
znap eval trapd00r/LS_COLORS "$( whence -a dircolors gdircolors ) -b LS_COLORS"
# Load `pyenv` when needed
znap function _pyenv pyenv 'eval "$( pyenv init - --no-rehash )"'
compctl -K _pyenv pyenv
# Load `pip` when needed
znap function _pip_completion pip 'eval "$( pip completion --zsh )"'
compctl -K _pip_completion pip
# Load `pipx` when needed
znap function _python_argcomplete pipx 'eval "$( register-python-argcomplete pipx )"'
complete -o nospace -o default -o bashdefault \
-F _python_argcomplete pipx
# Load `pipenv` when needed
znap function _pipenv pipenv 'eval "$( pipenv --completion )"'
compdef _pipenv pipenv
# Lazy load `sdkman`
export SDKMAN_DIR="$HOME/.sdkman"
znap function _sdk sdk 'source "$SDKMAN_DIR/bin/sdkman-init.sh"'
compdef _sdk sdk
# Load `emsdk` when needed
znap function _emsdk emsdk 'source "$EMSDK_PATH"/emsdk_env.sh'
compdef _emsdk emsdk
# Set `TERM` variable
export TERM="rxvt-unicode-256color"
# export TERM='xterm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment