Vim (Vi improved)

Vim is an editor on Linux and Unix systems.

Tip 1:

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

:set wrap linebreak nolist

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:

vim filename

Then set line numbers:

:set number

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:

:6446324,6590789w newfile

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:

http://vim.wikia.com/wiki/Vim_Tips_Wiki

 

Leave a Reply

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