VIM and [Python] block jumping

Neel Krishnaswami neelk at brick.cswv.com
Fri Jul 9 19:16:59 EDT 1999


In article <3785DA06.974567F3 at kami.com>,
C. Laurence Gonsalves <clgonsal at kami.com> wrote:
>Of course, right after I posted that, realized that there's a problem.
>The blockMotion function doesn't account for lines that are
>continuations of other lines. That means that triple-quoted string
>literals, lines with more {[('s that }])'s, and lines joined with \ can
>screw it up. Are there any other situations? I'll try to post a
>corrected version later. Some of those problems are pretty nasty though
>(triple-quoted strings in particular).

Being a faithful Emacs-ite, I've never used vim. But since you can
script vim with Python, it might be possible to use the tokenizer in
the standard library (module tokenize) to handle this cleanly. Likely
you'd need to extend it a bit to handle the syntax errors that show up
in half-written code gracefully, but taking vim that one step past
syntax-awareness and into structure-awareness would be a very slick
hack.


Neel




More information about the Python-list mailing list