Wednesday, February 23, 2011

Vim shortcuts: Efficient Editing

Vim is editors' best friend, like earthworms are of farmers'. I have started appreciating the beauty of the various shortcuts in vim. They make editing so much fun and time efficient. I wonder it would have been really pathetic to not have been introduced to vim-craft!

Here are some shortcuts that I use:
1. To yank and paste: {[num-of-lines]"[reg-name]yy} + {"[reg-name]p}
2. To cut and paste:  {[num-of-lines]"[reg-name]dd} + {"[reg-name]p}
3. a) To move through the file; mark the file: {m[char]} + {'[char]} 
    b) Some inbuilt marks- {''} : Move to the last visited line, {'.} : Move to last edited line.
4. Ctags are very useful when viewing C files.
5. To move to similar parenthesis: %
6. a) Macros to repeat similar series of tasks over and over:
           q[char]                                      #starts recording into [char]
            q                                               #stops recording
     b) To repeat the macro:

To be continued..

Helpful links:
1. Byte of Vim
2. Vim cookbook

No comments:

Post a Comment