3

I am using the relative-line-numbers-mode and a 90 degree turned screen, which makes the text jump when it goes from displaying 100 in the relative number.

Is it possible to set a fixed width for the line numbers, i just need it set to 3 characters.

1 Answer 1

7

You can customize how to display the number. For example, define the following function that formats numbers as 003::

(defun jp-rel-format (offset)
  "Another formatting function"
  (format "%03d: " (abs offset)))

Then customize the variable relative-line-numbers-format to use this new function instead of the default relative-line-numbers-default-format.

You may try other format strings such as "%3d" to avoid leading zeros.

However, I just installed relative-line-numbers-mode and I don't experience the jump with numbers beyond 100. Are you using variable pitch font?

Your Answer

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

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