1

I'm using the directions here to customize my CSH prompt. Here's what I'm using:

set prompt="\n%{\033[1;32m%}%m %{\033[36m%}${cwd}$ %{\033[0m%} "

First of all, the ${cwd} part isn't giving the full path to the directory I'm in, only the full path to the directory I'm in when .cshrc was sourced. How do I display the current directory?

Secondly, if I don't include the space at the end of the string the color of the text I type is changed to the color of the directory from the previous part. Is there anyway to do this without adding the space?

2 Answers 2

4

The following code solved both of my problems.

set prompt="\n%{\033[0;32m%}%n@%m:%{\033[0;33m%}%~%{\033[1;30m%}>%{\033\[1;37m%} "
1
  • So, in other words, you used %~? Could you make that explicit in your answer?
    – anon
    Sep 21, 2016 at 0:34
1

In C Shell, add the following lines to your .cshrc:

make a command doprompt that sets the prompt to the working directory

alias doprompt 'set prompt="`pwd` "'

set the prompt the first time around

doprompt

alias the cd command to change directories and reset the prompt

alias cd 'chdir !* || doprompt'
1
  • The doprompt command works fine. However, the cd alias causes problems. When I add that alias to my .cshrc, when I type cd it says .cshrc: Not a directory.
    – gsgx
    Mar 11, 2012 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .