跳至主要內容
版本:下一個

Tab 鍵自動完成命令

資訊

Completion for pnpm v9 is incompatible with completion for older pnpm versions. If you already install pnpm completion for version older than v9, you must uninstall it first so that completion for v9 may work properly. You may do so by removing section of code that contains __tabtab in your dot files.

不同於其他須使用外掛程式的套件管理系統,pnpm 的 Tab 鍵自動完成命令功能支援 Bash、Zsh、Fish 與其他類似的 shell。

To setup autocompletion for Bash, run:

pnpm completion bash > ~/completion-for-pnpm.bash
echo 'source ~/completion-for-pnpm.bash' >> ~/.bashrc

關於自動完成功能的使用範例,請參閱 此文章

Fig(僅限 macOS)

您可以使用 Fig 來操作 pnpm,以提供類似 IDE 的自動完成功能。 它適用於 Bash、Zsh 與 Fish。

執行此命令來安裝 fig:

brew install fig

g-plane/pnpm-shell-completion

pnpm-shell-completion is a shell plugin maintained by Pig Fang on Github.

Features:

  • Provide completion for pnpm --filter <package>.
  • Provide completion for pnpm remove command, even in workspace's packages (by specifying --filter option).
  • Provide completion for scripts in package.json.