LoginSignup
8
8

More than 5 years have passed since last update.

zshのzでタブ補完を可能にする

Posted at

あまり知られていないようなので書いときます。

rupa/z では、以下のように移動先をタブ補完することができます。

$ _z <TAB>
/to/path/hoge    /to/path/fuga     /to/path/piyo
/to/path/foo     /to/path/bazz     /to/path/bar

しかしデフォルトでは_zにしか補完関数が設定されていません。

そこで.zshrcに以下のような設定を追加することで_z以外にも補完関数を適用することができます。

compctl -U -K _z_zsh_tab_completion z

また、_Z_CMDでエイリアスを割り当てている場合は以下のように設定するとよいでしょう。

compctl -U -K _z_zsh_tab_completion "$_Z_CMD"
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8