Python & vim
sill at optonline.net
Tue Jun 12 23:41:59 CEST 2001
On 12 Jun 2001 21:07:16 GMT, Christian Schaller <chris at alaska.cert.siemens.de> wrote:
> Dear Pythoners,
> I've seen already some threads about configuring vim that it is
> comfortable editing Python programs, so let's get one step further! Use
> the following script to be able moving up and down the same indentation
> level of the line the cursor is on (just press F10 for down and
> Shift-F10 for up).
> Have fun!
> fu! Block(indent, dir)
> let line = getline(".")
> let blankCount = matchend(line, a:indent)
> let nr = line(".")
> let lastPos = nr
> let maxLine = line("$")
> while nr <= maxLine && nr > 0
> let nr = nr + a:dir
> let curr = getline(nr)
> if curr == ""
> if matchend(curr, a:indent) == blankCount
> elseif matchend(curr, a:indent) < blankCount
> let nr = lastPos
> exe nr
> map <F10> :call Block("^[ ]*", 1)<c-m>
> map <S-F10> :call Block("^[ ]*", -1)<c-m>
Thanks for the post - but it's not working fully
here. F10 works fine but S-F10 seems to capitalize
current character and jump few characters to the
right. I'm using 6.0z version. I tried changing
it to F11 but it does some other odd things..
Ok, now I tried F10 for down, F11 for up and it
works perfectly well. I guess this is something
to do with 6.0 beta status.
True sailing is dead
More information about the Python-list