Been using VIm to edit php-ige recently, and need to grab some links that seem useful.

First, how to get rid of the finger travel to the escape key. You can always hit ctrl-[ for escape in VIm, apparently, which is nice. If Ctrl is too far away, you can map the Caps Lock key to control. Here's how in Mac OS X.

http://www.vim.org/tips/tip.php?tip_id=1083
amix _at_ amix.dk, December 24, 2005 2:18
I know how to turn caps off in Tiger (or turn it into a CTRL key):
- Open System Preferences
- Goto Keyboard & Mouse
- At the bottom of the panel there is a "Modifier Keys..." button, click it
- Choose "No Action" or "^ ctrl" for caps-lock


Very nice. Fringe benefit: No more accidental caps lock in VIm. Fringe drawback: No more caps lock. For now I'm sacrificing the benefit and trying out control as caps lock.

Alternately...
http://vim.wikia.com/wiki/Avoid_the_escape_key:
imap <D-space> <esc>
works even better in Mac! <D-space> means the "apple" key and the space key. Have fun!


I've also found an elementary autocomplete for VIm when editing html with the xml-edit plugin. To install into VIm.app, open the Package Contents and nav to the internal ftplugin folder.



I'm also interested in the surround.vim plugin.

Surround.vim is all about "surroundings": parentheses, brackets, quotes, XML tags, and more. The plugin provides mappings to easily delete, change and add such surroundings in pairs. While it works under Vim 6, much of the functionality requires Vim 7.
...
Emphasize hello: ysiw<em>

<em>Hello</em> world!

Finally, let's try out visual mode. Press a capital V (for linewise visual mode)
followed by S<p class="important">.

<p class="important">
<em>Hello</em> world!
</p>

This plugin is very powerful for HTML and XML editing, a niche which currently seems underfilled in Vim land. (As opposed to HTML/XML *inserting*, for which many plugins are available). Adding, changing, and removing pairs of tags simultaneously is a breeze.


Happy VImming, etc.

Labels: , ,