Questions tagged [line-numbers]

Vim can output the number of each line on the left side of the screen. Questions about customizing this behavior.

Interesting related help topic:

91 questions
110
votes
4 answers

How can I show relative line numbers?

A lot of vim commands can take a number referring to the number of lines that the command will act on. Is it possible to show the line numbers relative to the current line? Something like the following: 3: some text here 2: more text 1: This is the…
Nick J Adams
  • 1,265
  • 2
  • 8
  • 11
45
votes
2 answers

How can I add line numbers to Vim?

I'd like to see line numbers, starting with 1 at the top, on the left side of Vim. Ideally it would look like this: 1 | foo = Foo.new 2 | bar = Bar.new 3 | baz = foo.baz(bar) ... 10| test = AwesomeSauce.test How can I do this in Vim?
user2
10
votes
4 answers

How can I set number and relativenumber at the same time?

I find both number and relativenumber useful. Is there any way to display them both at the same time?
Nathan Fellman
  • 201
  • 2
  • 5
10
votes
3 answers

Show absolute and relative line numbers (not hybrid)

I'm trying to find a way to show relative line numbers as well as absolute line numbers, but not the way hybrid line numbers does it. I want to see both at all times, probably each displayed on a column. Is this possible?
sleighty
  • 209
  • 2
  • 4
5
votes
2 answers

Show only every n relative line number

Is it possible to show every n relative line numbers? So for example, I can see a a (+/-) 10, 20, 30... instead of a value on every line. If there's no current way to do it, is it possible to create? i.e. can a plugin programmically change the line…
maged
  • 195
  • 4
5
votes
1 answer

Relative number on old Vim versions

How can I get the relative number feature on old Vim versions (7.2 to be exact in my scenario) ? I cannot install a newer version because other people are also using Vim on the same server.
JaDogg
  • 417
  • 4
  • 12
4
votes
1 answer

Is there an option to zero-pad line numbers?

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?
4
votes
1 answer

Why are relative line numbers useful in Vim?

I have been used to absolute line numbers (:set number norelativenumber). I'm unable to find a good reason and utility value for relative line numbers (:set nonumber relativenumber) line or hybrid line numbers (:set number relativenumber). Can…
4
votes
0 answers

Add vertical line between line numbers and file contents

I have set number in my ~/.vimrc, which enables line numbers. Generally they are quite useful, but it can be a bit tricky to discern the actual contents of a numerical data file from the line numbers, even if the line numbers have a different…
Quasímodo
  • 2,466
  • 9
  • 22
4
votes
2 answers

Can relative number be changed so that current line is 1?

I knew this site would teach me more about my beloved vim :-) In posting a question/answer on how to delete large blocks without having to count lines, one of the answers taught me something I didn't know, that being relative line numbers along the…
user579
3
votes
1 answer

How to show line numbers only at fixed intervals?

I know how to show absolute as well as cursor-relative line numbers but I do not need to see each line number and they look too crowded. I would like to just see line numbers at an interval, say every 5 lines eg. 5, 10, 15, and so on. Is there a way…
Ketan
  • 265
  • 1
  • 3
3
votes
1 answer

line numbers in vim -H reversed

Recently I installed vim 8.2 on Windows 10 and vim 8.1.2269 on Linux Ubuntu. Both are compiled with +rightleft option. When I use gvim -H or vim -H (without vimrc file) and run :set number, I get line numbers on the right side (as it should…
Dan Haran
  • 33
  • 3
3
votes
2 answers

How can I have more space between line number and code?

Bascially, I want to increase the space between line number and code. Other line number plugin is also acceptable. From this: to this:
ZIYIM
  • 31
  • 2
3
votes
1 answer

Get rid of extra gutter spacing

Vim always has 3 spaces for the line numbers on the left, in the gutter. Since I set relativenumber, and (unfortunately) don't have a monitor with the vertical space for 100 lines, I will never need more than 2 places for the line number. The…
Eggrenade
  • 81
  • 1
  • 5
2
votes
0 answers

How to display all line numbers in Vim?

In my .vimrc i have added this line set number But it only displays the line number for the lines that exist in the buffer, and not beyond this; after this it just shows ~. How can I show line numbers for the entire visual area?
Ashok Arora
  • 859
  • 1
  • 7
  • 13
1
2