Skip to content

Instantly share code, notes, and snippets.

@pochi
Created September 30, 2016 01:14
Show Gist options
  • Save pochi/dcfe85ffb013fe1443b0aafc180f4e3b to your computer and use it in GitHub Desktop.
Save pochi/dcfe85ffb013fe1443b0aafc180f4e3b to your computer and use it in GitHub Desktop.
##################################################
# shell variables
# history
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# report time
REPORTTIME=3
# prompt
function precmd_vcs() {
vcs_info
RPROMPT=$'%{\e[32m%}%~'${vcs_info_msg_0_}$'%{\e[m%}'
}
# PROMPT=$'%{\e[31m%}%n %{\e[33m%}%* %# %{\e[m%}'
#PICT_CHAR=($'\U1F49A ' $'\U1F3B5 ' $'\U1F300 ' $'\U1F47B ' $'\U1F431 ' )
# PROMPT=$'%{\e[\U1F436 \e[36m%}pochi %B%F{red}>%f%F{yellow}>%f%F{green}>%f%b %{\e[m%}'
# PROMPT=$'%F{cyan}pochi%f %B%F{red}>%f%F{yellow}>%f%F{green}>%f%b %{\e[m%}'
PROMPT=$'\U1F436 %{\e[36m%}pochi %F{red}>%f%F{yellow}>%f%F{green}>%f %{\e[m%}'
# special functions
precmd_functions=(precmd_vcs)
function redrev() {
perl -pe 's/^/\e[41m/ && s/$/\e[m/';
}
function do_enter() {
if [ -n "$BUFFER" ]; then
zle accept-line
return 0
fi
echo
ls
# ↓おすすめ
# ls_abbrev
# if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
# echo
# echo -e "\e[0;33m--- git status ---\e[0m"
# git status -sb
# fi
zle reset-prompt
return 0
}
zle -N do_enter
bindkey '^m' do_enter
##################################################
# aliases
alias sl=ls
case "$OSTYPE" in
darwin*)
alias ls="LSCOLORS=gxfxxxxxcxxxxxxxxxxxxx ls -G"
;;
linux*)
alias ls="ls --color=auto"
;;
esac
alias ll="ls -l"
alias la="ll -a"
alias em="emacs-minimum"
alias gi=git
alias ga="git add"
alias gd="git diff"
alias gl="git log"
alias gs="git status"
alias gsh="git show"
alias gpl="git pull"
alias gps="git push"
alias gci="git commit"
alias gco="git checkout"
alias gcp="git cherry-pick"
alias gsd="git svn dcommit"
alias gsr="git svn rebase"
alias gst="git stash"
alias gsp="git stash pop"
alias pad='plackup -MPlack::App::Directory -e '\''$app = Plack::App::Directory->new({ root => "." })->to_app'\'''
alias -g RED='2> >(redrev)'
##################################################
# others
# key binds
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^S' history-incremental-pattern-search-forward
# options
setopt autocd
setopt autopushd
setopt pushdignoredups
# completion
autoload -Uz compinit
compinit
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%B--- %d ---%b'
zstyle ':completion:*' menu select
zstyle ':completion:*:default' list-colors ln=35 di=36
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*:kill:*:processes' command 'ps x'
zstyle ':completion:*:-command-:*' \
fake-parameters PERL5LIB # for perl
## git completion
if [ -e $HOME/.git-completion.sh ]; then
source $HOME/.git-completion.sh
fi
# vcs
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' formats $'%{\e[35m%} [%s %r %b]%{\e[m%}'
# word-style
autoload -Uz select-word-style
select-word-style default
zstyle ':zle:*' word-chars " _-./;:@"
zstyle ':zle:*' word-style unspecified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment