Last active
March 14, 2018 06:14
-
-
Save river24/0cc1545eb37ac5f9d0212137e9795a30 to your computer and use it in GitHub Desktop.
My simple "dotfiles" of zsh & screen for CentOS 6/7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| startup_message off | |
| shell /bin/zsh | |
| escape ^Zz | |
| defscrollback 10000 | |
| defencoding utf8 | |
| defkanji utf8 | |
| encoding utf8 utf8 | |
| hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w" | |
| # hardstatus alwayslastline "%`%-w%{=b bw}%n %t%{-}%+w" | |
| # caption always "%{= wb} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wk} [%l] %{=b wb}%y/%m/%d(%D) %{=b wm}%c" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # direnv | |
| if (( ${+commands[direnv]} )) ; then | |
| eval "$(direnv hook zsh)" | |
| fi | |
| # ruby (rbenv) | |
| if [ -s $HOME/.rbenv ] ;then | |
| export PATH="$HOME/.rbenv/bin:$PATH" | |
| eval "$(rbenv init -)" | |
| fi | |
| # python (pyenv) | |
| if [ -s $HOME/.pyenv ] ;then | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| if [ -s $HOME/.pyenv/plugins/pyenv-virtualenv ] ;then | |
| eval "$(pyenv virtualenv-init -)" | |
| export PYENV_VIRTUALENV_DISABLE_PROMPT=1 | |
| fi | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- Mode: Shell-script ; syntax: zsh; coding: utf-8 -*- | |
| # Emacs Key Bindings | |
| bindkey -e | |
| # use Escape Sequences | |
| setopt prompt_subst | |
| # Disable beep | |
| setopt nolistbeep | |
| # PROMPT | |
| PROMPT='%B[%n@%m %(1~,%1~,%~)]%(!,#,$) %b' | |
| RPROMPT='%B[%(?.%!.ERROR:%?)] (%D{%a %b %d %H:%M:%S %Y})%b' | |
| # setopt transient_rprompt | |
| # History | |
| HISTFILE=$HOME/.zsh-history | |
| HISTSIZE=100000 | |
| SAVEHIST=100000 | |
| # Options for History | |
| setopt extended_history # コマンドの開始時刻と経過時間を登録 | |
| setopt hist_ignore_dups # 直前のコマンドと同一ならば登録しない | |
| setopt hist_ignore_all_dups # 登録済コマンド行は古い方を削除 | |
| setopt hist_reduce_blanks # 余分な空白は詰めて登録(空白数違い登録を防ぐ) | |
| # setopt append_history # zsh を終了させた順にファイルに記録(デフォルト) | |
| # setopt inc_append_history # 同上、ただしコマンドを入力した時点で記録 | |
| setopt share_history # ヒストリの共有。(append系と異なり再読み込み不要、これを設定すれば append 系は不要) | |
| setopt hist_no_store # historyコマンドは登録しない | |
| setopt hist_ignore_space # コマンド行先頭が空白の時登録しない(直後ならば呼べる) | |
| function history-all { history -E 1} | |
| # 言語設定 | |
| setopt print_eight_bit | |
| # export LANG=en_US.UTF-8 | |
| export LANG=ja_JP.UTF-8 | |
| export LC_ALL=en_US.UTF-8 | |
| export LANG=en_US.UTF-8 | |
| export LESS=-r | |
| # 時間関連 | |
| REPORTTIME=8 # CPUを8秒以上使った時は time を表示 | |
| TIMEFMT="\ | |
| The name of this job. :%J | |
| CPU seconds spent in user mode. :%U | |
| CPU seconds spent in kernel mode. :%S | |
| Elapsed time in seconds. :%E | |
| The CPU percentage. :%P" | |
| # screenでwindows titleを変更 | |
| if [[ -n $(printenv STY) ]] ; 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]) | |
| ;; | |
| "TERM=xterm"|"TERM=xterm\-256color") | |
| if (( $#cmd == 2)); then | |
| cmd[1]=$cmd[2] | |
| fi | |
| ;& | |
| cd|ssh) | |
| if (( $#cmd == 2)); then | |
| cmd[1]=$cmd[2] | |
| fi | |
| ;& | |
| reattach\-to\-user\-namespace) | |
| if (( $#cmd >= 3)); then | |
| case $cmd[3] in | |
| "TERM=xterm") | |
| cmd[1]=$cmd[4] | |
| ;; | |
| "TERM=xterm-256color") | |
| cmd[1]=$cmd[4] | |
| ;; | |
| esac | |
| fi | |
| ;& | |
| *) | |
| echo -n "k$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 | |
| # PATHの重複を削除する | |
| function debug_mode() { return 1 } # 0のときデバッグモード | |
| function pathpack() { | |
| local q=':' | |
| for p in $path | |
| do | |
| debug_mode && echo $p | |
| [ "$q" '==' "${q/:$p:/}" ] && q="$q$p:" | |
| debug_mode && echo $q | |
| done | |
| q=${q#:} | |
| q=${q%:} | |
| debug_mode && echo $q | |
| debug_mode || PATH=$q | |
| } | |
| pathpack |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment