Skip to content

Instantly share code, notes, and snippets.

@knsh14
Last active August 11, 2016 18:14
Show Gist options
  • Save knsh14/321be0a1ac64248978381a178befd687 to your computer and use it in GitHub Desktop.
Save knsh14/321be0a1ac64248978381a178befd687 to your computer and use it in GitHub Desktop.
zsh設定
export LANG=ja_JP.UTF-8
setopt nolistbeep
autoload -Uz compinit
compinit
bindkey -v
alias ls='ls -G'
alias ll='ls -alh'
alias la='ls -a'
export EDITOR=vim
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
########################################
#プロンプトの設定
########################################
#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="%{%}${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="%{%}${HOST%%.*} ${PROMPT}"
;;
esac
#ターミナルのタイトルの設定
case "${TERM}" in
kterm*|xterm)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment