Skip to content

Instantly share code, notes, and snippets.

@knsh14
Last active December 13, 2017 03:22
Show Gist options
  • Save knsh14/e1007db798e65462103a14f52aec7e20 to your computer and use it in GitHub Desktop.
Save knsh14/e1007db798e65462103a14f52aec7e20 to your computer and use it in GitHub Desktop.
# auto suggestions setting
bindkey '^f' autosuggest-accept
if zplug check "zsh-users/zsh-history-substring-search"; then
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
fi
# zaw setting
if zplug check "zsh-users/zaw"; then
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
add-zsh-hook chpwd chpwd_recent_dirs
zstyle ':chpwd:*' recent-dirs-max 500 # cdrの履歴を保存する個数
zstyle ':chpwd:*' recent-dirs-default yes
zstyle ':completion:*' recent-dirs-insert both
bindkey '^@' zaw-src-cdr
bindkey '^R' zaw-history
bindkey '^X^F' zaw-git-files
bindkey '^X^B' zaw-git-branches
bindkey '^X^P' zaw-process
zstyle ':filter-select' case-insensitive yes
zstyle ':filter-select' max-lines 10 # use 10 lines for filter-select
zstyle ':filter-select' max-lines -10 # use $LINES - 10 for filter-select
zstyle ':filter-select' rotate-list yes # enable rotation for filter-select
zstyle ':filter-select' extended-search yes # see below
zstyle ':filter-select' hist-find-no-dups yes # ignore duplicates in history source
zstyle ':filter-select:highlight' selected fg=black,bg=white,standout
fi
zstyle ':completion:*' menu select
zstyle ':completion:*' format '%F{white}%d%f'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' keep-prefix
zstyle ':completion:*' completer _oldlist _complete _match _ignored _approximate _list _history
zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([%0-9]#)*=0=01;31'
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt hist_ignore_dups
setopt share_history
#branch名を表示する
autoload -Uz add-zsh-hook
autoload -Uz colors
colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn hg bzr
zstyle ':vcs_info:*' formats '[%b]'
zstyle ':vcs_info:*' actionformats '[%b|%a]'
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%r'
zstyle ':vcs_info:bzr:*' use-simple true
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "need to commit"
zstyle ':vcs_info:git:*' unstagedstr "need to add"
zstyle ':vcs_info:git:*' formats '[%b] %c%u'
zstyle ':vcs_info:git:*' actionformats '[%b|%a] %c%u'
function _update_vcs_info_msg() {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
add-zsh-hook precmd _update_vcs_info_msg
RPROMPT="%1(v|%F{green}%1v%f|)"
case ${UID} in
0)
PROMPT="%{$fg[cyan]%}%n%%%{$reset_color%} "
RPROMPT="%1(v|%F{green}%1v%f|) [%~]"
PROMPT2="%B%{$fg[cyan]%}%_#%{$reset_color%}%b "
SPROMPT="%B%{$fg[red]m%}%r is correct? [n,y,a,e]:%{$reset_color%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{[37m%}${HOST%%.*} ${PROMPT}"
;;
*)
PROMPT="%{$fg[cyan]%}%n%%%{$reset_color%} "
RPROMPT="%1(v|%F{green}%1v%f|) [%~]"
PROMPT2="%{$fg[cyan]%}%_%%%{$reset_color%} "
SPROMPT="%{$fg[red]%}%r is correct? [n,y,a,e]:%{$reset_color%} "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{[37m%}${HOST%%.*} ${PROMPT}"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment