Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winum to display window numbers in mode-line #13

Open
olegbc1 opened this issue Feb 22, 2018 · 3 comments
Open

winum to display window numbers in mode-line #13

olegbc1 opened this issue Feb 22, 2018 · 3 comments

Comments

@olegbc1
Copy link

olegbc1 commented Feb 22, 2018

I use winum to switch between windows in emacs, however I am struggling to display window number in my mode-line, preferably in [#] format (i.e. [1] [2] [3] ...).

What variable can I use to append window number to my mode-line-format list? Please see below an example of my mode-line configuration.

(setq-default mode-line-format (list
    " "
    '(:eval (if (vc-backend buffer-file-name)
                (list
                 (propertize octicon-octoface 'face 'octicons-modeline)
                 (propertize " "              'face 'mode-line))))
   mode-line-mule-info
   'mode-line-modified
   "-  "
   'mode-line-buffer-identification
   "  (%l, %c)  "
   'mode-line-modes
   " -- "
   `(vc-mode vc-mode)
))

@deb0ch
Copy link
Owner

deb0ch commented Feb 22, 2018

Maybe the customize variables winum-auto-setup-mode-line and winum-mode-line-position are what you are looking for ?

See https://github.com/deb0ch/emacs-winum/blob/master/winum.el#L134 or the winum group in customize for documentation

@hello-code
Copy link

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.

That sounds exciting!

@deb0ch
Copy link
Owner

deb0ch commented Nov 8, 2018

Hi again,

after such a long time I realised that I was completely beside the point 😅

What we push automatically in the mode-line is '(:eval (winum-get-number-string)) so just inserting that in your mode-line-format would work for you.

If you want something more custom you can use

'(:eval (format "[%s]" (winum-get-number-string)))`

I am about to push the feature @hello-code mentionned, soon there will be a winum-mode-line-format variable that is literally the format string supplied to the format function in my second snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants