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.

DalekSall
  • 333
  • 2
  • 10

1 Answers1

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?

NickD
  • 29,717
  • 3
  • 27
  • 44
Juancho
  • 5,455
  • 16
  • 20