At least once in a while, we should follow Moolenaar's advice, i.e. take a step back and look at what we're doing. That goes for life in general, but I'll consider editing for now, largely because I can fit that into a tiny blog entry about vim. ;)

I recently updated my vimrc to balance parentheses automatically, and to automatically fill in a new script file with the appropriate shebang. Vim gets annoying with scripting and I have the feeling that emacs would have an easier time of doing this.

" insert parens automatically function InsertParen(paren, parens) if col(".") == col("$") return a:parens endif return a:paren endfunction imap ( <c-r>=InsertParen("( ", "()")<cr><ESC>i imap [ <c-r>=InsertParen("[ ", "[]")<cr><ESC>i " fill in new scripts shebang automatically autocmd BufNewFile *.py 0r ! (echo '\#\!/usr/bin/python'; echo ) autocmd BufNewFile *.sh 0r ! (echo '\#\!/bin/bash'; echo ) autocmd BufNewFile *.pl 0r ! (echo "\#\!/usr/bin/perl"; echo "use strict; use warnings;"; echo) " Bounce between paste and nopaste let paste_mode = 0 function TogglePaste() if g:paste_mode == 0 set paste let g:paste_mode = 1 echo "paste mode on" else set nopaste let g:paste_mode = 0 echo "paste mode OFF" endif return endfunction map I :call TogglePaste()<cr>

I used python's cgi.escape() to prep the config above,

cat ~/.vimrc | python -c 'for i in __import__("sys").stdin: print __import__("cgi").escape(i.rstrip())'

because I figured you wouldn't want to view-source, even if you had a nifty firefox bookmarklet that opens the source up in the same tab, like:

javascript:window.location='view-source:' + window.location.href

I have a couple of similar things, for toggling paste I have: set pastetoggle=, that just maps 'set paste' to F3. For the auto insert stuff you have I use skel files: autocmd BufNewFile *.pl 0r ~/.vim_files/skeletons/skel.pl, etc. Then in the skel files I have stuff like shebangs and use warnings. I don't have the parens thing. :) - Nathan
Crap, I also meant to add, scripting in emacs is a little nicer, and one of the reasons I switched away from vim a few months ago. vim script is painful, and ugly. Don't get me wrong though, I still love vim...the way a mother loves an ugly child :) - Nathan
I got really frustrated with cursor handling in console vim, so I just switched to gvim with --remote-wait to allow all editing to connect back to the vim server. I had to disable quitting from gvim by mapping ZZ and wq to non-lethal warnings because that habit has been hard to kill. -- Patrick.
I am glad you said that...I thought I was the only one that still used :wq and closed his editor everytime. It's not so bad in the shell, cuz usually I was cding to the next file (never cared for vim buffers) but in gvim that is a pita since you have to relaunch the app. - Nathan
So, why'd you migrate to emacs again? -- Patrick.
A few of reasons...1. Better scripting with elisp. 2. Better buffers. 3. I love to play with software :) The other thing is that I like the idea of using my editor to do other things (trivial example, Post to twitter). I am in there a lot anyway, might as well take care of other things. - Nathan