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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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