Skip to content

Commit

Permalink
add custom variable winum-format
Browse files Browse the repository at this point in the history
  • Loading branch information
deb0ch committed Nov 19, 2018
1 parent 8bafa66 commit b27b8f4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 19 deletions.
45 changes: 28 additions & 17 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
[[https://github.com/syl20bnr/spacemacs][file:https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg]] [[https://melpa.org/#/winum][file:https://melpa.org/packages/winum-badge.svg]] [[https://stable.melpa.org/#/winum][file:https://stable.melpa.org/packages/winum-badge.svg]]

* Contents :TOC:noexport:
- [[#introduction][Introduction]]
- [[#whats-changed-since-window-numbering][What's changed since window-numbering]]
- [[#installation][Installation]]
- [[#using-melpa][Using Melpa]]
- [[#manual-installation][Manual installation]]
- [[#how-to-use][How to use]]
- [[#configuration][Configuration]]
- [[#keybindings][Keybindings]]
- [[#customize-options][Customize options]]
- [[#configuration-file-example][Configuration file example]]
- [[#future-developments][Future developments]]
- [[#introduction][Introduction]]
- [[#changelog][Changelog]]
- [[#nov-15-2018][Nov. 15 2018]]
- [[#initial-release-whats-changed-since-window-numbering][Initial release: what's changed since window-numbering]]
- [[#installation][Installation]]
- [[#using-melpa][Using Melpa]]
- [[#manual-installation][Manual installation]]
- [[#how-to-use][How to use]]
- [[#configuration][Configuration]]
- [[#keybindings][Keybindings]]
- [[#customize-options][Customize options]]
- [[#configuration-file-example][Configuration file example]]
- [[#future-developments][Future developments]]

* Introduction
Window numbers for Emacs: Navigate your windows and frames using numbers !
Expand All @@ -25,7 +27,12 @@ from [[https://github.com/abo-abo/ace-window][ace-window]].
This version brings, among other things, support for number sets across multiple
frames, giving the user a smoother experience of multi-screen Emacs.

* What's changed since window-numbering
* Changelog
** Nov. 15 2018
- Added customize variable =winum-format=, a format string to configure how the
window number appears in the mode-line

** Initial release: what's changed since window-numbering
This package brings a lot of additions to the old window-numbering:

- Number sets across multiple frames, giving a smoother experience of
Expand Down Expand Up @@ -241,6 +248,14 @@ Several options are available through Emacs' Customize interface under

Default: =t=

- =winum-format=

Format string defining how the window number looks like in the mode-line.
This string is passed to the =format= function along with the result of
=winum-get-number-string=.

Default: =" %s "=

- =winum-mode-line-position=

The position in the mode-line =winum-mode= displays the number.
Expand Down Expand Up @@ -297,6 +312,7 @@ available winum options.
winum-auto-assign-0-to-minibuffer t
winum-assign-func 'my-winum-assign-func
winum-auto-setup-mode-line t
winum-format " %s "
winum-mode-line-position 1
winum-ignored-buffers '(" *which-key*"))

Expand All @@ -321,9 +337,4 @@ available winum options.

- Autocomplete read-from-minibuffer

- Add =winum-format= customize variable

Format string for displaying the window number in the mode-line. Default to
" %n " to get a space on each side of the window number.

- Things that you have thought of and I haven't :smile_cat:
13 changes: 11 additions & 2 deletions winum.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ numbers in the mode-line."
:group 'winum
:type 'integer)

(defcustom winum-format " %s "
"Format string defining how the window number looks like in the mode-line.
This string is passed to the `format' function along with the
result of `winum-get-number-string'."
:group 'winum
:type 'string)

(defcustom winum-ignored-buffers '(" *which-key*")
"List of buffers to ignore when assigning numbers."
:group 'winum
Expand Down Expand Up @@ -208,6 +215,10 @@ To get a number given a window, use the `cdr' of a value.
Such a structure allows for per-frame bidirectional fast access.")

(defvar winum--mode-line-segment
'(:eval (format winum-format (winum-get-number-string)))
"What is pushed into `mode-line-format' when setting it up automatically.")

(defvar winum--last-used-scope winum-scope
"Tracks the last used `winum-scope'.
Needed to detect scope changes at runtime.")
Expand Down Expand Up @@ -404,8 +415,6 @@ WINDOW: if specified, the window of which we want to know the number.
(remove-hook 'window-configuration-change-hook 'winum--update)
(setq winum--frames-table nil))

(defvar winum--mode-line-segment '(:eval (winum-get-number-string)))

(defun winum--install-mode-line (&optional position)
"Install the window number from `winum-mode' to the mode-line.
POSITION: position in the mode-line."
Expand Down

0 comments on commit b27b8f4

Please sign in to comment.