Subscribe to
Posts
Comments

vim and python

Looking at the Stevey Yegge’s My save-excursion and his experiment I decided to do the same using Vim and python. And here we go, the result:

function! BlogColumnLength()
python << EOF
import vim
lines = "".join(vim.current.buffer)
print "%d chars, %d words" % (len(lines), len("".join(lines).split()))
EOF
endfunction                                                         

Not bad, from my point of view. It’s behavior differs a little bit from original one, but the idea is actually to show that it’s possible to extend editors using more or less human readible languages ;)

Leave a Reply