LoginSignup
2
0

PsReadLineのIntelliSenseをデフォルトでリスト表示にする

Last updated at Posted at 2023-11-09

IntelliSenseについて

PowerShellにはPsReadLineというコマンドの入力を楽にしてくれる機能がある
その中のコマンドを予測して保管してくれるIntelliSenseという機能が結構便利

IntelliSenseは以下のコマンドで有効化できる

Set-PSReadLineOption -PredictionSource History

IntelliSenseの表示形式

IntelliSenseにはPrediction ViewList viewの2種類の表示方法がある。

Prediction View
履歴の中で一致するものが薄く表示されてTabで補完される
pre.png

List View
入力中に一致する履歴が一覧で表示されて矢印キーで選択できる
list.png

これらの表示方法はF2で切り替えられる
デフォルトの表示方法はPrediction viewに設定されている
設定は保存されないのでシェルを開きなおすとPrediction viewに戻ってしまう
自分はよくコマンドを忘れるのでList Viewのほうが使いやすい

デフォルトの表示方法をList Viewに変更する方法

Powershellで以下の内容をコピペして実行

notepad $PROFILE

メモ帳が開いたら次の内容をコピペして保存
ファイルが存在しないと言われた場合は新規作成

Set-PSReadLineOption -PredictionViewStyle ListView

PowerShellを再起動すると設定が反映される

2
0
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
2
0