美文网首页学习笔记
Windows Terminal集成Gitbash

Windows Terminal集成Gitbash

作者: 0__o | 来源:发表于2020-05-09 14:12 被阅读0次

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. 最终效果图

5. 其他设置可参考:https://github.com/microsoft/terminal/blob/master/doc/cascadia/SettingsSchema.md

相关文章

网友评论

    本文标题:Windows Terminal集成Gitbash

    本文链接:https://www.haomeiwen.com/subject/azmoihtx.html