我想要更改Visual Studio Code for Mac使用的默认终端应用程序。 我认为它是首选项或设置json的一部分,但不确定。
我想要更改Visual Studio Code for Mac使用的默认终端应用程序。 我认为它是首选项或设置json的一部分,但不确定。
想要更改默认的终端而不仅仅是外部终端,并添加自定义主题,显示当前所在的git分支以及文件是否需要被暂存或提交例如。
确保已安装以下内容:
安装powerline字体
(我使用Menlo字体,这是一种外观漂亮且非常流行的字体)。
点击这里,然后单击
下载
打开文件
单击
安装字体
(注意:如果没有安装这个字体,vscode集成终端将无法正确呈现主题)
通过运行以下命令打开.zshrc文件:
cd ~ ; code .zshrc
将iTerm的主题更改为agnoster
:
按
⌘f
打开在.zshrc文件中搜索输入
ZSH_THEME
查找直到找到实时代码,而不是被注释掉的代码 :)
编辑代码,使其看起来像
ZSH_THEME="agnoster"
保存文件
使用快捷方式打开vscode设置:
⌘,
在vscode设置内,您将看到两个面板。 在右侧面板中粘贴以下内容:
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Menlo for Powerline"
假设设置之前是空的,现在应该看起来像这样:{
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.fontFamily": "Menlo for Powerline"
}
完成!享受你全新的定制终端吧
如果你想让提示符显示除了用户名以外的东西,比如像我的或者任何你想要的闪电图标
运行以下命令打开 agnoster主题:
cd ~/.oh-my-zsh/themes/ ; code agnoster.zsh-theme
按下⌘f键打开 搜索:
⌘f
在搜索栏中粘贴下面的内容:
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
要更改提示符显示的内容,请仅编辑此部分:
$USER@%m
请不要修改此部分:
prompt_segment black default "%(!.%{%F{yellow}%}.)
最后,代码应该看起来像这样:
prompt_segment black default "%(!.%{%F{yellow}%}.) 在此处插入任何你想要的内容"
(注意:实际上你可以改变终端提示符的所有内容,但为了简洁起见,我们仅编辑了用户名部分)
prompt_segment black default "%(!.%{%F{yellow}%}.)"$'\u26a1'
- Daniel da Rocha虽然时间有点晚了,但你可以通过运行命令来更改它。
Terminal: Select Default Shell
它更加容易了
来自 Visual Studio Code 博客:
// 64-bit cmd it available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\cmd.exe"
// 64-bit PowerShell if available, otherwise 32-bit
"terminal.integrated.shell.windows":"C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"
// 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"
参考: 终端集成
settings.json
:"terminal.integrated.profiles.osx": {
"zsh": null
},
"terminal.external.osxExec": "iTerm.app"
。 - Simon Lang