如何在oh-my-zsh中使用rake自动完成功能修复严重延迟


2

在为耙子做自动完成时,我会遇到严重的延迟。我有一个带有SSD的2011 MBP,我在尝试自动完成时仍然会得到3到5秒的延迟。

谢谢你的帮助!

.zshrc:

###OHMYZSH
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="lambda"
COMPLETION_WAITING_DOTS="true"
plugins=(node git bundler rails rails3 ruby autojump npm bower)
source $ZSH/oh-my-zsh.sh

###PATH
export PATH=/usr/local/sbin:/usr/local/bin/rbenv:/usr/local/bin:/usr/local/bin/ctags:/usr/local/postgres:/Users/chance/.rbenv/shims:/usr/local/share/zsh:$PATH
export PATH=$PATH:$HOME/.npm # Add npm modules to PATH for scripting
export PATH=$PATH:$HOME/.npm/bin # Add npm modules to PATH for scripting
export PATH=$PATH:$HOME/.npm/lib # Add npm modules to PATH for scripting


###ALIASES
  alias pg_start="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start"
  alias pg_stop="pg_ctl -D /usr/local/var/postgres stop -s -m fast"
  alias show_hidden='defaults write com.apple.finder AppleShowAllFiles TRUE & killall Finder'
  alias hide_hidden='defaults write com.apple.finder AppleShowAllFiles FALSE & killall Finder'
  alias mw='mocha -w -s 20ms -t 1000 --reporter Spec --growl'


###PG
export PGDATA='/usr/local/pgsql/data'


###BREW
if [ -f `brew --prefix`/etc/autojump ]; then
  . `brew --prefix`/etc/autojump
fi

###HEROKU
export PATH="/usr/local/heroku/bin:$PATH"

###NPM
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
COMP_WORDBREAKS=${COMP_WORDBREAKS/@/}
export COMP_WORDBREAKS

if type complete &>/dev/null; then
  _npm_completion () {
    local si="$IFS"
    IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
                           COMP_LINE="$COMP_LINE" \
                           COMP_POINT="$COMP_POINT" \
                           npm completion -- "${COMP_WORDS[@]}" \
                           2>/dev/null)) || return $?
    IFS="$si"
  }
  complete -F _npm_completion npm
elif type compdef &>/dev/null; then
  _npm_completion() {
    si=$IFS
    compadd -- $(COMP_CWORD=$((CURRENT-1)) \
                 COMP_LINE=$BUFFER \
                 COMP_POINT=0 \
                 npm completion -- "${words[@]}" \
                 2>/dev/null)
    IFS=$si
  }
  compdef _npm_completion npm
elif type compctl &>/dev/null; then
  _npm_completion () {
    local cword line point words si
    read -Ac words
    read -cn cword
    let cword-=1
    read -l line
    read -ln point
    si="$IFS"
    IFS=$'\n' reply=($(COMP_CWORD="$cword" \
                       COMP_LINE="$line" \
                       COMP_POINT="$point" \
                       npm completion -- "${words[@]}" \
                       2>/dev/null)) || return $?
    IFS="$si"
  }
  compctl -K _npm_completion npm
fi
###-end-npm-completion-###

可能滞后是由于超时而不是真正的迟缓?
Lorenzo Von Matterhorn

@LorenzoVonMatterhorn也许,但它给了我选择。反正有调试吗?
Chance

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.