Separating Line Numbers from Text in Terminal: Emacs

725 views Asked by At

When I run emacs in Terminal mode and have the global-linum-mode option enabled , the line numbers are very close to my text and it is really irritating for the eyes. Is there a way to separate the line numbers from the text in Emacs?

2

There are 2 answers

0
Anton Kovalenko On BEST ANSWER

Try setting linum-format to "%d " (note space).

There's more to do if you want right-aligned line numbers (what's provided by the 'dynamic default for linum-format) with spacing after them. Perhaps something non-trivial should be done in linum-before-numbering-hook.

0
dispanser On

too few points to just add a comment to the accepted answer, but I'm using

(setq linum-format "%3d ")

to have right-aligned line numbers for files with less than 1000 lines. Also works OK for larger files, as the line numbers just take up the required number of chars (4 or more) even with that formatting option.