I switched to Vim
Friday, 26 February 2010
I was looking for an excuse to try something new and I decided to pick on one Notepad++ shortcoming that was handy: the Stata syntax highlighting gets utterly mangled after compound quotes -- `"`like so'"' -- which do sometimes arise, usually in the process of file open/file write.
Vim does not get confused by compound quotes and it comes with Stata syntax highlighting out of the box. Integrating it with Stata is not hard at all, either. There are some general directions by Nick Cox here, but on my Windows XP machine I just had to do two things.
First, I had to edit the PERSONAL/e/editors.ado file to make Vim replace Notepad++ entry in the Editors... sub-menu of the User menu:
program define editors
window menu append submenu "stUser" "Editors"
window menu append item "Editors" "Vim" "winexec gvim.exe"
Next, I wrote a PERSONAL/v/vim.ado file like so:
winexec gvim.exe `anything'
This is based on Nick Cox's recipe, slightly altered so you can launch Vim from the Stata command line to edit an existing do-file that say has spaces in it, as in
vim "my dofile.do". There's a little more on this "syntax anything" solution in my previous Stata post.
One thing I did give up -- for now -- is the ability to launch a Stata instance from within Vim after I'm done editing a do-file, either for running the entire do-file or some select lines, the way I used to be able to do in Notepad++. There's got to be a way for that, though. If you know it, please drop me a line.
That said, I'd never knock Notepad++. It is still a fine text editor that has served me well. The people at Mather Economics, who adopted it a while back at my instigation, are sticking with it -- and I recommend it to anybody who does not insist on a modal editor.