Background
Line number come in very handy when you are working with any Text Editor. However if you take vi or vim editor then line numbers are hidden by default. In this post we will see how we can turn it on.
How to display or hide line numbers in vi or vim text editor
This post assumes you are a vim user and are aware of basic usage. Like for example when you need to save and quit data in vim you-
- press escape followed by :wq
- :q!
To show line numbers in vi simple type below are pressing escape -
- :set number OR
- :set nu
- :set nu! OR
- set nonumber
This you need to do every time you launch into vi editor. To make it default edit your file at location ~/.vimrc and append following line at the end -
- set number
Now you will always get line numbers when you launch vim editor.
Now that we have seen how to hide and display line numbers in vim editor lets see how we can jump to a particular line in vim -
How to jump to a particular line in vim
This is also fairly simple. Once you have launched vim you can simply move to any line number using following command -
- : linenumber
- :6
You can ever jump directly to your line number immediately as you open vim. To do that use following command while opening vim -
- vi +linenumber filename
- vi +6 test.txt
General Info
vim provides a lot of configurable options to set. To see them all type following command -
- :set all
To see everything that you have set so far you can type following command -
- :set
No comments:
Post a Comment