Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are two types of line numbering in vim, relative and absolute. The former counts the lines starting from the vertical position of the cursor, backwards and forwards. The latter starts at the top of the file to the bottom of the file.

Vim has several ways to move and edit a file. For example, to go to a specific line, you would use <n>gg and you would jump to that line. This is useful for navigation as well as selection.

There are likewise commands that are relative from the cursor's position. dd and yy come immediately to mind, as well as the h-j-k-l commands. Knowing how many lines you need is augmented from the relative line numbering.

The key here is Vim doesn't have an easy way to switch from one to the other, except through manually typing commands like `set relativenumber` and `set number`. The plugin switches the number count based on what mode you are in.



Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: