I have set my number line relative to cursor as such:

(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)

But, In a long file with line-difference more than 4digit (1000+), change in 3digit to 4digit makes my text jump when I move around. ( https://asciinema.org/a/gCKoaT7DymQoDiFklHBKJHBgC ).

This answer 7years, suggests to customize relative-line-numbers-format variable. But I don't know how.

how change set relative line number 4-digit, or whatever-many-digit?

  • I don't think there is a relative-line-numbers-format variable any longer (at least I can't find it after loading display-line-numbers). But do C-h v display-line-numbers-width and see if that helps.
    – NickD
    Commented Sep 14, 2022 at 9:52

1 Answer 1


Following, command removes the issue by setting the width longer.

(setq display-line-numbers-width 4)

This only works in a current buffer, I still couldn't figure it to make globally change it.

Added to my keybindings, so that I use it each time opening big org-files.

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.