Skip to content

Commit

Permalink
feat: new buffer-file-name-style "file-name-with-project"
Browse files Browse the repository at this point in the history
closes #718.
  • Loading branch information
seagle0128 committed Apr 16, 2024
1 parent c7ed5e5 commit 8231dc1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ Run `M-x customize-group RET doom-modeline RET` or set the variables.
;; relative-from-project => emacs/lisp/comint.el
;; relative-to-project => lisp/comint.el
;; file-name => comint.el
;; file-name-with-project => FOSS|comint.el
;; buffer-name => comint.el<2> (uniquify buffer name)
;;
;; If you are experiencing the laggy issue, especially while editing remote files
Expand Down
9 changes: 9 additions & 0 deletions doom-modeline-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
relative-from-project => emacs/lisp/comint.el
relative-to-project => lisp/comint.el
file-name => comint.el
file-name-with-project => FOSS|comint.el
buffer-name => comint.el<2> (uniquify buffer name)"
:type '(choice (const auto)
(const truncate-upto-project)
Expand All @@ -166,6 +167,7 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
(const relative-from-project)
(const relative-to-project)
(const file-name)
(const file-name-with-project)
(const buffer-name))
:group'doom-modeline)

Expand Down Expand Up @@ -1539,6 +1541,13 @@ Return `default-directory' if no project was found."
('file-name
(propertize (file-name-nondirectory buffer-file-name)
'face 'doom-modeline-buffer-file))
('file-name-with-project
(format "%s|%s"
(propertize (file-name-nondirectory
(directory-file-name (file-local-name (doom-modeline-project-root))))
'face 'doom-modeline-project-dir)
(propertize (file-name-nondirectory buffer-file-name)
'face 'doom-modeline-buffer-file)))
((or 'buffer-name _)
(propertize "%b" 'face 'doom-modeline-buffer-file)))))
(propertize (if (string-empty-p file-name)
Expand Down

0 comments on commit 8231dc1

Please sign in to comment.