Code Monkey home page Code Monkey logo

mini-echo.el's Introduction

mini-echo.el

License GPL 3 MELPA

Echo buffer status in echo area, get rid of mode-line !

Contents

Screenshot

example

Install

dependencies

package

  • 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.

Feature

  • 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

Usage

(require 'mini-echo)
(mini-echo-mode)

There are three ways to adjust mini-echo segments display:

  1. mini-echo-default-segments: variable, plist of segments which are default to all major-modes
;; set default segments of long/short style
(setq mini-echo-default-segments
  '(:long ("major-mode" "buffer-name" "vcs" "buffer-position"
           "buffer-size" "flymake" "process" "selection-info"
           "narrow" "macro" "profiler")
    :short ("buffer-name-short" "buffer-position" "process"
            "profiler" "selection-info" "narrow" "macro")))
  1. mini-echo-rules: variable, list of rules applied for major modes. if your emacs version >= 30, then you can write a rule for parent mode which will take effect in all children modes. Otherwise, write rules for every specific major mode instead.
;; Concell of (SEGMENT . POSITION) is required to adjust the appearence.
;; 0 means hide the segment in major mode if it's displayed by default.
;; non-zero number means the order of segment to be put, it's counted from 1.
(setq mini-echo-rules
      '((emacs-lisp-mode :both (("buffer-position" . 3))
                         :long (("evil" . 1) ("buffer-size" . 4))
                         :short (("vcs" . 0)))))

Explanation: when emacs-lisp-mode is enabled, long-style shows "evil" segment in first place, shows "buffer-size" segment in fourth place (right-align). short-style hide "vcs" segment. And both long/short style show "buffer-position" in third place.

  1. 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)

Customization

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))

Keywords

  • :fetch: sexp, which runs when mini-echo update by interval.
  • :setup: sexp, which runs when the segment is first activated , e.g. load library keycast when activate keycast segment.
  • :update: sexp, which runs when :update-hook or :update-advice is triggered.
  • :update-hook: list of hooks which run :update after it called, e.g. update "keycast" status after hook post-command-hook.
  • :update-advice: alist of (symbol . how) which runs :update after it called, e.g. update "repeat" status after run function (repeat-post-hook).

Utils

  • 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.

Similar Package

Todo

  • 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

FAQ

  • 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-divider to show window border, due to window-divider-mode is not available in terminal, you need to use other measures to identify windows. In terminal, internal-border is 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-window to set different background color from default.

mini-echo.el's People

Contributors

elilif avatar idlip avatar liuyinz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mini-echo.el's Issues

Error in flymake segment

My current config:

(eval-when-compile (require 'use-package))
(use-package mini-echo
  :ensure t
  :vc (:fetcher github :repo liuyinz/mini-echo.el)
  :custom
  (mini-echo-default-segments '(
                                "evil"
                                "buffer-name"
                                "vcs"
                                "major-mode"
                                "flymake"
                                "time"
                                ))
  (mini-echo-short-segments '(
                              "buffer-name-short"
                              "major-mode"
                              "time"
                              ))
  :config
  (mini-echo-mode 1)
)

When I switch to buffer with active flymake mode I get an error

Error during redisplay: (mini-echo-update-overlays-when-resized #<frame emacs_float 0x55a180761ee0>) signaled (wrong-number-of-arguments #<subr flymake--mode-line-counter> 2) [3 times]

Total line count in buffer position

I was looking for a way to get something like mini-echo-position-format "%l:%t" with t as the total line count, but did not figure it out.
Is there a way to customize this?

thanks

Issue when loading theme twice or other theme

When you load a theme or change when mini-echo-mode is active, it create weird duplicate line displaying those messages again, if you reload any or same theme again (load-theme 'modus-vivendi t), emacs gets slow and you need to manually run M-x mini-echo-mode to get it to proper working display.

Specs:
Emacs GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.16.0)
Pgtk build in Wayland

To reproduce:

  1. Run (load-theme 'modus-vivendi t) twice and so

mini-echo

Here is the respective attached image.

Add lsp-modeline integration

According to lsp docs it is possible to show project errors in modeline.

Would be nice to extend already implemented lsp segment or add lsp-errors segment with same integration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.