I customized my prompt in .bash_profile to look like this:

export PS1="\w \e[0;32m\$(vcprompt -f '[%n:%b]')\e[m\$ "

Now, when I press up arrow to go back through history, find the one I want, then press control-a to go to the beginning of the line, it often stops me at the 5th character instead of going all the way to the beginning. Those first few characters are then "frozen" in place. If I arrow up or down from there it's as if those characters are the new $.

I press return and am back to normal, but it's quite irritating to have those characters stuck there! Did I screw something up in the customization? Thank you!


You need to mark the nonprinting sections of the prompt with \[ ... \] so bash can tell they won't take up space on screen. Try:

export PS1="\w \[\e[0;32m\]\$(vcprompt -f '[%n:%b]')\[\e[m\]\$ "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.