【備忘録】VSCodeとWindows TerminalでBashを普通に使うには (ヒストリー保存, etc...)
VSCodeで自動設定されるまま、WSLではない ローカルのbash (git-bash)を使うと、プロンプト設定が反映されていなかったり、ヒストリーが保存されなかったりします。
今回はVSCodeのターミナル設定を直すとともに、Windows Terminal・Console Window Hostでも、ローカルのbashを普通に使えるようにします。
インストールするもの
- Git for Windows
- Visual Studio Code
- Windows Terminal
設定
Bash (git-bash)
Bash (git-bash)
.bash_profile
.bash_profile
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUPSTREAM=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWSTASHSTATE=1
# プロンプトのカスタマイズ (リポジトリのブランチと状態を表示)
export PS1='\[\033[1;32m\]\u\[\033[00m\]:\[\033[1;34m\]\w\[\033[1;31m\]$(__git_ps1)\[\033[00m\] \$ '
# 【追記します】ヒストリーを保存するのに必要
PROMPT_COMMAND='history -a'
VSCode (ユーザー設定)
コマンドパレットから Open Settings (JSON)
{
...
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"terminal.integrated.shellArgs.windows": [
"--login"
],
...
}
Windows Terminal
settings.json",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : true
},
...
],
....
}
【おまけ】Console Window Host (bash.exeへのショートカット)
Author And Source
この問題について(【備忘録】VSCodeとWindows TerminalでBashを普通に使うには (ヒストリー保存, etc...)), 我々は、より多くの情報をここで見つけました https://qiita.com/shellyln/items/fcb5d8b35bec6a6592cc著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .