VIM: Python type indented-block command equivalent to % for C?

Antony Scriven ad_scriven at
Thu Mar 8 15:17:24 CET 2007

[F-ups set to comp.editors]

Paddy3118 wrote:

 > Not python:
 >     but python type
 >     indented text
 >     Notice the blank line above.
 >     It could have several
 >     spaces or tabs, and still
 >     be a part of the block
 >     beginning 'Not python:':
 >       The block ends at the
 >       first non-blank line
 >       with less indent.
 > Assuming that only space characters are allowed
 > for indenting, is their a way to yank a Python
 > block like y% works for C , or a way to move to
 > the end of a block defined by indentation?

I expect there are scripts for Python. Try googling and Anyway I'm not sure that I understand your
description 100%, but try something like this.

   :ono = /\n.*\%<<C-R>=indent('.')<CR>c\S\\|\%$/+0<CR>

Now try d= y= etc. Also note that I've made it work
linewise. And take look at :help /\%v if you want it to
work with tabs. --Antony

More information about the Python-list mailing list