zshellはタブを完成させるためのあいまいなオプションです

zshellはタブを完成させるためのあいまいなオプションです

zshの完了に問題があり、かなり迷惑しました。不明な場所でオプションを洗練することです。たとえば、次のファイルが含まれているディレクトリにあります。

Tilertest1x1-00_1408311424.logtilertest1x1-00_1408311424.roottilertest2x2-00_1408311501.logtilertest2x2-00_1408311501.roottilertest3303
_140 8311527.ルート



「less ti」と入力してTabを押すと、zshはこの「tilertest-00_1408311」を完了します。私が望むところで止まるのではなく(「tilertest」)。奇妙なことは、私がある種のパス(例: "less ./ti")を提供した場合、うまく動作するようです。最初のあいまいさで止まるようにどのように変更できますか?私の.zshrcファイルが含まれていました。また、oh-my-zshを使用していることに注意してください。

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="cmilke01"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Uncomment the following line to use case-sensitive completion.
 CASE_SENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

 # Uncomment the following line to disable colors in ls.
 # DISABLE_LS_COLORS="true"

 # Uncomment the following line to disable auto-setting terminal title.
 # DISABLE_AUTO_TITLE="true"

 # Uncomment the following line to disable command auto-correction.
  DISABLE_CORRECTION="true"

 # Uncomment the following line to display red dots whilst waiting for     completion.
 # COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-  zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl"
# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

ベストアンサー1

この動作の一部を制御するオプションはですmenu_complete。したがって、以下が必要です。

unsetopt menu_complete

(ただし、oh-my-zshはすでにこれを行っているようです)

zstyle ':completion:*' completer _complete
bindkey '\t' expand-or-complete

zsh -f新しいシェルと動作を比較することもできます。

autoload -U compinit
compinit
bindkey -e

ここで誤動作が発生した場合、zshバージョンのバグである可能性が高くなります。そうでない場合は、どのようなoh-my-zsh変更(該当するファイルから)が問題を引き起こしたかを確認してください。キーを押す前にX hをTab入力して、Ctrl次の完了に関するコンテキスト情報を取得できます(これは進行状況を見つけるのに役立ちます)。

解決策を見つけた後、それを永久に維持するには.zshrc 後ろに通常、ファイルの終わりまたはその近くで oh-my-zsh によって変更されたものです。

おすすめ記事