How do I get Emacs shell mode to either render (or ignore) my colors instead of printing ASCII codes?

前端 未结 4 1452
逝去的感伤
逝去的感伤 2020-12-31 02:27

The symptom of the problem looks like \"[0m[27m[24m[J[34;1\" which on a terminal translates into the color blue.

-A

4条回答
  •  自闭症患者
    2020-12-31 03:03

    The following should work in your .bash_profile or .bashrc

    case $TERM in
    xterm-color)
    export PS1='\[\e]0;\W\007\]\[\e[34;1m\]\W\[\e[0m\]\$ '
    ;;
    *)
    export PS1='\W\$ '
    ;;
    esac
    

提交回复
热议问题