Show buffer status in echo area, get rid of mode-line !
- Emacs, version >= 29.1
- hide-mode-line
- llama
- Manually
Clone and add to load-path, require the package.
- Melpa
This package is available on [MELPA].
Install with M-x package-install RET mini-echo within Emacs.
- light-weight, very simple structure and no many configs
- don't use mode-line at all, same experience in terminal
- port lots of segments from doom-modeline
- easy to add new segment with macro
(require 'mini-echo)
(mini-echo-mode)There are two kinds of segments, persistent and temporary:
-
persistent: segments likemajor-mode,buffer-size,vcsdisplayed persistently, which mainly used bymini-echo-persistent-ruleandmini-echo-persistent-function. Any buffer get persistent segments following order: callingmini-echo-persistent-functionto get plist of segments, otherwise usemini-echo-persistent-ruleas fallback. -
temporary: segments likeprocess,narrowdisplayed temporarily, which used bymini-echo-temporary-rule. All buffer get same temporary segments according tomini-echo-temporary-rule.
mini-echo-persistent-rule: variable, plist of persistent segments which are default to all buffers, support:bothor:long/:shortkeywords.
(setq mini-echo-persistent-rule
'(:long ("major-mode" "shrink-path" "vcs" "buffer-position" "buffer-size" "flymake")
:short ("buffer-name" "buffer-position" "flymake")))mini-echo-temporary-rule: variable, plist of temporary segments which are default to all buffers, support:bothor:long/:shortkeywords.
(setq mini-echo-temporary-rule
'(:both ("process" "selection-info" "narrow" "macro"
"profiler" "repeat" "blame" "text-scale")))mini-echo-persistent-function: A function which return a plist of persistent segments on conditions.mini-echo-persistent-detectis the default function to detect whether rule exists. e.g.
(defun mini-echo-persistent-detect ()
"Return a plist of persistent rule if matched.
Otherwise, return nil."
(with-current-buffer (current-buffer)
;; NOTE return the first match, so the former has higher priority
(pcase major-mode
((guard (bound-and-true-p atomic-chrome-edit-mode))
'(:both ("atomic-chrome" "buffer-name" "buffer-position" "flymake")))
((guard (or (memq major-mode '(git-commit-elisp-text-mode git-rebase-mode))
(string-match-p "\\`magit-.*-mode\\'" (symbol-name major-mode))))
'(:both ("major-mode" "project")))
('ibuffer-mode '(:both ("major-mode")))
('diff-mode '(:both ("major-mode")))
('dired-mode '(:both ("major-mode" "dired")))
('helpful-mode '(:both ("major-mode" "helpful")))
('xwidget-webkit-mode '(:long ("shrink-path") :short ("buffer-name")))
((guard (and (fboundp 'popper-display-control-p)
(popper-display-control-p (current-buffer))))
'(:both ("popper")))
(_ nil))))In ibuffer buffer, return (:both "major-mode") as persistent segments.
in dired buffer, return (:both ("major-mode" "dired")) as persistent segments.
In buffers created by atomic-chrome package, return (:both ("atomic-chrome" "buffer-name" "buffer-position" "flymake")) as persistent segments.
If not matched in the function, use mini-echo-persistent-rule as fallback.
mini-echo-toggle: command, show or hide some segment temporarily
Other options are here, see more info please check the file
;; write your own predicate function to switch style
(setq mini-echo-short-style-predicate #'your-own-predicate)
;; set separator to concat information
(setq mini-echo-separator " ")
;; adjust window-divider-mode appearence
(setq mini-echo-window-divider-args '(t 1 1))
;;; adjust update interval as you wish
(setq mini-echo-update-interval 0.3)
;;; adjust the number to avoid truncation or wrap line of minibuffer window
(setq mini-echo-right-padding 1)Write a segment with mini-echo-define-segment, e.g.
(mini-echo-define-segment "vcs"
"Return vcs info of current buffer.
Segment appearence depends on var `vc-display-status' and faces like
`vc-state-base' and related `vc-**-state'."
:fetch
(when (bound-and-true-p vc-mode)
(mini-echo-segment--print (mini-echo-segment--extract vc-mode)
nil mini-echo-vcs-max-length)))
(mini-echo-define-segment "time"
"Return current time."
:setup (display-time-mode 1)
:fetch (mini-echo-segment--extract display-time-string))
(defvar mini-echo--repeat nil)
(mini-echo-define-segment "repeat"
"Indicator of whether repeating transient map is active."
:update-advice '((repeat-post-hook . :after))
:fetch
(when mini-echo--repeat
(mini-echo-segment--print "REPEAT" 'mini-echo-repeat))
:update
(setq mini-echo--repeat (and repeat-mode repeat-in-progress)))
(mini-echo-define-segment "keycast"
"Display keycast info."
:update-hook '(post-command-hook)
:setup (require 'keycast)
:fetch (keycast--format keycast-mode-line-format)
:update (keycast--update)):fetch: sexp, which runs when mini-echo update by interval.:setup: sexp, which runs when the segment is first activated , e.g. load librarykeycastwhen activatekeycastsegment.:update: sexp, which runs when:update-hookor:update-adviceis triggered.:update-hook: list of hooks which run:updateafter it called, e.g. update "keycast" status after hookpost-command-hook.:update-advice: alist of (symbol . how) which runs:updateafter it called, e.g. update "repeat" status after run function(repeat-post-hook).
mini-echo-segment--extract: extract segment info from mode-line construct.mini-echo-segment--print: trim, truncate string with ellipsis if needed.
For more information, please see mini-echo-segments.el.
- rewrite mini-echo-define-macro
- add minibuffer background to distinguish in terminal
- setup segments per buffer
- add environment support, such as python, node.js, asdf...
- add support to highlight current window
- add support for nerd-icons
- refactor segment to distinguish between persistent and temporary types.
-
How to distinguish current window ?
Highlight current window is still on development, you could set hl-line-mode, or use some dim other window package for now. e.g.
;; or (global-hl-line-mode) (hl-line-mode) ;; Only highliht current buffer in current window (setq hl-line-sticky-flag nil) (setq global-hl-line-sticky-flag nil)
-
How to show window border in terminal?
In GUI, customize face
window-dividerto show window border, due towindow-divider-modeis not available in terminal, you need to use other measures to identify windows. In terminal,internal-borderis displayed, so only need to solve horizontal border problem. Enable packages like tabbar or topsy to help highlight horizontal border instead. -
How to distinguish minibuffer window in terminal?
Customize face
mini-echo-minibuffer-windowto set different background color from default.