1

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)
  (if
    (eq line (what-line)) "123  "
    "321"
  )
)

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

2
  • 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
    Commented 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. Commented Mar 16, 2017 at 21:53

1 Answer 1

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").

6
  • 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. Commented Mar 17, 2017 at 12:03
  • @user1685095 : please keep it polite.
    – Dan
    Commented Mar 17, 2017 at 13:44
  • @Dan What's impolite about my comment? Or is polite and I should "keep it" that way? Commented 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. Commented Mar 17, 2017 at 14:35
  • @stardiviner Thanks, cap! Can you show how to do that in elisp and nlinum? Commented 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.