(Emacs) How to only show last directory in emacs shell?

166 views Asked by At

I would like to know if it is possible to show only last directory in eShell (Emacs Shell). For example, It's currently in path /home/user/Programming/C++. With current setup of eshell, ~/Programming/C++ $, but I would like to show only this: C++ $.

Thanks

1

There are 1 answers

0
Alex Ott On BEST ANSWER

Yes, it's possible - the prompt is generated by function stored in the eshell-prompt-function variable. You can redefine it to whatever you want. You can define it something like: (lambda () (concat (car (last (split-string (eshell/pwd) "/"))) " $ "))

See EmacsWiki for examples.