Vim, the most loved and hated, controversial text editor ever. As a fellow normie, second best editor in my book, behind VSCode of course. Along with 5 other basic commands that I’ve only known in 5 years of using Vim, here’s tip on how to set and unset the number lines.
turn on / off number lines
Step 1. Open Vim.
Step 2. Show line numbers by running the following commands in order:
- Press the
ESCbutton (Normal mode).
Step 3. To turn them off, run:
:set nonumber, or
enable / disable relative number lines
Enable relative number lines:
:set relativenumber, or
Disable relative number lines:
:set norelativenumber, or
set line number width by N columns
Default value: 8. Min value: 1. Max value: 10.
set / unset line number permanently
Set line number permanently:
echo "set number" >> ~/.vimrc.
To unset line number permanently just update the line to
set nonumber. If you have them both,
nonumber setting will prevail.
open file at a specific line
vim +47 main.tf
list current Vim settings
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.