How to add padding to emacs -nw linum-mode?

emacs

Solution

You can use the variable `linum-format` to achieve this. Its value can either be a format string or a function which is called with line number as an argument. emacswiki has a couple of example of setting it to a format string

1) The following adds a space after the line-number

(setq linum-format "%d ")

2) You can also add a solid line separator

(setq linum-format "%4d \u2502 ")

I guess the above are sufficient for your needs. You can also find an example of using a function as `linum-format` here. Add whichever format suits your needs to your init file

Problem

I am using Emacs -nw in Ubuntu. I like to turn on linum-mode to see line numbers on the left margin, but the numbers are put right next to my code. I would love it if there could be some 'padding', like 1-character long, between line number and code. sorry I can't post an image since they are asking for 10 reputation, which I dont have:( How can I do this?

Original source

Related problems