LoginSignup
5
8

More than 5 years have passed since last update.

.zshrcと.screenrcと.vimrcを晒す

Posted at

Macで使っています。
説明は割愛。

.zshrc

# Created by newuser for 5.0.8
# system-wide environment settings for zsh(1)
# /etc/pathsを設定する。
if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

# rbenvの設定
eval "$(rbenv init -)"

# dockerの設定
eval "$(docker-machine env default)"

# hombrew caskでappを/Applicationsに入れる設定
export HOMEBREW_CASK_OPTS="--appdir=/Applications"

bindkey -e               # キーバインドをemacsモードに設定
#bindkey -v              # キーバインドをviモードに設定

# Command History Configration
HISTFILE=$HOME/.zsh-history           # 履歴をファイルに保存する
HISTSIZE=100000                       # メモリ内の履歴の数
SAVEHIST=100000                       # 保存される履歴の数
setopt extended_history               # 履歴ファイルに時刻を記録
setopt share_history                  # 履歴の共有
function history-all { history -E 1 } # 全履歴の一覧を出力する


setopt no_beep           # ビープ音を鳴らさないようにする
setopt auto_cd           # ディレクトリ名の入力のみで移動する 
setopt auto_pushd        # cd時にディレクトリスタックにpushdする
setopt correct           # コマンドのスペルを訂正する
setopt magic_equal_subst # =以降も補完する(--prefix=/usrなど)
setopt prompt_subst      # プロンプト定義内で変数置換やコマンド置換を扱う
setopt notify            # バックグラウンドジョブの状態変化を即時報告する
setopt equals            # =commandを`which command`と同じ処理にする

### Complement ###
autoload -U compinit; compinit # 補完機能を有効にする
setopt auto_list               # 補完候補を一覧で表示する(d)
setopt auto_menu               # 補完キー連打で補完候補を順に表示する(d)
setopt list_packed             # 補完候補をできるだけ詰めて表示する
setopt list_types              # 補完候補にファイルの種類も表示する
bindkey "^[[Z" reverse-menu-complete  # Shift-Tabで補完候補を逆順する("\e[Z"でも動作する)
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # 補完時に大文字小文字を区別しない

# zsh で濁点・半濁点を扱う
setopt COMBINING_CHARS

### Glob ###
setopt extended_glob # グロブ機能を拡張する
unsetopt caseglob    # ファイルグロブで大文字小文字を区別しない


# ------------------------------
# Look And Feel Settings
# ------------------------------
### Ls Color ###
# 色の設定
export LSCOLORS=Dxfxcxdxbxegedabagacad
#export LSCOLORS=dxfxxxxxcxxxxxxxxxxxxx
# 補完時の色の設定
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'
# ZLS_COLORSとは?
export ZLS_COLORS=$LS_COLORS
# lsコマンド時、自動で色がつく(ls -Gのようなもの?)
export CLICOLOR=true
# 補完候補に色を付ける
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}


### Prompt ###
# プロンプトに色を付ける
autoload -U colors; colors


#------git のブランチ名を zsh の右プロンプトに表示+ status に応じて色もつけてみた
function rprompt-git-current-branch {
        local name st color

        if [[ "$PWD" =~ '/\.git(/.*)?$' ]]; then
                return
        fi
        name=$(basename "`git symbolic-ref HEAD 2> /dev/null`")
        if [[ -z $name ]]; then
                return
        fi
        st=`git status 2> /dev/null`
        if [[ -n `echo "$st" | grep "^nothing to"` ]]; then
                color=${fg[green]}
        elif [[ -n `echo "$st" | grep "^nothing added"` ]]; then
                color=${fg[yellow]}
        elif [[ -n `echo "$st" | grep "^# Untracked"` ]]; then
                color=${fg_bold[red]}
        else
                color=${fg[red]}
        fi

        # %{...%} は囲まれた文字列がエスケープシーケンスであることを明示する
        # これをしないと右プロンプトの位置がずれる
        echo "%{$color%}$name%{$reset_color%}"
}

# プロンプトが表示されるたびにプロンプト文字列を評価、置換する
setopt prompt_subst


# 一般ユーザ時
tmp_prompt="%{${fg[cyan]}%}%n%# %{${reset_color}%}"
tmp_prompt2="%{${fg[cyan]}%}%_> %{${reset_color}%}"
#tmp_rprompt="%{${fg[green]}%}[%~]%{${reset_color}%}"
tmp_rprompt='[`rprompt-git-current-branch`]'"%{${fg[green]}%}[%~]%{${reset_color}%}"
tmp_sprompt="%{${fg[yellow]}%}%r is correct? [Yes, No, Abort, Edit]:%{${reset_color}%}"

# rootユーザ時(太字にし、アンダーバーをつける)
if [ ${UID} -eq 0 ]; then
  tmp_prompt="%B%U${tmp_prompt}%u%b"
  tmp_prompt2="%B%U${tmp_prompt2}%u%b"
  tmp_rprompt="%B%U${tmp_rprompt}%u%b"
  tmp_sprompt="%B%U${tmp_sprompt}%u%b"
fi

PROMPT=$tmp_prompt    # 通常のプロンプト
PROMPT2=$tmp_prompt2  # セカンダリのプロンプト(コマンドが2行以上の時に表示される)
RPROMPT=$tmp_rprompt  # 右側のプロンプト
SPROMPT=$tmp_sprompt  # スペル訂正用プロンプト
# SSHログイン時のプロンプト
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
  PROMPT="%{${fg[white]}%}${HOST%%.*} ${PROMPT}"
;

# ------------------------------
# Other Settings
# ------------------------------
### RVM ###
#if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi

### Aliases ###
alias vi='env LANG=ja_JP.UTF-8 /Applications/MacVim.app/Contents/MacOS/Vim "$@"'
alias vim='env LANG=ja_JP.UTF-8 /Applications/MacVim.app/Contents/MacOS/Vim "$@"'
#alias c='/Applications/CotEditor.app/Contents/MacOS/CotEditor "$@"'

# cdコマンド実行後、lsを実行する
function cd() {
  builtin cd $@ && ls;
}

.screenrc

## エスケープキーの設定 Ctrl - t
escape ^Tt

### ビジュアルベルを無効
vbell off

#### マウスホイルで履歴を見えるようにする
termcapinfo xterm* ti@:te@

### ステータス行の設定
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"

### スタートアップ時メッセージ無効
startup_message off

### 自動でデタッチする
autodetach on

### スクロール行を 10,240行
defscrollback 10240

#自動ログ取得
deflog on
#logfile "logs/screen/screen-%Y%m%d-%n.log"

#自動ログ取得
hardcopydir "$HOME/.logs/screen"
hardcopy_append on
logfile "$HOME/.logs/screen/hardcopy-%Y%m%d-%n.log"
#bind h hardcopy -h "/logs/hard.log"

### ^T U で UTF-8 / ^T E で EUC-JP を切り替え
bind U eval "encoding utf-8" "!!!echo 'export LANG=ja_JP.UTF-8'"
bind E eval "encoding euc" "!!!echo 'export LANG=ja_JP.EUC-JP'"

.vimrc

"バックアップファイルを作成しない
set nobackup

"undofileを1箇所に集める
set undodir=~/tmp/vim/undo

"ビープ音をピコピコを消し、それに連動する画面フラッシュもオフにする
set visualbell t_vb=
5
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
8