VI
(cl-defun fish-prompt (&optional (filename default-directory))
"A simple prompt with a fish-like abbreviation of `$PWD'."
(let ((cwd (or (file-remote-p filename 'localname) filename)))
(concat
"\f\n"
(file-remote-p cwd)
(replace-regexp-in-string
"[^./][^/]*/"
(lambda (match) (string (aref match 0) ?/))
(substring (abbreviate-file-name cwd) 0 -1))
;; Add slash if it was the only character in the filename.
(when (file-equal-p "/" cwd) "/")
(if (zerop (user-uid)) " # " " $ "))))