feat(winum): add popup winum display
This commit is contained in:
parent
6d9e142cc0
commit
7d2a1ab848
2 changed files with 12 additions and 5 deletions
15
config.org
15
config.org
|
|
@ -2395,7 +2395,7 @@ I've set my default Emacs shell to =bash=, since pointing Emacs to a non-POSIX s
|
|||
|
||||
Emacs comes with a few standard commands for selecting different windows. These are mostly directional, allowing you to move your selection up, right, left or down from the current window. This is a bit inconvenient when there are a lot of windows, so the =winum= package allows you to assign a number to each window to make navigation easier.
|
||||
|
||||
There's just one wrinkle: Doom Emacs's popup management system. Popups are treated as separate from "real" windows, usually displayed on the edge of the frame and without a modeline. =winum= has no knowledge of popup windows and assigns them numbers exactly the same as any other window. This can get really confusing, since windows get renumbered every time a new popup appears.
|
||||
There's just one wrinkle: Doom Emacs's popup management system. Popups are treated as separate from "real" windows, usually displayed on the edge of the frame and without a modeline. =winum= has no knowledge of popup windows and assigns them numbers exactly the same as any other window. This can get really confusing, since windows get renumbered every time a new popup appears, and the lack of a modeline makes it hard to tell which popup has which number.
|
||||
|
||||
To solve this issue, I've written my own fork of =winum=:
|
||||
|
||||
|
|
@ -2429,12 +2429,19 @@ With the basic config out of the way, we can implement popup-aware numbering by
|
|||
(if (+popup-window-p w)
|
||||
(winum--assign-unique
|
||||
w popup-index t
|
||||
(cons 'popup-index (1+ (cdr popup-index))))
|
||||
(cons 'popup (1+ (cdr popup-index))))
|
||||
(winum--assign-unique w index t)))))
|
||||
(setq winum-auto-assign-function #'~/winum-auto-assign))
|
||||
(defun ~/winum-display-function (index)
|
||||
"Display regular windows as integers, and popup windows as
|
||||
integers prefixed with tilde (~)."
|
||||
(if (eq (car-safe index) 'popup)
|
||||
(format "~%d" (cdr index))
|
||||
(int-to-string index)))
|
||||
(setq winum-auto-assign-function #'~/winum-auto-assign
|
||||
winum-display-function #'~/winum-display-function))
|
||||
#+end_src
|
||||
|
||||
For convenience, we can add functions to select a particular popup window:
|
||||
For convenience, we'll add keybinds to select a particular popup window:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :leader
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6094bb05f3a78687529b55674dbdd697e51e1c25
|
||||
Subproject commit bcb7c626b9beb1dbab5a624856410b5fbaf72392
|
||||
Loading…
Add table
Add a link
Reference in a new issue