enter image description hereI'd like to make current line number in relative line number mode more distinguishable

(setq nlinum-format-function 'myformat)
(defun myformat (line width)
    (eq line (what-line)) "123  "

Notice padding to the right of the current line number in vim which very subtly makes it easily distinguishable.

  • Please clarify what exactly you're trying to do, and include only code that is relevant to that task. Please explain what you want that code to do, and what happens instead.
    – Dan
    Mar 16, 2017 at 21:46
  • I'm trying to add padding to the right of the current line number. I was just experimenting and I was expecting to see 123 as the current line number and 321 on every other line. Mar 16, 2017 at 21:53

1 Answer 1


package nlinum has option nlinum-format. You can set option to value like this: (setq nlinum-format "%d "). Just like package linum can be configured like this: (setq linum-format "%4d \u2502").

  • Don't you think it would affect all line numbers and not only the current one? Spoiler alert -> it would. Read question more carefully before answering. Mar 17, 2017 at 12:03
  • @user1685095 : please keep it polite.
    – Dan
    Mar 17, 2017 at 13:44
  • @Dan What's impolite about my comment? Or is polite and I should "keep it" that way? Mar 17, 2017 at 13:47
  • Maybe can try a lambda function which is dynamic to decide whether current line as value. BTW, don't be too mean. Mar 17, 2017 at 14:35
  • @stardiviner Thanks, cap! Can you show how to do that in elisp and nlinum? Mar 17, 2017 at 23:42

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.