Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using vcprompt to provide me with the git branch and dirtiness status. It returns it as a string.

How can I catch this string in my tcsh prompt setting? I guess I need to put the call to vcprompt somehow in the prompt definition, but I can't find the syntax for that.

Edit: Solution is:

alias precmd "echo -n `vcprompt`"
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

In the original C shell, you could simply embed command substitution directly into the prompt variable, which I always thought made more sense. Under tcsh, you have to set up the precmd alias to do it. I'm not familiar with vcprompt but I assume it generates a newline at the end, so you'll probably want to use echo -n to throw away that newline, putting the prompt on the same line as the command, not the line before. Set prompt to whatever you want following; here I'm assuming you'll want a space.

alias precmd echo -n `vcprompt`
set prompt = ' '
share|improve this answer
    
Almost. Had to put quotes around everything after precmd. (And there seems to be no frickin' way to write that command line in a comment here without some markup happening... :( –  K.-Michael Aye Oct 26 '12 at 22:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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