Skip to content

Instantly share code, notes, and snippets.

@ymsrk
Created April 1, 2017 14:44
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 ymsrk/2153244ad3268b5d97f254b97ea6b2eb to your computer and use it in GitHub Desktop.
Save ymsrk/2153244ad3268b5d97f254b97ea6b2eb to your computer and use it in GitHub Desktop.
.zshrc_org & .zshrc.pre-oh-my-zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/gulliver/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"
#ZSH_THEME="agnoster"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
➜ ~
# シンプルな zshrc
# License : MIT
# http://mollifier.mit-license.org/
# 環境変数
export LANG=ja_JP.UTF-8
# 補完機能を有効にする
autoload -Uz compinit
compinit
# cd したら自動的にpushdする
setopt auto_pushd
# 重複したディレクトリを追加しない
setopt pushd_ignore_dups
alias -g L='| less'
alias -g G='| grep'
# ヒストリの設定
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
# クルマジロ開発用環境定義
export NODE_PATH=./
export NODE_ENV=development
# HOMEBREW-CASK インストールパス指定
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
# PATH設定
export PATH=/usr/local/bin:$PATH
export PATH=$HOME/.rbenv/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH=/Applications/Qt/5.5.1/5.5/clang_64/bin:$PATH
export PATH="/Users/gulliver/.rbenv/shims:${PATH}"
export RBENV_SHELL=zsh
source '/usr/local/Cellar/rbenv/1.1.0/libexec/../completions/rbenv.zsh'
command rbenv rehash 2>/dev/null
rbenv() {
local command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "$(rbenv "sh-$command" "$@")";;
*)
command rbenv "$command" "$@";;
esac
}
# 日本語ファイル名を表示可能にする
setopt print_eight_bit
# beep を無効にする
setopt no_beep
# フローコントロールを無効にする
setopt no_flow_control
# Ctrl+Dでzshを終了しない
setopt ignore_eof
# '#' 以降をコメントとして扱う
setopt interactive_comments
# vim:set ft=zsh :
# 色を使用出来るようにする
autoload -Uz colors
colors
# Git設定
git config --global user.name "kojiro.yamashiro"
git config --global user.email "kojiro.yamashiro@glv.co.jp"
git config --global color.ui auto
# Git エイリアス
alias git-log-line='git log --oneline --graph'
alias git-log='git log --graph'
# ruby on rails エイリアス
# エイリアスをまとめることで時短につながる
alias bi='bundle install'
alias console='bundle exec rails console'
alias dbconsole='bundle exec rails dbconsole'
alias routes='bundle exec rake routes'
alias dbmigrate='bundle exec rake db:migrate'
alias rs='bundle exec rails s'
# 短縮エイリアス
alias ll='ls -laG'
alias rm='rm -iv'
alias cp='cp -iv'
alias mv='mv -iv'
alias ..='cd ../'
alias ..2='cd ../../'
alias ..3='cd ../../../'
# dockerエイリアス
# THIS DOCKER-MACHINE エイリアス
alias dm='docker-machine'
alias dm-ls='docker-machine ls'
alias dm-new='docker-machine create --driver virtualbox'
alias dk='docker'
alias dk-rm-all='docker rm -f $(docker ps -aq)'
alias dk-rmi-all='docker rmi -f $(docker images)'
alias dk-ps='docker ps'
alias dk-psa='docker ps -a'
alias dc='docker-compose'
# rails エイリアス
alias bn='bundle'
# プロンプト
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' max-exports 6 # formatに入る変数の最大数
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' formats '%b@%r' '%c' '%u'
zstyle ':vcs_info:git:*' actionformats '%b@%r|%a' '%c' '%u'
setopt prompt_subst
function vcs_echo {
local st branch color
STY= LANG=en_US.UTF-8 vcs_info
st=`git status 2> /dev/null`
if [[ -z "$st" ]]; then return; fi
branch="$vcs_info_msg_0_"
if [[ -n "$vcs_info_msg_1_" ]]; then color=${fg[green]} #staged
elif [[ -n "$vcs_info_msg_2_" ]]; then color=${fg[red]} #unstaged
elif [[ -n `echo "$st" | grep "^Untracked"` ]]; then color=${fg[blue]} # untracked
else color=${fg[cyan]}
fi
echo "%{$color%}(%{$branch%})%{$reset_color%}" | sed -e s/@/"%F{yellow}@%f%{$color%}"/
}
PROMPT='
%F{yellow}[%~]%f `vcs_echo`
%(?.$.%F{red}$%f) '
# この行は現在のパスを表示する設定です。ブランチを表示して色をつける設定とは関係ありません
RPROMPT="%{${fg[blue]}%}[%~]%{${reset_color}%}"
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "%F{yellow}!"
zstyle ':vcs_info:git:*' unstagedstr "%F{red}+"
zstyle ':vcs_info:*' formats "%F{green}%c%u[%b]%f"
zstyle ':vcs_info:*' actionformats '[%b|%a]'
precmd () { vcs_info }
RPROMPT=$RPROMPT'${vcs_info_msg_0_}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment