Questions tagged [line-numbers]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
974 views

Vim never shows line number for Python files even though I have `.vimrc`

I found it strange that I can never have Vim show line number automatically for .py files, even if I have this as my ~/.vimrc set background=dark autocmd FileType py,c set number Strangely enough, ...
44
votes
2answers
10k views

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 = ...
40
votes
5answers
5k views

How can I generate a list of sequential numbers, one per line?

Starting from a blank slate, how can I obtain a document that contains 1 2 3 4 5 6 7 8 9 10 … 100 To be clear, I don't want these numbers displayed in the margin; I want them inserted into the ...
0
votes
4answers
1k views

Nvim can not detect focus change inside tmux sessions

I use the following setting for automatic line number toggle. augroup numbertoggle autocmd! autocmd BufEnter,FocusGained,InsertLeave * set relativenumber autocmd BufLeave,FocusLost,InsertEnter ...
1
vote
1answer
2k views

Vim ignore terminal color schemes when setting colors

I don't want vim to be affected by my terminal's color scheme. Is there a way to do this? In particular, I want my LineNr column to be colored black. I have seen it is possible because airline ...
9
votes
2answers
3k views

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?
9
votes
1answer
1k views

Current line number aligned to the left with number and relativenumber

I use relative line numbers along with an absolute line number for the current line: set number set relativenumber The absolute current line number is always aligned to the left, and the help pages (...
2
votes
1answer
2k views

How to display line numbers in netrw v125 (vim7.0)?

I added let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro' and set nu to my vimrc on my Ubuntu machine. It can display line numbers in netrw (V149). When I use the same vimrc on a remote server ...
10
votes
3answers
2k views

Visual Block Mode edit with sequential number [duplicate]

Suppose I'd like to create a list - "1" - "2" - "3" what Is the smartest way to create such? My attempt would be to i- "1"ESCyypp to get - "1" - "1" - "1" and then jump to the second line's 1 ...
2
votes
1answer
250 views

Automatically set the 'number' option in Vim when entering Ex mode, set 'nonumber' in visual mode

I have previously asked this in StackOverflow (May 2015), but without getting any replies that I was completely happy with. This ought to be simple: I want to configure Vim to set number whenever ...
-1
votes
1answer
120 views

How to check if total number of lines are bigger than 10 in Vim? [closed]

I want to check if number of lines are bigger than 10 in Vim. I tried to use this code in vimrc file: if line("$") > 10 colorscheme currentline endif Edit: I made a colorscheme with ...