Skip to content

Instantly share code, notes, and snippets.

@mexelout
Last active March 22, 2021 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mexelout/93b5eb65ce66d2a51a28da2e4a5a3437 to your computer and use it in GitHub Desktop.
Save mexelout/93b5eb65ce66d2a51a28da2e4a5a3437 to your computer and use it in GitHub Desktop.
# use utf-8 japanese
export LANG=ja_JP.UTF-8
# emacs key binding
bindkey -e
# history
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
# load vcs_info
autoload -Uz vcs_info
# reference in prompt variable
setopt prompt_subst
# display vcs
zstyle ':vcs_info:*' formats '%F{green}%b%f'
zstyle ':vcs_info:*' actionformats '%F{green}%b%f(%F{red}%a%f)'
precmd() { vcs_info }
# prompt
export PROMPT='$ '
export RPROMPT='[%F{green}${vcs_info_msg_0_}%f][%~]'
# complite
autoload -Uz compinit
compinit
alias ls='ls -AFG'
alias ll='ls -hlt'
alias vi=vim
alias gb='git branch'
alias gc='git checkout'
alias gs='git status -s'
alias gd='git diff'
alias gps='git push'
alias gpu='git pull -p'
alias gco='git commit'
alias ga='git add'
alias gdc='git diff --cached'
# functions
function gbchange() {
gc $(gb | cut -b3- | peco)
}
function gbcurrent() {
echo $(git rev-parse --abbrev-ref HEAD)
}
# new local branch
alias gpsu='gps --set-upstream origin $(gbcurrent)'
function gbgone() {
gb -vv | grep gone | awk '{print $1}'
}
function gbclean() {
gbgone | xargs git branch -D
}
# sudo command complite
# zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
# /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
# ps process complite
# zstyle ':completion:*:processes' command 'ps x -o pid,s,args'
# options
# enable show japanese language
setopt print_eight_bit
# disable beep
setopt no_beep
# disable flow control
setopt no_flow_control
# comment is after '#'
setopt interactive_comments
# zsh share history
setopt share_history
# ignore duplicate commands
setopt hist_ignore_all_dups
# ignore start from space commands
setopt hist_ignore_space
# reduce blanks
setopt hist_reduce_blanks
# high grade wildcard
setopt extended_glob
# when search history with ^R, make wildcard available
bindkey '^R' history-incremental-pattern-search-backward
source ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment