Thursday, March 13, 2014

Linux - Copy/paste block of codes from Windows editor to Vi editor

Below is the command used to Copy/paste a block of code(s) from Windows editor to Vi editor. Basically to replace complete text from a particular file.

First copy the block of code(s) from windows editor then go to Vi editor and use the following command sequentially as given below

<ESC>
d
Shift+g
i
Shift+Insert
<ESC>

Above command says delete (d) the codes form specific line number (0 in this case) upto end of the file i.e. last line (note - capital G, hence Shift+g). Then go to insert mode (i) and paste the copied lines.