VisualStudio Codeの端末設定
[ファイル]-[基本設定]-[設定]を選択して、terminal.integrated.shell.windows
で端末を設定する。
Git Bashの場合
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
Bash on Ubuntu on Windowsの場合
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\bash.exe"
Power Shellの場合
"terminal.integrated.shell.windows": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
現在のVisual Studio Code設定
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "メイリオ"
,"editor.tabSize": 2
,"editor.insertSpaces": true
,"search.exclude":{
"**/.svn/**":true
,"**/.git/**":true
,"**/node_modules/**":true
}
,"files.watcherExclude":{
"**/.svn/**":true
,"**/.git/**":true
,"**/node_modules/**":true
}
,"vsicons.projectDetection.disableDetect": true
,"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
,"editor.wordWrap": false
,"editor.renderIndentGuides":true
,"editor.renderLineHighlight":"all"
,"window.showFullPath":true
,"workbench.iconTheme": "vscode-great-icons"
,"files.eol": "\n"
}
Git Bashの環境設定
エイリアスの登録
cd
を実行すると、ホームディレクトリがユーザフォルダ直下になっているので、そこに.bashrc
を作成してエイリアスを登録する。
alias ls='ls -F'
alias ll='ls -lF'
alias wk='cd /c/WORKSPACE'
ターミナルの先頭文字の編集
環境変数`PS1'に記載する。一般的なLinuxの設定と同じ。
デフォルトは以下のようになっている。
> echo $PS1
\[\033]0;$TITLEPREFIX:${PWD//[^[:ascii:]]/?}\007\]\n\[\033[32m\]\u@\h \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0
m\]\n$
以下に変更した。
hoge@machine MINGW64 ~
$ vi .bashrc
export PS1='\[\e[1;31m\]\u@\h:\w${text}$\[\e[m\] '
hoge@machine MINGW64 ~
$ source ~/.bashrc
hoge@machine:~$