After putting the following statements on the ~/.bash_profile file:


# References: 
# - http://apple.stackexchange.com/questions/33677/how-can-i-configure-mac-terminal-to-have-color-ls-output
# - at the end of man page for ls command 

# enables colorised output

# ls
export LSCOLORS=ExFxCxDxBxegedabagacad

# use \h for the complete host name
# use \u for the account name (cell)

PS1="[\e[0;33mnbro\e[m, \e[0;32m\W\e[m] > "
export PS1

# man

# Reference: http://apple.stackexchange.com/questions/182320/is-there-a-way-to-color-parts-of-the-man-pages-on-the-terminal

export LESS_TERMCAP_mb=$(printf '\e[01;31m') # enter blinking mode – red
export LESS_TERMCAP_md=$(printf '\e[1;35m') # enter double-bright mode – bold, magenta
export LESS_TERMCAP_me=$(printf '\e[0m') # turn off all appearance modes (mb, md, so, us)
export LESS_TERMCAP_se=$(printf '\e[0m') # leave standout mode
export LESS_TERMCAP_so=$(printf '\e[01;33m') # enter standout mode – yellow
export LESS_TERMCAP_ue=$(printf '\e[0m') # leave underline mode
export LESS_TERMCAP_us=$(printf '\e[04;36m') # enter underline mode – cyan

when I've a command that is longer than the terminal width, this is the behaviour:

enter image description here

that is, the command instead of going to the next line, it goes over again on the same line overwriting the prompt. Is there a way to fix this?

  • Does it work of if you set PS1 back to "> "? – nohillside Mar 28 '16 at 13:15
  • @patrix Yes, it seems to work if I set PS1 just to "> "... – nbro Mar 28 '16 at 13:21

You must log in to answer this question.

Browse other questions tagged .