LoginSignup
14
12

More than 3 years have passed since last update.

PowerShellでbash-like, zsh-likeなタブ補完

Posted at

PSReadLineでのタブ補完はいくつかのモードがあります。

Emacs-like(default)

Set-PSReadLineKeyHandler -Key Tab -Function TabCompleteNext
Set-PSReadLineKeyHandler -Key Shift+Tab -Function TabCompleteNext

タブを押すと入力済みのものから補完されます。複数候補がある場合は押すたびに切り替わります。

vi-like

Set-PSReadLineKeyHandler -Key Tab -Function ViTabCompleteNext
Set-PSReadLineKeyHandler -Key Shift+Tab -Function ViTabCompleteNext

他のvi風機能を使っていないならデフォルトと同じ動作です。

bash-like

Set-PSReadLineKeyHandler -Key Tab -Function Complete

候補が一つならば、タブを押すと入力済みのものから補完されます。
複数候補がある場合は使用可能なコマンドの一覧が表示されます。

zsh-like

Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete

候補が一つならば、タブを押すと入力済みのものから補完されます。
複数候補がある場合は使用可能なコマンドの一覧を表示しつつ順に補完されます。

14
12
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
14
12