Thursday 12 June 2014

A beginner's tutorial on Vim Editor-IV

Part-III:-

Now continuing from the previous articles,
There are so many handy editing commands in vim that one can't imagine.Here all of you know that editing means deleting,copying,pasting texts.
We'll see it one by one now,(all things are done in command mode)
Deleting Commands:
the main key to start deleting is 'd'.Now appending characters with 'd' makes sense in case of deleting.
dd -> To delete a line 
dw -> To delete a word
d0 -> To delete from the cursor from the beginning of the line
d$ -> To delete from the cursor to the end of the line
dgg -> To delete from the beginning of the file
dG ->  To delete  to the end of the file
If you delete or do anything out of mistake,you can undo it by pressing 'u' and again if you change your mind then press 'ctrl-r'
Again you can delete 'n' number of lines or words,just press 'ndd' or 'ndw' respectively.
Copying And Pasting:
yy -> This will copy a line
p -> This will paste the copied line after the current line
P -> This will paste the copied line on the current line
Again as before you can copy 'n' number of lines by pressing 'nyy'.
Enjoy it by using it! This is most probably the last article in the series.It is sufficient for beginners.But there are lot more things about this interesting editor.If you are interested there are lot of good resources.
One good book is "Learning the vi Editor" by Arnold Robbins, Linda Lamb.
Thank you!

No comments:

Post a Comment