1. 下载安装,安装过程省略
Windows Terminal
https://github.com/microsoft/terminal/releases
Git
https://git-scm.com/downloads
2. 打开设置,编辑setting.json文件,在profiles.list中增加
{
//跟其他guid不重复即可
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b9}",
"hidden": false,
"name": "Terminal",
//根据Git安装路径调整,注意不是外面的git-bash.exe,那个会单独打开新窗口
"commandline": "C:/Program Files/Git/bin/bash.exe",
//自定义路径
"startingDirectory": "f:/code/",
"cursorShape": "underscore",
//选择喜欢的字体
"fontFace": "Ubuntu Mono",
"fontSize": 12,
"icon": "图标路径",
//选中区块的颜色
"selectionBackground": "#7094bd",
"backgroundImage": "背景图片路径",
"backgroundImageStretchMode": "fill",
"backgroundImageOpacity": 0.3,
"scrollbarState": "hidden"
}
3. 下面是关键,修改.bashrc文件(没有则新建,路径:C:/Users/用户名/.bashrc,注意前面的“.”),加入以下内容
#命令提示符格式(\[\033]0;\W\007\]标题栏显示当前目录,\[\033[01;32m\]\t\[\033[00m\]显示时间,后面是路径),具体可搜索关键字“linux PS1”
export PS1='\[\033]0;\W\007\]\[\033[01;32m\]\t\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]> '
#ls带颜色,方便区分
alias ls='ls --color=auto'
alias vi=vim
#设置编码格式,否则中文删除需要两下,而且少一下就会乱码
export LANG=C.UTF-8
4. 最终效果图

网友评论