home | changes | index | login

Vim Editor

WareLogging. TextBased. A feature-rich, post-minimalist implementation of ViEditor. Brennen's favorite text editor.

= ideas =

Can you mix syntax highlighting in a single file? Maybe. Here's a thought: How about something that recognizes filetypes in PerlLanguage (or others) HereDocuments and applies the right syntax? Like

print <<HTML; <p>Here is some HTML.</p>

<p>And stuff.</p> HTML

...turns out this works for PHP heredocs by default, I assume it'd be do-able for Perl.

= keys, commands, settings =

VimCheatSheet

= record macros =

<Brennen> Tonight I was doing something stupid-repetitive to a text file - enclosing certain blocks but not others in HTML paragraph tags. It came to me that I ought to try vim's recording feature, rather than screwing around with writing a search and replace that would actually work. Turns out it's really simple to use. Just hit 'q', followed by the name of a register (0-9a-zA-Z), and then go about your business. Once you've finished with the string of commands you wanted to record, just hit q again. Then to execute them, do '@' followed by the name of the register you used.

Think of this as writing a miniature program on the fly. Since vi-style commands are built around a simple verb-object-number syntax, it's surprisingly elegant.

pick a name (required to comment or edit a page)
last edited November 10, 2008