Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 10604

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

6 votes
Accepted

What are the benefits and use cases of relativenumber?

TL;DR relative numbers are just another tool in the toolbox they can be effective in terms of locality when a text-object doesn't cut it (and for the lazy-minded among us) they pair nicely with comma …
D. Ben Knoble's user avatar
  • 27.7k
1 vote

inserting a line number into substitution text

Turning Martin's comment into an answer, you can't have both a literal replacement and \=, but you can use string concatenation or printf to combine them: global/^$/substitute//\=printf('# %d', line(' …
3 votes

Line numbers relative to the screen

Not without patching the source (source: the only relevant options are number and relativenumber). I do recall some recent questions about using signs to create custom numbers. If anyone has those lin …
2 votes
Accepted

Enable line numbering for directories

According to :help netrw: *g:netrw_bufsettings* the settings that netrw buffers have (default) noma nomod nonu nowrap ro nobl So I would try " $MYVIMRC let g:netrw_bufsettings = 'nom …
D. Ben Knoble's user avatar
  • 27.7k
2 votes

How supply range to normal mode key-binding?

My preferred method here is to just let you enter the range from the place you normally do: on the Ex command line: nnoremap <leader>t :Test<C-b> Since <C-b> puts your cursor between at the beginning …
D. Ben Knoble's user avatar
  • 27.7k
8 votes
Accepted

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

Why it didn't work From :help FileType, *FileType* FileType When the 'filetype' option has been set. The pattern is matched against the …
D. Ben Knoble's user avatar
  • 27.7k
0 votes

Misunderstanding of interaction between local options, moving between windows, and WinLeave,...

WinLeave relativenumber.vim (nu = 1, rnu = 1) WinEnter relativenumber.vim (nu = 1, rnu = 1) BufLeave relativenumber.vim (nu = 1, rnu = 1) BufEnter (nu = 0, rnu = 0) "help.txt" [readonly] 253L, 9491B …
D. Ben Knoble's user avatar
  • 27.7k