So I really was serious with my previous journal entry.
Today I started digging through the extensive vim documentation to find out how to write vim scripts. It's actually quite simple but also has some strange scoping semantics. When running a vim script twice using ":so script.vim"
the values set in the first run are still present. You either have to re-start the vim session from which you are calling the script or include a lot of
if exists("b:var")
unlet b:var
endif
in your scripts.
One great thing about vim is the option to include a Perl interpreter in it. I, for one, am not very inclined to learn any other regex package than the one from Perl, so I don't feel quite at home if I have to use the crippled regexes of grep or, for that matter, vim. Also, the Perl interpreter will make the blogger for use.perl.com a snap. It should even be possible to retrieve old entries from a journal and modify them. My initial concern was that perhaps vim scripting isn't quite as powerful as Emacs' Elisp language. This, fortunately, turned out to be wrong.
<note_to_myself>
A Perl-enabled editor is always superior.
</note_to_myself>
Re:vim scripting
ethan on 2002-11-05T12:46:01
I enjoy vim scripting and find it quite powerful [perl.org]. (Plus, it's okay to program in baby-vim and we won't laugh;-)
Ah, just reminds me that it was your webpage where I picked up this little hack to use vim as a perldoc pager (I need it to be able to paste the relevant parts of the Perl documentation into postings for comp.lang.perl.misc;-). Also, your Perl indenter is in regular use.
But again, I feel at home with vim's regexps, because I learned vi (and sed, awk,...) before perl. (I have to admit that I still have to refer to the docs when doing lookahead/lookbehind assertions
Amazing how much the background one is coming from will influence one's preferred way of using a computer. For me, almost everything started with Perl. I picked it up while I was still in my Windows days. But the migration to Linux was a logical step because it seemed so nicely integrated there. Unfortunately it made me sort of lazy to learn new things: Why should I do Bash scripts when a perl is sitting around? Why using vim's native features when I can just exploit a full-blown Perl interpreter stuffed into my favourite editor?
Vim-scripting however has shown me once more that being polyglot is even better.