Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: onk/dotfiles
base: 85b9f2b937
...
head fork: onk/dotfiles
compare: 9f05309b57
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 0 additions and 281 deletions.
  1. +0 −126 .zsh/plugin/cdd
  2. +0 −142 .zsh/plugin/incr-0.2.zsh
  3. +0 −13 .zshrc
126 .zsh/plugin/cdd
View
@@ -1,126 +0,0 @@
-#
-# * cdd
-# $ cdd WINDOW番号 でその screen の WINDOW 番号へ移動
-# するための zsh function
-# 他にも cdadd でショートカットの作成、cddel でショートカットの削除とか
-#
-# * 使い方
-# 1.
-# .zshrc でなにはともあれ
-# autoload -U compinit
-# compinit
-# source ~/path/cdd # (cdd はこのファイル) する
-# を書く
-#
-# 2.
-# .zshrc などで chpwd フックで _reg_pwd_screennum を呼び出す
-# # 例
-# function chpwd() {
-# _reg_pwd_screennum
-# }
-# 3.
-# enjoy!
-#
-# * Q&A
-# - なんで cdd という名前?
-# -- cd からの type が楽だから。
-#
-# * FIXME/TODO: 誰か直して
-# - compctl という一世代前のコマンドで補完してる。かっこいい補完にしたい。
-# - その他リファクタリング
-#
-# * 備考
-#
-# BSD, GNU どっちの sed でもうごくようにした BK:
-# - GNU は -i "suffix" の場合に "suffix" を処理対象ファイルとみなす (スペースをいれてはいけない)
-# - BSD は -i"" の場合に "" を無視して次の引数を suffix として認識してしまう (うえとあわせると常にバックアップをつくることになる)
-# - BSD は i\ コマンドのあとに改行が必須 (GNU もこれを解釈できる)
-#
-# * author
-# - Yuichi Tateno
-#
-
-export CDD_PWD_FILE=$HOME/.zsh/cdd_pwd_list
-
-function _reg_pwd_screennum() {
- if [ "$STY" != "" ]; then
- if [ ! -f "$CDD_PWD_FILE" ]; then
- echo "\n" >> "$CDD_PWD_FILE"
- fi
- _reg_cdd_pwd "$WINDOW" "$PWD"
- fi
-}
-
-function _reg_cdd_pwd() {
- if [ ! -f "$CDD_PWD_FILE" ]; then
- echo "\n" >> "$CDD_PWD_FILE"
- if [ $? = 1 ]; then
- echo "Error: Don't wrote $CDD_PWD_FILE."
- return 1
- fi
- fi
- sed -i".t" -e "/^$1:/d" "$CDD_PWD_FILE"
- sed -i".t" -e "1i \\
-$1:$2" "$CDD_PWD_FILE"
-}
-
-function _cdadd {
- if [ -z "$1" ] || [ -z "$2" ]; then
- echo "Usage: cdd add name path"
- echo "Example: cdd add w ~/myworkspace"
- return 1
- fi
-
- local -A real_path
- if which realpath >/dev/null 2>&1;then
- real_path=`realpath $2`
- else
- if which ruby >/dev/null 2>&1;then
- real_path=`ruby -rpathname -e "puts Pathname.new('$2').realpath"`
- else
- echo "cdd add require realpath or ruby"
- fi
- fi
- echo "add $1:$real_path"
- _reg_cdd_pwd "$1" "$real_path"
-}
-
-function _cddel() {
- if [ -z "$1" ]; then
- echo "Usage: cdd del name"
- return 1
- fi
- sed -i".t" -e "/^$1:/d" "$CDD_PWD_FILE"
-}
-
-
-function cdd() {
- if [ "$1" = "add" ]; then
- shift
- _cdadd $@
- return 0
- elif [ "$1" = "del" ]; then
- shift
- _cddel $@
- return 0
- fi
-
- local -A arg
- #arg=`echo $1|awk -F':' '{print \$1}'`
- arg=`echo $1|cut -d':' -f1`
- #grep "^$arg:" "$CDD_PWD_FILE" > /dev/null 2>&1
- if grep "^$arg:" "$CDD_PWD_FILE" > /dev/null 2>&1 ;then
- local -A res
- res=`grep "^$arg:" "$CDD_PWD_FILE"|sed -e "s/^$arg://;"|tr -d "\n"`
- echo "$res"
- cd "$res"
- else
- sed -e '/^$/d' "$CDD_PWD_FILE"
- fi
-}
-
-
-compctl -K _cdd cdd
-functions _cdd() {
- reply=(`grep -v "^$WINDOW:" "$CDD_PWD_FILE"`)
-}
142 .zsh/plugin/incr-0.2.zsh
View
@@ -1,142 +0,0 @@
-# Incremental completion for zsh
-# by y.fujii <y-fujii at mimosa-pudica.net>, public domain
-
-
-autoload -U compinit
-zle -N self-insert self-insert-incr
-zle -N vi-cmd-mode-incr
-zle -N vi-backward-delete-char-incr
-zle -N backward-delete-char-incr
-zle -N expand-or-complete-prefix-incr
-compinit
-
-bindkey -M viins '^[' vi-cmd-mode-incr
-bindkey -M viins '^h' vi-backward-delete-char-incr
-bindkey -M viins '^?' vi-backward-delete-char-incr
-bindkey -M viins '^i' expand-or-complete-prefix-incr
-bindkey -M emacs '^h' backward-delete-char-incr
-bindkey -M emacs '^?' backward-delete-char-incr
-bindkey -M emacs '^i' expand-or-complete-prefix-incr
-
-unsetopt automenu
-compdef -d scp
-compdef -d tar
-compdef -d make
-compdef -d java
-compdef -d svn
-compdef -d cvs
-
-# TODO:
-# cp dir/
-
-now_predict=0
-
-function limit-completion
-{
- if ((compstate[nmatches] <= 1)); then
- zle -M ""
- elif ((compstate[list_lines] > 6)); then
- compstate[list]=""
- zle -M "too many matches."
- fi
-}
-
-function correct-prediction
-{
- if ((now_predict == 1)); then
- if [[ "$BUFFER" != "$buffer_prd" ]] || ((CURSOR != cursor_org)); then
- now_predict=0
- fi
- fi
-}
-
-function remove-prediction
-{
- if ((now_predict == 1)); then
- BUFFER="$buffer_org"
- now_predict=0
- fi
-}
-
-function show-prediction
-{
- # assert(now_predict == 0)
- if
- ((PENDING == 0)) &&
- ((CURSOR > 1)) &&
- [[ "$PREBUFFER" == "" ]] &&
- [[ "$BUFFER[CURSOR]" != " " ]]
- then
- cursor_org="$CURSOR"
- buffer_org="$BUFFER"
- comppostfuncs=(limit-completion)
- zle complete-word
- cursor_prd="$CURSOR"
- buffer_prd="$BUFFER"
- if [[ "$buffer_org[1,cursor_org]" == "$buffer_prd[1,cursor_org]" ]]; then
- CURSOR="$cursor_org"
- if [[ "$buffer_org" != "$buffer_prd" ]] || ((cursor_org != cursor_prd)); then
- now_predict=1
- fi
- else
- BUFFER="$buffer_org"
- CURSOR="$cursor_org"
- fi
- echo -n "\e[32m"
- else
- zle -M ""
- fi
-}
-
-function preexec
-{
- echo -n "\e[39m"
-}
-
-function vi-cmd-mode-incr
-{
- correct-prediction
- remove-prediction
- zle vi-cmd-mode
-}
-
-function self-insert-incr
-{
- correct-prediction
- remove-prediction
- if zle .self-insert; then
- show-prediction
- fi
-}
-
-function vi-backward-delete-char-incr
-{
- correct-prediction
- remove-prediction
- if zle vi-backward-delete-char; then
- show-prediction
- fi
-}
-
-function backward-delete-char-incr
-{
- correct-prediction
- remove-prediction
- if zle backward-delete-char; then
- show-prediction
- fi
-}
-
-function expand-or-complete-prefix-incr
-{
- correct-prediction
- if ((now_predict == 1)); then
- CURSOR="$cursor_prd"
- now_predict=0
- comppostfuncs=(limit-completion)
- zle list-choices
- else
- remove-prediction
- zle expand-or-complete-prefix
- fi
-}
13 .zshrc
View
@@ -100,19 +100,6 @@ function cdb() {
cd `ruby -e "require 'rubygems';gem 'bundler';require 'bundler';Bundler.load.specs.each{|s| puts s.full_gem_path if s.name == '${1}'}"`
}
-# ssh-agentの設定
-agent="$HOME/.ssh/ssh-agent"
-if [ -S "$SSH_AUTH_SOCK" ]; then
- case $SSH_AUTH_SOCK in
- /tmp/*/agent.[0-9]*)
- ln -snf "$SSH_AUTH_SOCK" $agent && export SSH_AUTH_SOCK=$agent
- esac
-elif [ -S $agent ]; then
- export SSH_AUTH_SOCK=$agent
-else
- echo "no ssh-agent"
-fi
-
export GREP_OPTIONS='--line-number --color=auto --exclude-dir=".svn"'
export PATH=./bin:$PATH
export CDPATH=$HOME

No commit comments for this range

Something went wrong with that request. Please try again.