emacsdirectoryeshell

(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


Solution

  • 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.