Home again…

A while ago, I downloaded Aquamacs, an emacs port for OSX, and tried to switch to it as my default editor. I mainly did it because I wanted an editor I could add functionality to, à la Steve Yegge. I used it for a while, and got fairly proficient at it. There were a lot of things about it I really liked, like the Markdown mode, and the ability to edit files on a remote host, and the way I could write small functions in elisp and use them to make me more productive.

But while it worked, and worked well, I didn’t really write all that much extra elisp, and whenever I did, I didn’t really enjoy it. So the other day, when I found myself reading a weblog about the lack of a good graphical text editor on OSX, I found myself agreeing with him. So when I read a later article on how the author had finally switched back to vim, I thought that I might give vim another chance.

Well, it turns out that vim is actually pretty close to a perfect text editor for me. It’s got Markdown support, remote file editing, and not only can I write functions for it, I can write them in Python! As an example, here’s Steve Yegge’s blog-check function in vim/python:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
function! BlogCheck()
  python << END
:::python
import re
import vim
pattern = re.compile( r"\s" )
count = 0
for line in vim.current.buffer:
  line = pattern.sub( "", line )
  count += len(line)
if count <= 5000:
  message = "Okay so far"
else:
  message = "Dude, too long"
print "%s:  %d chars, %d words" % (message, count, count/5)
:::vim
END
endfunction

Comments

Comments powered by Disqus