:%s/$/{ctrl-V}{CR}/g2. Strip blanks at end of line:
:%s/{TAB}*$//3. Strip DOS ctrl-M’s:
:1,$ s/{ctrl-V}{ctrl-M}//4. Append current file to a file
:w>>file5. Write lines 5 through 10 to file
:5,10w file6. Append Lines 5 through 10 to file
:5,10w>>file7. Create a shortcut for docBlock for a comment, “ab” stands for “Abbreviations”
:ab _comment /*** * ***/This is what you will see in vi editor:
:ab _comment /*** ^M * ^M***/Now if you type ab and then space in the insert mode, you will see the following:
/*** * ***/8. Copy lines 5-10 to the line after 105
:5,10 co 1059. Move lines 5-20 to end of file
:5,20 m $10. Start a file with the cursor positioned at line 24
vi +24 myfile.txt11. Start a file with the cursor positioned to the first occurrence of the string foo in the first file being edited
vi +/foo myfile.txt12. Shows number of lines in file
:=