Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器 软件资源

软件开发小程序制作系统集成与运维空间租用硬件开发视频监控技术咨询与支持——联系电话:0311-88999002/88999003

首页 / 操作系统 / Linux / 一个小设置:改变 eshell 的提示符

下面的小配置让 eshell 的 prompt 最多只显示最后 4 个文件夹名。

;; change eshell prompt
(defun yami-adjust-eshell-prompt (path)
(let* ( (path-components (split-string path "/"))
(len (length path-components))
(max-comp 4) )
(if (<= len max-comp)
path
(concat "<< " (mapconcat (lambda (str) str)
(nthcdr (- len max-comp) path-components)
"/")))))

(setq eshell-prompt-function
(lambda ()
(concat (yami-adjust-eshell-prompt (eshell/pwd))
(if (= (user-uid) 0) " # " " $ "))))

傻傻的效果,凑合着用先

<< download/emacs/admin/charsets # ls
CVS compact.awk eucjp-ms.awk kuten.awk
Makefile cp51932.awk gb180302.awk mapconv
big5.awk cp932.awk gb180304.awk mule-charsets.el