Writeroom mode and linum mode are incompatible (leave numbers at far left, making them useless for (evil) jumping). Is there anything else I can do to get centered text with (relative) line numbering close to the text?

  • How about right-aligning the line-numbers? (setq linum-format "%7d") There are a few threads that pop-up on Google when searching for this issue, so there are probably other solutions that have already been written up.
    – lawlist
    Nov 24, 2016 at 16:20
  • Not sure what you're looking for, but did you try commands such as center-region, center-paragraph, and center-line?
    – Drew
    Nov 25, 2016 at 6:15
  • @Drew, sorry I was unclear. I don't want to center the text in the file, just on the screen while editing. It seems a bit wrong, disturbing, to me if I am editing a file with lines spanning only half the screen that they should occupy the left half of the screen while the right is empty.
    – Toothrot
    Nov 25, 2016 at 16:09
  • I see. I just use separate frames (window-manager windows), and fit the frames to the buffer text. No wasted space at all, and text positioned anywhere I want on the display.
    – Drew
    Nov 25, 2016 at 16:38
  • have you thought about hilighting the line number with something like the hlinum package?
    – mclear
    Apr 24, 2017 at 4:51

1 Answer 1


Centered-window-mode works with line numbers, though it doesn't provide the numbers directly next to the the text.

However, if you are using the latest emacs, it now has native display of line numbers. If you set display-line-numbers-type 'relative or display-line-numbers-type 'visual and use in combination with centered-window-mode you'll get the numbers right next to the centered text, and with relative line numbers except for current line.

  • It does, but the numbers are placed at the far left, making it difficult to see which lines they belong to. It also 'centers' text further to the left than writeroom, for some reason.
    – Toothrot
    Nov 24, 2016 at 20:38
  • you can modify how it centers with cwm-centered-window-width. But I don't know what to say concerning your difficulty with number placing, if just having it on the left isn't going to work.
    – mclear
    Nov 27, 2016 at 21:11
  • I've updated this answer with reference to the new native line numbering.
    – mclear
    Jul 31, 2017 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.