Discussion:
VIM: Width of line numbers
(too old to reply)
Ian Partridge
2003-10-15 10:57:00 UTC
Permalink
Hi,

In VIm, I'm using :set number to display line numbers in lines, which works
great.

However, the width allowed for line numbers seems to be 7 characters, and
as all my files are quite short (certainly less than 1000 lines, there is
wasted space on the left-hand-side of the screen.

I see:

1 some text
2 more text

rather than something like
1 some text
2 some text

Is there a way to narrow the field width for line numbers (short of hacking
the source)?

Many thanks in advance,

Ian Partridge

--
Remove murderous intentions towards canned meat to reply
Sven Guckes
2003-10-15 12:53:38 UTC
Permalink
Post by Ian Partridge
Hi,
In VIm, I'm using :set number to display line numbers in lines, which works
great.
However, the width allowed for line numbers seems to be 7 characters, and
as all my files are quite short (certainly less than 1000 lines, there is
wasted space on the left-hand-side of the screen.
1 some text
2 more text
rather than something like
1 some text
2 some text
Is there a way to narrow the field width for line numbers (short of hacking
the source)?
Many thanks in advance,
Ian Partridge
--
Remove murderous intentions towards canned meat to reply
Sven Guckes
2003-10-15 13:07:00 UTC
Permalink
Post by Ian Partridge
In VIm, I'm using :set number to display
line numbers in lines, which works great.
However, the width allowed for line
numbers seems to be 7 characters, ..
Is there a way to narrow the field width for
line numbers (short of hacking the source)?
no. this should be added to the VIM FAQ.

http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl
17.6. How do I display the line numbers of all the lines in a file?
17.6a How do I change the width of the line number display?
You can't.

mind you, it's already been on the todo.txt for quite some time...

:help todo
/numberlen
7 Add an option to set the width of the 'number' column. Eight positions is
often more than needed. Or adjust the width to the length of the file?
Add patch that adds 'numberlen' option. (James Harvey)
Other patch with min and max from Emmanuel Renieris (2002 Jul 24)
Other patch without an option by Gilles Roy (2002 Jul 25)

Sven
Mikolaj Machowski
2003-10-16 07:02:44 UTC
Permalink
Post by Ian Partridge
Hi,
In VIm, I'm using :set number to display line numbers in lines, which works
great.
However, the width allowed for line numbers seems to be 7 characters, and
as all my files are quite short (certainly less than 1000 lines, there is
wasted space on the left-hand-side of the screen.
1 some text
2 more text
rather than something like
1 some text
2 some text
Is there a way to narrow the field width for line numbers (short of hacking
the source)?
Create narrow vertical window at the left (or right, or both ;)
Put there numbers and sync two windows.

Downsides:
- there will be always one "cell" for border between windows
- syncing can be problem with more than one window open.

m.
--
LaTeX + Vim = http://vim-latex.sourceforge.net/
Learn Touch Typing with Vim? Oui. Ja. Yes. Tak:
http://vim.sourceforge.net/script.php?script_id=461
vim.pl - http://skawina.eu.org/mikolaj
Loading...