Setting prompt not trivial
Posted May 20, 2005 18:18 UTC (Fri) by
diehl (guest, #6413)
Parent article:
Fish - The friendly interactive shell
One aspect of fish which I find problematic right now is that the default prompt
displays your current directory, which is fine, except that after you get deep into
a directory tree you use up most of you command line on the prompt. This
aspect coupled to the lack of multiline editing, means that you find you cannot
edit a recalled command because it wraps to 2 lines and you cannot edit the first
part of the command anymore.
So I decided to try to reset my prompt to not include the PWD. I guess I just
don't understand the syntax, because I could not do it. The documentation says
the default prompt is:
set FISH_PROMPT "whoami; echo \@; hostname\|cut -d . -f 1; echo \\" \"; set_color
green; pwd; set_color normal; echo '\> ';"
Unfortunately I don't completely understand what is going on this this line, for
example, the purpose of: echo \\ which looks like you are echoing a "\" which
must be escaped, but apparently not because you do not see a "\" in the
command prompt. Anyway, I tried to reduce this to:
set FISH_PROMPT "whoami; echo \@; hostname\|cut -d . -f 1; echo '\> '"
This will generate an error:
Unknown command 'hostname|cut'
I could not figure out any way to remove the pwd part and get the hostname|cut
part to work. Even if you just remove the "pwd;" for some reason you still get
the default prompt.
(
Log in to post comments)