Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Created February 19, 2015 03:00
Show Gist options
  • Save tamakiii/8046627e46f514392c30 to your computer and use it in GitHub Desktop.
Save tamakiii/8046627e46f514392c30 to your computer and use it in GitHub Desktop.
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.home/.omz
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="ys"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="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/dsa_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"
umask 002
bindkey -v
if [[ `uname -s` == "Darwin" ]] ; then
PLATFORM="MAC_OSX"
fi
# GNU
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export MANPATH="/usr/local/opt/gnu-sed/libexec/gnuman:$MANPATH"
# Home Brew
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
if hash brew 2>/dev/null; then
if [ -f `brew --prefix`/usr/local/share/zsh/site-functions ]; then
. `brew --prefix`/usr/local/share/zsh/site-functions
fi
fi
# rbenv
export PATH="$HOME/.rbenv/shims:$PATH"
if hash rbenv 2>/dev/null; then
eval "$(rbenv init - zsh)";
fi
# pyenv
#export PYENV_ROOT=/usr/local/opt/pyenv
#if hash pyenv 2>/dev/null; then
# eval "$(pyenv init -)";
#fi
# phpenv
export PATH="$HOME/.phpenv/bin:$PATH"
export PATH="$HOME/.phpenv/shims:$PATH"
if hash pyenv 2>/dev/null; then
eval "$(phpenv init - zsh)";
fi
# platform settings
if [[ $PLATFORM == "MAC_OSX" ]] ; then
export LANG=ja_JP.UTF-8
export LANGUAGE=ja_JP:ja
# export LC_ALL=ja_JP.utf8 # gitが文字化けする
export LESSCHARSET=utf-8
else
export LANG=ja_JP.UTF-8
export LANGUAGE=ja_JP:ja
export LC_ALL=ja_JP.utf8
export LESSCHARSET=utf-8
fi
# automatically pushd when cd
#setopt auto_pushd
#setopt list_packed
source ~/.zshrc_env
# color
autoload colors
colors
if [[ $PLATFORM == "MAC_OSX" ]] ; then
alias ls="ls -Gv"
alias la="ls -Gva"
alias ll="ls -Gvl"
alias lsusb="system_profiler SPUSBDataType"
else
alias ls="ls -Gv --color=auto"
alias la="ls -Gva --color=auto"
alias ll="ls -Gvl --color=auto"
fi
alias l="ll"
alias lll="ll"
alias dp='dirs -pv'
alias pu='pushd +'
alias po='popd +'
alias h="history 25"
#alias j="jobs -l"
#alias vi="vim"
alias smu="smultron"
#alias mysql="mysql5"
alias mim='mvim'
alias macvim='mvim'
#alias vim='mvim'
alias more='less'
alias platex='platex --kanji=utf8'
#alias ruby='ruby1.9'
alias vims='vim "+e ++enc=cp932"'
alias svim='vims'
alias lstree="ls -R | grep ':$' | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
alias gup='git checkout develop; git pull; git checkout master; git pull;'
alias gf='git fetch -p'
alias gb='git branch'
alias gba='git branch -a'
alias gd='git diff'
alias gds='git diff --staged'
alias ga='git add'
alias gap='git add --patch'
alias gs='git status'
alias gl='git log'
alias glp='git log -p'
alias gc='git checkout'
alias go='git commit'
alias goa='git commit --amend'
alias phpunit='phpunit --colors'
alias r='R --encoding=UTF-8 --silent --no-save -f'
alias composer='~/.bin/composer.phar'
alias runels='elasticsearch -f -Xmx2g -Xms2g -Des.index.storage.type=memory'
alias json_pretty='python -mjson.tool'
alias jsp=json_pretty
alias pst='ps -o user:20 axfo "%U %p %C %z %t (%x) %c : " o args=ARGS'
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt auto_menu auto_cd correct auto_name_dirs auto_remove_slash
setopt pushd_ignore_dups rm_star_silent sun_keyboard_hack
setopt cdable_vars sh_word_split auto_param_keys
setopt auto_pushd
setopt list_packed
setopt nolistbeep
setopt complete_aliases
setopt share_history # share command history data
setopt hist_ignore_all_dups hist_reduce_blanks hist_no_store print_eight_bit
stty stop undef
bindkey -e
# http://zsh.sourceforge.net/Doc/Release/zsh_17.html
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 '^R' history-incremental-pattern-search-backward
bindkey '^S' history-incremental-pattern-search-forward
bindkey "^P" history-beginning-search-backward-end
bindkey "^N" history-beginning-search-forward-end
bindkey '^F' forward-char
bindkey '^B' backward-char
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line
# https://wiki.archlinux.org/index.php/Zsh
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[4~" end-of-line # End
bindkey "\e[5~" beginning-of-history # PageUp
bindkey "\e[6~" end-of-history # PageDown
bindkey "\e[2~" quoted-insert # Ins
bindkey "\e[3~" delete-char # Del
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "\e[Z" reverse-menu-complete # Shift+Tab
# for rxvt
bindkey "\e[7~" beginning-of-line # Home
bindkey "\e[8~" end-of-line # End
# # for non RH/Debian xterm, can't hurt for RH/Debian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# # for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line
# # for guake
bindkey "\eOF" end-of-line
bindkey "\eOH" beginning-of-l
#eval `dircolors ~/.dircolors`
# tcsh, vim 風の挙動
# http://www.bookshelf.jp/2ch/unix/990283346.html
tcsh-backward-delete-word () {
local WORDCHARS="${WORDCHARS:s#/#}"
zle backward-delete-word
}
zle -N tcsh-backward-delete-word
bindkey '^W' tcsh-backward-delete-word
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:cd:*' tag-order local-directories path-directories
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' menu select=1
zmodload -i zsh/mathfunc
# Clean, simple, compatible and meaningful.
# Tested on Linux, Unix and Windows under ANSI colors.
# It is recommended to use with a dark background and the font Inconsolata.
# Colors: black, red, green, yellow, *blue, magenta, cyan, and white.
#
# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/
# Mar 2013 ys
# Machine name.
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname
}
# Directory info.
local current_dir='${PWD/#$HOME/~}'
# Git info.
local git_info='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}%{$reset_color%}%{$fg[cyan]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""
# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%{$fg[white]%}[%*]\
%{$fg[cyan]%}%n\
%{$fg[white]%}@\
%{$fg[green]%}$(box_name)\
%{$terminfo[bold]$fg[red]%}$%{$reset_color%}${git_info}
(%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%})\
%{$fg[white]%}\
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
if [[ "$(whoami)" == "root" ]]; then
PROMPT="
%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \
%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \
%{$fg[white]%}at \
%{$fg[green]%}$(box_name) \
%{$fg[white]%}in \
%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\
${git_info} \
%{$fg[white]%}[%*]
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
fi
mount() { mkdir -p ~/Documents/Sshfs/$1; sshfs $1: ~/Documents/Sshfs/$1 -o ssh_command=/usr/local/bin/ssh -ocache=no -ovolname=$1 -o Ciphers=aes256-ctr -o compression=no -o follow_symlinks,no_readahead,noappledouble,nolocalcaches,sshfs_sync,kernel_cache,auto_cache; open ~/Documents/Sshfs/$1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment