(Emacs)如何只显示emacs shell中的最后一个目录?

时间:2017-10-30 14:21:37

标签: emacs directory eshell

我想知道是否可以在eShell(Emacs Shell)中仅显示最后一个目录。例如,它目前位于路径/home/user/Programming/C++中。使用eshell的当前设置~/Programming/C++ $,但我只想显示:C++ $

由于

1 个答案:

答案 0 :(得分:1)

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.