zoukankan      html  css  js  c++  java
  • gitbash 优化( alias、样式 )

    使用 alias

    用户目录(C:UsersAdministrator)创建 .bash_profile 文件

    alias bashalias='code ~/.bash_profile'
    alias bashcolor='code ~/.minttyrc'
    alias bashconfig='code /etc/profile.d/git-prompt.sh'
    alias gitconfig='code ~/.gitconfig'
    
    alias .='cd ~'
    alias ..='cd ..'
    alias ...='cd ../..'
    
    alias e='exit'
    alias cls='clear'
    
    alias desktop='cd E:Desktop'
    alias mycode='cd E:代码'
    
    alias md='mkdir'
    
    alias gs='git status'
    alias ga='git add .'
    alias gc='git commit -m'
    alias gp='git push'
    alias gitauto='git add . && git commit -m "auto deploy" && git push'
    alias gitautoall='git add . && git commit -m "auto deploy" && git push all'
    
    alias sysoff='shutdown -s -t 0'
    alias sysre='shutdown -r -t 0'
    
    alias host='code /c/Windows/System32/drivers/etc/hosts'
    
    
    

    优化外观

    .minttyrc

    用户目录下创建 .minttyrc

    Font=Source Code Pro
    FontHeight=14
    Transparency=low
    FontSmoothing=default
    Locale=C
    Charset=UTF-8
    Columns=88
    Rows=26
    OpaqueWhenFocused=no
    Scrollbar=none
    Language=zh_CN
    
    ForegroundColour=131,148,150
    BackgroundColour=0,43,54
    CursorColour=220,130,71
    
    BoldBlack=128,128,128
    Red=255,64,40
    BoldRed=255,128,64
    Green=64,200,64
    BoldGreen=64,255,64
    Yellow=190,190,0
    BoldYellow=255,255,64
    Blue=0,128,255
    BoldBlue=128,160,255
    Magenta=211,54,130
    BoldMagenta=255,128,255
    Cyan=64,190,190
    BoldCyan=128,255,255
    White=200,200,200
    BoldWhite=255,255,255
    
    BellTaskbar=no
    Term=xterm
    FontWeight=400
    FontIsBold=no
    
    

    git-prompt.sh

    运行 $ code /etc/profile.d/git-prompt.sh打开 git-prompt.sh

    或者直接打开 C:Program FilesGitetcprofile.dgit-prompt.sh

    if test -f /etc/profile.d/git-sdk.sh
    then
    	TITLEPREFIX=SDK-${MSYSTEM#MINGW}
    else
    	TITLEPREFIX=$MSYSTEM
    fi
    
    if test -f ~/.config/git/git-prompt.sh
    then
    	. ~/.config/git/git-prompt.sh
    else
    	PS1='[33]0;Bash07]'      # 窗口标题
    	PS1="$PS1"'
    '                 # 换行
    	PS1="$PS1"'[33[32;1m]'     # 高亮绿色
    	PS1="$PS1"'➜  '               # unicode 字符,右箭头
    	PS1="$PS1"'[33[33;1m]'     # 高亮黄色
    	PS1="$PS1"'W'                 # 当前目录
    	if test -z "$WINELOADERNOEXEC"
    	then
    		GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
    		COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
    		COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
    		COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
    		if test -f "$COMPLETION_PATH/git-prompt.sh"
    		then
    			. "$COMPLETION_PATH/git-completion.bash"
    			. "$COMPLETION_PATH/git-prompt.sh"
    			PS1="$PS1"'[33[31m]'   # 红色
    			PS1="$PS1"'`__git_ps1`'    # git 插件
    		fi
    	fi
    	PS1="$PS1"'[33[36m] '      # 青色
    fi
    
    MSYS2_PS1="$PS1"
    
    

    注意:如果在你的 windows 版本下 git bash 光标错位,你要修改 git-prompt.sh 下的 符号 '➜ ',我建议你将它改为普通字符,即可解决!

    参考资料:
    为 win10 打造 Linux 终端(非 wsl)

  • 相关阅读:
    Memoization-329. Longest Increasing Path in a Matrix
    Map-560. Subarray Sum Equals K
    Geometry-587. Erect the Fence
    Reservoir Sampling-382. Linked List Random Node
    Brainteaser-292. Nim Game
    Minimax-486. Predict the Winner
    Topological Sor-207. Course Schedule
    web前端开发规范手册
    css初始化
    asp.net LINQ实现数据分页
  • 原文地址:https://www.cnblogs.com/guangzan/p/12267826.html
Copyright © 2011-2022 走看看