Being a fan of Steve Yegge, I was randomly reading some of his older writings and eventually chanced upon his post on "Effective Emacs". Being a Vim guy, I wondered whether some of the tips he presents are useful for the Vim world as well.
Note: This is not a Vim vs Emacs thing, it is simply a porting of tips for Emacs to see whether the tips are useful for Vim users as well.
So here goes:
10 Specific Ways to Improve Your Productivity With Emacs, ported to Vim:
Item 1: Swap Caps-Lock and Control
This is a desktop-specific customization.
However, I don't think it is
required for Vim users, but it can be
Update: After using for a couple of days, I'm really starting to like this!
Item 2: Invoke M-x without the Alt key
Not relevant for Vim. Not a good start, first two tips are out...
Item 3: Prefer backward-kill-word over Backspace
This is a good tip. Normally, I would use
bdw to achieve the same.
To map backspace to this command in normal mode, put this in
:map <bs> bdw.
To make it work in insert mode you can put
:imap <bs> <esc>bdwa. I'm
sure there's a better way to use just one command to do this, please
leave a comment if you know of a better way.
Update: You can also use
ctrl-w in insert mode (see
thanks to pimaniac.
Item 4: Use incremental search for Navigation
n to search forward and
N to search backward.
Item 5: Use Temp Buffers
:new to get a new buffer (or alternately
To switch between buffers, use
ctrl-w ctrl-w (yes, twice).
:q as usual to close the buffer (or alternately,
Item 6: Master the buffer and window commands
- To split window vertically, run
- To split window horizontally, run
- To make all visible windows approximately equal height, run
- To switch to other window, run
ctrl-w ctrl-wor use the directional keys
- To delete other windows, use
ctrl-w oor run
- To list-buffers, run
- Dialog Boxes: The Root of All Evil - agree, Vim doesn't need dialog boxes as well (at least in the non-gui mode)
- Buffers to the Rescue - Same thing for Vim, I think.
Item 7: Lose the UI
- Remove the menubar using
- Remove the toolbar using
- Similar options exist for the scrollbar, see
- Region selection can be easier in Vim using the visual mode, just
v, use the normal keys to move around, such as
10jto move down by 10 lines, and then a command to work on that visual selection, such as
dto delete it.
Item 8: Learn the most important help functions
The help in Vim is vast, see
:help usr_toc to see the chapters of
the awesome reference manual.
Item 9: Master Emacs's regular expressions
I agree, Friedl's book is the authority on this. However, there are some good introductions to Vim regular expressions available.
Item 10: Master the fine-grained text manipulation commands
- Creating macros are easy in Vim. Press
qato start recording a macro called 'a', do all the commands you want to run, pres
qto stop recording. Then, run
@ato repeat the recorded commands i.e. a macro.
- Swapping two adjacent words, yeah, this can be better. I use
xpto swap characters and
dwwPto swap words, but it doesn't do fancy stuff like the
transpose-*functions. This can be an interesting plugin to write.
Tune in next time...
- Filling paragraphs can be done by setting
:set textwidth=80and running
gqapcommand to format 'a' 'p'aragraph, or like me you can map the 'Q' key to run it :
:nmap Q gwap. To make this work inside comments, make sure you
- gnuserv : I use It's All Text! Firefox extension.
- Dired : There are plugins available with similar functionality
- Whitespace manipulation - plenty of ways such as
:help fo-table, etc.
- nxml-mode : I haven't used nxml-mode but I'm still looking for something like Emacs' SGML-mode that works for Vim. I miss you, SGML-mode.
- picture-mode : Dr. Chip to the rescue with DrawIt.vim
- minibuffer management : Not sure what this is.
- effortless navigation : I think Vim has enough keys for this by
- region management : We can always choose the color scheme of choice
for the highlighted region, or change it ourselves, see `:help
- rectangle commands : Use
- emacs shells : We have
:shbut don't know if Emacs does something more
- align-regexp : Not sure what this is.
- frame initialization : I set Vim to always opens in full screen,
:help win16-maximized. Not sure how to do it in Linux yet, but in Gnome, I just press Alt-F10.
- using the goal column : No idea...
- setting the fill column : Nada...
- OS settings and font : I like to customize Vim's font and keep
- browsing and editing archives : I think Vim does this by default,
- advanced keybinding : see
- mastering the kill ring : I guess you can simulate this with
:echo @a, etc.
- mastering Info : Not sure if this would be useful in Vim.
- using M-x customize : Not sure what this does.
- utility apps : It's all in the plugins.
Summary: Porting good ideas is a good idea :)
I wonder why a search for Steve Yegge on Wikipedia points to Batman...
Update in November end, 2008: I have released a new book on Vim, read the whole thing right here..