class_OpenGL
class_OpenGL

Reputation: 195

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

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

Upvotes: 0

Views: 178

Answers (1)

Alex Ott
Alex Ott

Reputation: 87204

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.

Upvotes: 1

Related Questions