Skip to content

Commit

Permalink
zsh bindkey
Browse files Browse the repository at this point in the history
  • Loading branch information
jiikko committed Nov 21, 2015
1 parent 49a4064 commit 1c8e3d6
Showing 1 changed file with 39 additions and 7 deletions.
46 changes: 39 additions & 7 deletions _zshrc
Expand Up @@ -353,10 +353,9 @@ alias htmlconv='sed -e "s/</\&lt;/g;s/>/\&gt;/g;s/\t/\&nbsp;\&nbsp;\&nbsp;\&nbsp
bindkey "^R" history-incremental-search-backward bindkey "^R" history-incremental-search-backward
bindkey "^S" history-incremental-search-forward bindkey "^S" history-incremental-search-forward


bindkey "^E" end-of-line # bindkey "^E" end-of-line
bindkey "^A" beginning-of-line # bindkey "^A" beginning-of-line
bindkey "^H" backward-delete-char # bindkey "^H" backward-delete-char
bindkey '^?' backward-delete-char




# PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting # PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
Expand Down Expand Up @@ -453,7 +452,43 @@ bindkey '^X^B' zaw-git-branches
bindkey '^X^P' zaw-process bindkey '^X^P' zaw-process
bindkey '^X^S' zaw-screens bindkey '^X^S' zaw-screens


# http://qiita.com/yuku_t/items/e58cbecf13407446bd50
function _git_status() {
if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
echo git status -sb # git statusを実行したっぽくみせかける
git status -sb
fi
zle reset-prompt
}


function _git_commit() {
if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
git commit
fi
zle reset-prompt
}

function _git_diff() {
if [ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" = 'true' ]; then
git diff
fi
zle reset-prompt
}

function _shell_ls() {
echo ls
ls
zle reset-prompt
}

zle -N git_status _git_status # _git_status関数をgit_status widgetとして登録
zle -N git_diff _git_diff
zle -N git_commit _git_commit
zle -N shell_ls _shell_ls
bindkey '^G^S' git_status
bindkey '^G^M' git_commit
bindkey '^G^\D' git_diff
bindkey '^L^S' shell_ls


if is-at-least 4.3.10; then if is-at-least 4.3.10; then
# git 用のフォーマット # git 用のフォーマット
Expand Down Expand Up @@ -626,7 +661,4 @@ gcb () {
git branch | awk '/\*/ { print $2; }' git branch | awk '/\*/ { print $2; }'
} }



PATH=/opt/local/lib/mysql55/bin:$PATH
set noexpandtab
export SCREENDIR="`echo ~`/.screens" export SCREENDIR="`echo ~`/.screens"

0 comments on commit 1c8e3d6

Please sign in to comment.