Vim (Vi Improved) For Dummies: Prepared By: Rituparna Sonowal B.Tech (IT)
Vim (Vi Improved) For Dummies: Prepared By: Rituparna Sonowal B.Tech (IT)
STARTING vi vi filename edit a file named "filename" vi newfile create a new file named "newfile"
ENTERING TEXT i a insert text left of cursor append text right of cursor
MOVING THE CURSOR h j k l left one space down one line up one line right one space
BASIC EDITING x nx X dw ndw dd ndd D r cw ncw C o O J nJ u U delete character delete n characters delete character before cursor delete word delete n words delete line delete n lines delete characters from cursor to end of line replace character under cursor replace a word replace n words change text from cursor to end of line insert blank line below cursor (ready for insertion) insert blank line above cursor (ready for insertion) join succeeding line to current cursor line join n succeeding lines to current cursor line undo last change restore current linez
MOVING AROUND IN A FILE w forward word by word b backward word by word $ to end of line 0 (zero) to beginning of line H to top line of screen M to middle line of screen L to last line of screen G to last line of file 1G to first line of file <Control>f scroll forward one screen <Control>b scroll backward one screen <Control>d scroll down one-half screen <Control>u scroll up one-half screen n repeat last search in same direction N repeat last search in opposite direction
CLOSING AND SAVING A FILE ZZ :w :q! save file and then quit save file discard changes and quit file
THAN
K YOU !