Skip to content

Instantly share code, notes, and snippets.

@ysaotome
Last active September 27, 2015 21:38
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 ysaotome/1336176 to your computer and use it in GitHub Desktop.
Save ysaotome/1336176 to your computer and use it in GitHub Desktop.
.zshrc & .scrrnrc Public Settings
defencoding utf-8
#encoding utf-8 utf-8
escape ^z^z
#cjkwidth on
vbell off
defhstatus I^En:^EtI
shell -$SHELL
autodetach on
startup_message off
termcapinfo xterm-256color 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
## encoding key bind
bind ^U encoding utf8
bind ^E encoding euc
bind w windowlist -b
defscrollback 10000
caption always "%{= wb} %-w%{=bu bw}%n %t %{-}%+w"
hardstatus alwayslastline "[%y/%m/%d %c] %h"
:set encoding=utf-8
:set fileencodings=ucs-bom,iso-2022-jp-3,iso-2022-jp,eucjp-ms,euc-jisx0213,euc-jp,sjis,cp932,utf-8
## Language setting
export LANG=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
export LANG=ja_JP.UTF-8
export LC_ALL=ja_JP.UTF-8
export PAGER=less
## set PATH
export PATH=${PATH}:${HOME}/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin
export DISPLAY=:0.0
## Default shell configuration set prompt
autoload colors
colors
case ${UID} in
## root
0)
PROMPT="%B%{${fg[green]}%}#%{${reset_color}%}%b "
PROMPT2="%B%{${fg[green]}%}#%{${reset_color}%}%b "
RPROMPT="[%~]"
SPROMPT="%B%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b "
#[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="[%{${fg[white]}%}${USER}]${PROMPT}"
;;
## user
*)
PROMPT="%{${fg[green]}%}%%%{${reset_color}%} "
PROMPT2="%{${fg[green]}%}%%%{${reset_color}%} "
RPROMPT="[%~]"
SPROMPT="%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%} "
#[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="[%{${fg[white]}%}${USER}]${PROMPT}"
;;
esac
## auto change directory
setopt auto_cd
## auto directory pushd that you can get dirs list by cd -[tab]
setopt auto_pushd
## command correct edition before each completion attempt
setopt correct
## compacked complete list display
setopt list_packed
## no remove postfix slash of command line
setopt noautoremoveslash
## no beep sound when complete list displayed
setopt nolistbeep
## Keybind configuration
bindkey -e
## historical backward/forward search with linehead string binded to ^P/^N
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^p" history-beginning-search-backward-end
bindkey "^n" history-beginning-search-forward-end
bindkey "\\ep" history-beginning-search-backward-end
bindkey "\\en" history-beginning-search-forward-end
## Command history configuration
HISTFILE=~/.zsh_history
HISTSIZE=50000
SAVEHIST=50000
setopt hist_ignore_dups # ignore duplication command history list
setopt share_history # share command history data
## Completion configuration
autoload -U compinit
compinit
## Alias configuration
setopt complete_aliases # aliased ls needs if file/dir completions work
alias where="command -v"
alias j="jobs -l"
alias vi='/usr/bin/vim'
### dstat
alias dstat-full='dstat -Tclmdrn'
alias dstat-mem='dstat -Tclm'
alias dstat-cpu='dstat -Tclr'
alias dstat-net='dstat -Tclnd'
alias dstat-disk='dstat -Tcldr'
case "${OSTYPE}" in
freebsd*|darwin*)
alias ls="ls -a -G -w -F"
;;
linux*)
alias ls="ls -a --color"
;;
esac
alias ll="ls -al"
alias du="du -h"
alias df="df -h"
alias su="su -l"
alias screen="export SCREEN=YES ; screen -U -T ${TERM}"
## terminal configuration
unset LSCOLORS
case "${TERM}" in
xterm)
export TERM=xterm
;;
xterm-color)
export TERM=xterm-color
;;
xterm-256color)
export TERM=xterm-256color
;;
kterm)
export TERM=kterm-color
## set BackSpace control character
stty erase
;;
cons25)
unset LANG
export LSCOLORS=ExFxCxdxBxegedabagacad
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
;;
esac
## set terminal title including current directory
case "${TERM}" in
kterm*|xterm*)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
;;
esac
## set screen settings
if [ "$SCREEN" = "YES" ]; then
chpwd () { echo -n "_`dirs`\\" }
preexec() {
# see [zsh-workers:13180]
# http://www.zsh.org/mla/workers/2000/msg03993.html
emulate -L zsh
local -a cmd; cmd=(${(z)2})
case $cmd[1] in
fg)
if (( $#cmd == 1 )); then
cmd=(builtin jobs -l %+)
else
cmd=(builtin jobs -l $cmd[2])
fi
;;
%*)
cmd=(builtin jobs -l $cmd[1])
;;
cd)
if (( $#cmd == 2)); then
cmd[1]=$cmd[2]
fi
;&
*)
echo -n "k$USER@$cmd[1]:t\\"
return
;;
esac
local -A jt; jt=(${(kv)jobtexts})
$cmd >>(read num rest
cmd=(${(z)${(e):-\$jt$num}})
echo -n "k$cmd[1]:t\\") 2>/dev/null
}
chpwd
fi
[ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
ご自由にお使いください。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment