zsh で Volta のオートコンプリートを有効にする方法

結論

1.

まず補完機能用のスクリプトを出力します (_volta) 。

$ volta completions zsh -o _volta
   note:  does not exist, creating it
success: installed completions to _volta

2.

出力したスクリプトを /usr/local/share/zsh/site-functions に移動します。

$ sudo mv _volta /usr/local/share/zsh/site-functions

3.

シェルを再起動します*1.

4.

補完機能が効いていることを確かめます。

$ volta [TAB]
completions  -- Generates Volta completions
fetch        -- Fetches a tool to the local machine
help         -- Prints this message or the help of the given subcommand(s)
install      -- Installs a tool in your toolchain
list         -- Displays the current toolchain
pin          -- Pins your project's runtime or package manager
run          -- Run a command with custom Node, npm, and/or Yarn versions
setup        -- Enables Volta for the current user / shell
uninstall    -- Uninstalls a tool from your toolchain
use          --
which        -- Locates the actual binary that will be called by Volta

*1:sourceコマンド等でもよいです

Powered by はてなブログ