4

When using set number and set numberwidth I'd like to have the line numbers padded with zeros instead of spaces.

example:

0001
0002
0003

Can it be done?

1 Answers1

3

AFAIK, this can only be done by changing the Vim source code and rebuilding.

The changes you need to make are as follows:

For zero-padded number, in src/screen.c on lines 2502 and 3712, replace:

char *fmt = "%*ld ";

with

char *fmt = "%0*ld ";

For zero-padded relativenumber, in the same file, on lines 2519 and 3725, replace:

fmt = "%-*ld ";

with

fmt = "%0*ld ";

Line numbers noted above are for the current version on Github, 7.4.1799.

muru
  • 24,838
  • 8
  • 82
  • 143
verb_noun
  • 46
  • 3