Skip to content

Instantly share code, notes, and snippets.

@christineywang
Created December 17, 2019 05:31
Show Gist options
  • Save christineywang/0b3151037dc284f9e4bf6cb26fcb64e8 to your computer and use it in GitHub Desktop.
Save christineywang/0b3151037dc284f9e4bf6cb26fcb64e8 to your computer and use it in GitHub Desktop.
zsh
export EDITOR="nvim"
export FZF_DEFAULT_COMMAND="rg --files --hidden -g '!*.git'"
export ZPLUG_HOME=$HOME/.zplug
alias ll="ls -lpG"
alias vim="nvim"
# Set up the prompt
autoload -Uz promptinit
promptinit
# prompt adam1
setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
function fish_style_pwd {
echo $(pwd | perl -pe '
BEGIN {
binmode STDIN, ":encoding(UTF-8)";
binmode STDOUT, ":encoding(UTF-8)";
}; s|^$ENV{HOME}|~|g; s|/([^/.])[^/]*(?=/)|/$1|g; s|/\.([^/])[^/]*(?=/)|/.$1|g
')
}
function git_stat {
local git_branch=$(mnml_git)
if [ -n "$git_branch" ]; then
local gstat="$(git diff --shortstat 2> /dev/null | \
sed -E 's/^\ //g' | \
sed -E 's/\ files?\ changed/±/g' | \
sed -E 's/insertions?//g' | \
sed -E 's/deletions?//g' | \
sed 's/[(),]//g' | \
sed 's/\ +/+/g' | \
sed 's/\ -/-/g')"
if [ -n "$gstat" ]; then
echo -n "[$(mnml_git) %{\e[0;3${MNML_ERR_COLOR}m%}$gstat%{\e[0m%}]"
else
echo "[$git_branch]"
fi
fi
}
function custom_left_prompt {
echo "$(fish_style_pwd) $(mnml_status)"
}
function custom_right_prompt {
git_stat
}
MNML_PROMPT=(custom_left_prompt)
MNML_RPROMPT=(custom_right_prompt)
MNML_USER_CHAR="❯❯"
MNML_OK_COLOR=5
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(gdircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
source ~/.zplug/init.zsh
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/chruby", from:oh-my-zsh
# zplug "subnixr/minimal", as:theme, use:"minimal.zsh-theme"
zplug 'dracula/zsh', as:theme
zplug "stedolan/jq", \
from:gh-r, \
as:command, \
rename-to:jq
zplug "b4b4r07/emoji-cli", \
on:"stedolan/jq"
zplug "zsh-users/zsh-syntax-highlighting"
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-completions"
zplug 'b4b4r07/zplug-doctor', lazy:yes
zplug 'plugins/pyenv', from:oh-my-zsh
# Install plugins if there are plugins that have not been installed
if ! zplug check --verbose; then
printf "Install? [y/N]: "
if read -q; then
echo; zplug install
fi
fi
# Then, source plugins and add commands to $PATH
zplug load
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
eval "$(pyenv init -)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment