Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jamezrin
Last active December 31, 2019 21:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamezrin/20261768e2a9ea89bf4d628b2e80a7e9 to your computer and use it in GitHub Desktop.
Save jamezrin/20261768e2a9ea89bf4d628b2e80a7e9 to your computer and use it in GitHub Desktop.
My zshrc base dotfile
# Enable autocompletions
autoload -Uz compinit
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)
if [ $(date +'%j') != $updated_at ]; then
compinit -i
else
compinit -C -i
fi
zmodload -i zsh/complist
# Save history so we get auto suggestions
HISTFILE=$HOME/.zsh_history
HISTSIZE=100000
SAVEHIST=$HISTSIZE
# Options
setopt auto_cd # cd by typing directory name if it's not a command
setopt auto_list # automatically list choices on ambiguous completion
setopt auto_menu # automatically use menu completion
setopt always_to_end # move cursor to end if word had one match
setopt hist_ignore_all_dups # remove older duplicate entries from history
setopt hist_reduce_blanks # remove superfluous blanks from history items
setopt inc_append_history # save history entries as soon as they are entered
setopt share_history # share history between different instances
setopt interactive_comments # allow comments in interactive shells
# Improve autocompletion style
zstyle ':completion:*' menu select # select completions with arrow keys
zstyle ':completion:*' group-name '' # group results by category
zstyle ':completion:::::' completer _expand _complete _ignored _approximate # enable approximate matches for completion
# Load antibody plugin manager
source <(antibody init)
# Plugins
antibody bundle zdharma/fast-syntax-highlighting
antibody bundle zsh-users/zsh-autosuggestions
antibody bundle zsh-users/zsh-history-substring-search
antibody bundle zsh-users/zsh-completions
antibody bundle marzocchi/zsh-notify
antibody bundle buonomo/yarn-completion
antibody bundle robbyrussell/oh-my-zsh path:plugins/git
antibody bundle robbyrussell/oh-my-zsh path:plugins/sudo
antibody bundle robbyrussell/oh-my-zsh path:plugins/dotenv
antibody bundle robbyrussell/oh-my-zsh path:plugins/archlinux
antibody bundle robbyrussell/oh-my-zsh path:plugins/adb
antibody bundle robbyrussell/oh-my-zsh path:plugins/docker
antibody bundle robbyrussell/oh-my-zsh path:plugins/emoji
antibody bundle robbyrussell/oh-my-zsh path:plugins/golang
antibody bundle robbyrussell/oh-my-zsh path:plugins/gulp
#antibody bundle lukechilds/zsh-nvm
# Keybindings
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '^[[3~' delete-char
bindkey '^[3;5~' delete-char
# Home/End keys
bindkey '\e[1~' beginning-of-line # Linux console
bindkey '\e[H' beginning-of-line # xterm
bindkey '\eOH' beginning-of-line # gnome-terminal
bindkey '\e[2~' overwrite-mode # Linux console, xterm, gnome-terminal
bindkey '\e[3~' delete-char # Linux console, xterm, gnome-terminal
bindkey '\e[4~' end-of-line # Linux console
bindkey '\e[F' end-of-line # xterm
bindkey '\eOF' end-of-line # gnome-terminal
# Crtl+Left, Crlt+Right
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word
# Crtl+Backspace, Crtl+Delete
bindkey '^[[3;5~' kill-word
bindkey '^[[3^' kill-word
bindkey '^H' backward-kill-word
# Theme
if [ "$TERM" != "linux" ]; then
antibody bundle denysdovhan/spaceship-prompt
else
export PROMPT='%B%(?..[%?] )%b%n@%U%m%u> '
export RPROMPT="%F{${1:-green}}%~%f"
fi
# Save previous command to pet
function pet-prev() {
PREV=$(fc -lrn | head -n 1)
sh -c "pet new `printf %q "$PREV"`"
}
# Load z script
[[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh
# Load nvm script
[[ -r "/usr/share/nvm/init-nvm.sh" ]] && source /usr/share/nvm/init-nvm.sh --no-use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment