Thursday January 16, 2003
05:36 AM
Scrapple from the Apple
I'm often amazed at how vim's regular expressions just Do What I Mean.
Do I want to search for all lines that begin with a star ? The simpler
regexp that just-works is /^*/. No need to quote the star with a
backslash. Ditto for dollars that don't appear at the end of a pattern:
they match the litteral character $, not the end of line.
That's the right thing to do in a text editor, but I don't think that's
the right thing in a general-purpose programming language.
Title of this journal entry by Charlie Parker.
VIM DWIM (Score:1)
Interesting you should say that. It must be the way my brain works (or doesn't work) but I've always struggled with Vim's Regex requirments.
Being reasonably competent in Perl 5 Regex syntax (thanks to Friedl's MRE) I just get annoyed at the differences I find in Vim and drop out and end up doing things in Perl.
I suppose I should read the Vim docs but I'm almost afraid that my brain just can't hold two Regex flavours at once without stopping all together...
Re:VIM DWIM (Score:2)
There used to be a project (before vim 6 was out IIRC) to bring Perl 5-compatible regexps to vim (i.e. to write a translator Perl 5-style to vim-style.) It was dropped, but you can still write a patch and attempt to convince Bram Moolenaar (who isn't a Perl-addict like us...)
Re:VIM DWIM (Score:1)
broquaint out