作者 iMadper [bash] 2016-01-07 16:00 (点击下载)

  1. function peco_select_history() {
  2. local tac
  3. exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
  4. BUFFER=$(fc -l -n 1 | eval $tac | peco --query "$LBUFFER")
  5. CURSOR=$#BUFFER # move cursor
  6. zle -R -c # refresh
  7. }
  8.  
  9. zle -N peco_select_history
  10. bindkey '^R' peco_select_history
  11.  
  12. function gs { git show $(git log --oneline | peco | cut -d' ' -f1) }
  13. if [[ $- =~ i ]]; then
  14.  
  15. # CTRL-T - Paste the selected file path(s) into the command line
  16. __fsel() {
  17. local cmd="${PECO_CTRL_T_COMMAND:-"command \find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune
  18. -o -type f -print
  19. -o -type d -print
  20. -o -type l -print 2> /dev/null | sed 1d | cut -b3-"}"
  21. eval "$cmd" | peco | while read item; do
  22. printf '%q ' "$item"
  23. done
  24. echo
  25. }
  26.  
  27. peco-file-widget() {
  28. LBUFFER="${LBUFFER}$(__fsel)"
  29. zle redisplay
  30. }
  31. zle -N peco-file-widget
  32. bindkey '^T' peco-file-widget
  33.  
  34. fi
  35.  
  36. fi

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)