Vim (Vi improved)

(Last Updated On: 5 February, 2016)

Vim is an editor on Linux and Unix systems.

Tip 1:

If you like to add “softwrap”, you can do this:

then lines will be wrapped per word.

If you like to cut and paste a section:

Press v to start selecting. Move the cursor to the end of selection (up or down). Den press d to cut. Move cursor to destination, press P to paste the text you have selected.

Tip 2:

If you have a file with millions of lines, and you need just a chunk out of it, starting at one point, ending at a certain line, you can first open the file in VIM:

Then set line numbers:

Then find your first line. Most likey you will scroll, or search inside your file. Write down the line number.
Then find you second line number. Then you can write all lines to a new file with:

where 6446324 is the first line number, 6590789 is the last line number. “newfile” is the new file that will contain all lines between 6446324 and 6590789.

More interesting stuff can be found here:


Leave a Reply

Your email address will not be published. Required fields are marked *