ZSH initialization file
Initialization files
.zshrc
oh-my-zsh specific
# .zshrc # for use with oh-my-zsh https://ohmyz.sh/ # alexforsale <alexforsale@yahoo.com> export ZSH="$HOME/.oh-my-zsh"
Auto install oh-my-zsh
# auto install oh-my-zsh if [ ! -d "$ZSH" ]; then sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended fi
Theme
ZSH_THEME="robbyrussell" # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
Other options
# Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true" # Uncomment the following line to use hyphen-insensitive completion. # Case-sensitive completion must be off. _ and - will be interchangeable. HYPHEN_INSENSITIVE="true" # Uncomment one of the following lines to change the auto-update behavior # zstyle ':omz:update' mode disabled # disable automatic updates # zstyle ':omz:update' mode auto # update automatically without asking zstyle ':omz:update' mode reminder # just remind me to update when it's time # Uncomment the following line to change how often to auto-update (in days). # zstyle ':omz:update' frequency 13 # Uncomment the following line if pasting URLs and other text is messed up. # DISABLE_MAGIC_FUNCTIONS="true" # Uncomment the following line to disable colors in ls. # DISABLE_LS_COLORS="true" # Uncomment the following line to disable auto-setting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. # ENABLE_CORRECTION="true" # Uncomment the following line to display red dots whilst waiting for completion. # You can also set it to another string to have that shown instead of the default red dots. # e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" # Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) # COMPLETION_WAITING_DOTS="true" # Uncomment the following line if you want to disable marking untracked files # under VCS as dirty. This makes repository status check for large repositories # much, much faster. # DISABLE_UNTRACKED_FILES_DIRTY="true" # Uncomment the following line if you want to change the command execution time # stamp shown in the history command output. # You can set one of the optional three formats: # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" # or set a custom format using the strftime function format specifications, # see 'man strftime' for details. # HIST_STAMPS="mm/dd/yyyy" # Would you like to use another custom folder than $ZSH/custom? # ZSH_CUSTOM=/path/to/new-custom-folder # Which plugins would you like to load? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=(git pass zoxide fzf) source $ZSH/oh-my-zsh.sh
User configuration
# User configuration # Preferred editor for local and remote sessions # if [[ -n $SSH_CONNECTION ]]; then # export EDITOR='vim' # else # export EDITOR='nvim' # fi # Compilation flags # export ARCHFLAGS="-arch $(uname -m)" # Set personal aliases, overriding those provided by Oh My Zsh libs, # plugins, and themes. Aliases can be placed here, though Oh My Zsh # users are encouraged to define aliases within a top-level file in # the $ZSH_CUSTOM folder, with .zsh extension. Examples: # - $ZSH_CUSTOM/aliases.zsh # - $ZSH_CUSTOM/macos.zsh # For a full list of active aliases, run `alias`. # # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh"
External packages
if [[ -f /usr/share/doc/pkgfile/command-not-found.zsh ]]; then source /usr/share/doc/pkgfile/command-not-found.zsh fi if [[ -f /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh fi if [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-hightlighting.zsh ]]; then source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-hightlighting.zsh fi
zoxide
zoxide is a smarter cd command, similar to z or autojump.
if [[ $(command -v zoxide) ]]; then eval "$(zoxide init zsh --cmd cd)" fi
aliases
I don't use aliases that much.
if [[ $(command -v nvim) ]]; then alias vim="nvim" alias vi="nvim" fi
completion
zstyle ':completion:*' rehash true
autoload -U compinit
compinit -i
.zshenv
# .zshenv # alexforsale <alexforsale@yahoo.com> export ZSHCONF="$HOME/.config/zsh" if [ ! -d "$ZSHCONF" ]; then mkdir -p "$ZSHCONF" fi if [ ! -d "$ZSHCONF/zshenv.d" ]; then mkdir -p "$ZSHCONF/zshenv.d" fi for envs in $ZSHCONF/zshenv.d/*.zsh; do . "$envs" done typeset -U path PATH export PATH
.config/zsh/zshenv.d
00-base.zsh
# .config/zsh/zshenv.d/00-base.zsh # alexforsale <alexforsale@yahoo.com> # You may need to manually set your language environment [ -z "$LANG" ] && export LANG=en_US.UTF-8 [ -z "$LC_ALL" ] && export LC_ALL=en_US.UTF-8 [ -z "$MM_CHARSET" ] && export MM_CHARSET=en_US.UTF-8
00-editors.zsh
# .config/zsh/zshenv.d/00-editors.zsh # $EDITOR, $VISUAL and $ALTERNATE_EDITOR # alexforsale <alexforsale@yahoo.com> if [ "$(command -v emacs)" ] && [ -z "$EDITOR" ]; then export EDITOR="emacsclient -t -a emacs" export VISUAL="emacsclient -c -a emacs" export ALTERNATE_EDITOR="$VISUAL" fi
00-security.zsh
# .config/zsh/zshenv.d/00-security.zsh # alexforsale <alexforsale@yahoo.com> # from https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html export GPG_TTY="$(tty)"
10-local-bin.zsh
# .config/zsh/zshenv.d/10-local-bin.zsh # alexforsale <alexforsale@yahoo.com> if [ -d "$HOME/.local/bin" ]; then path+=("$HOME/.local/bin") typeset -U path fi
10-term.zsh
export TERM=xterm-256color
10-cabal.zsh
# .config/zsh/zshenv.d/10-cabal.zsh # alexforsale <alexforsale@yahoo.com> if [ -d "$HOME/.cabal/bin" ];then path+=("$HOME/.cabal/bin") typeset -U path fi
10-cargo.zsh
# .config/zsh/zshenv.d/10-cargo.zsh # alexforsale <alexforsale@yahoo.com> if [ -f "$HOME/.cargo/env" ]; then . "$HOME/.cargo/env" fi
10-composer.zsh
# .config/zsh/zshenv.d/10-composer.zsh # alexforsale <alexforsale@yahoo.com> if [ -d "$HOME/.config/composer/vendor/bin" ]; then path+=("$HOME/.config/composer/vendor/bin") typeset -U path fi
10-fsharp.zsh
# .config/zsh/zshenv.d/10-fsharp.zsh # alexforsale <alexforsale@yahoo.com> if [ -d "$HOME/.dotnet/tools" ]; then path+=("$HOME/.dotnet/tools") typeset -U path fi
10-go.zsh
# .config/zsh/zshenv.d/10-go.zsh # alexforsale <alexforsale@yahoo.com> if [ "$(command -v go)" ]; then # set GOPATH to ~/.local so we don't need # to add more PATH export GOPATH="$HOME/.local" fi
10-npm.zsh
# .config/zsh/zshenv.d/10-npm.zsh # see https://wiki.archlinux.org/index.php/Node.js # alexforsale <alexforsale@yahoo.com> if [ -d "${HOME}/.config/nvm" ]; then export NVM_DIR="${HOME}/.config/nvm" elif [ "$(command -v npm)" ] && [ ! "$(command -v nvm)" ]; then export npm_config_prefix="$HOME/.local" fi
10-python.zsh
# .config/zsh/zshenv.d/10-python.zsh # alexforsale <alexforsale@yahoo.com> if [ $(command -v pipenv) ]; then [ -z "${PIPENV_VENV_IN_PROJECT}" ] && export PIPENV_VENV_IN_PROJECT=1 fi
10-ruby.zsh
# .config/zsh/zshenv.d/10-ruby.zsh # alexforsale <alexforsale@yahoo.com> if [ "$(command -v ruby)" ] && [ -d "$(ruby -e 'print Gem.user_dir')/bin" ]; then path+=("$(ruby -e 'print Gem.user_dir')/bin") typeset -U path fi
.zprofile
# .zprofile # alexforsale <alexforsale@yahoo.com> for profile in $ZSHCONF/zprofile.d/*.zsh; do . "$profile" done
.config/zsh/zprofile.d
00-xdg-user-directories.zsh
# .config/zsh/zprofile.d/00-xdg-user-directories.zsh # alexforsale <alexforsale@yahoo.com> if [ "$(command -v xdg-user-dirs-update)" ] && [ ! -f "$HOME/.config/user-dirs.dirs" ]; then xdg-user-dirs-update fi
90-python.zsh
# .config/zsh/zprofile.d/90-python.zsh # alexforsale <alexforsale@yahoo.com> if [ "$(command -v pyenv)" ]; then eval "$(pyenv init -)" fi
.zlogin
# .zlogin # alexforsale <alexforsale@yahoo.com> #last "${USER}" | head -n 3 [ "$(command -v toilet)" ] && toilet "alexforsale" -w 80 -f smblock --rainbow
.zlogout
# .zlogout # alexforsale <alexforsale@yahoo.com> if [ "$SHLVL" = 1 ]; then [ -x /usr/bin/clear ] && /usr/bin/clear fi