[Patch] Visual mode movements for python.vim

71 views
Skip to first unread message

Carlos Pita

unread,
Jul 31, 2015, 11:50:15 AM7/31/15
to vim_dev
Hi all,

I've patched the python.vim ftplugin in order it to support [[,]],]m,[m movements in visual mode also. The patch simplifies the logic of the previous implementation by using the search() function instead of user-oriented commands.

There are a couple of minor improvements also:

* Explicitly check executable('pydoc') == 1 (to avoid the -1 trap).
* Expand a couple of tabs to spaces to normalize indentation a bit.

Hope you find it useful. I tried to contact the maintainer before but to no avail so I'm submitting this directly to this list.

Cheers
--
Carlos

0001-python-plugin-movements-in-visual-mode.patch

Carlos Pita

unread,
Jul 31, 2015, 1:03:09 PM7/31/15
to vim_dev, carlosj...@gmail.com
PS: maybe worth noticing, the new implementation also fixes a
potential bug related to the approach to get the v:count argument the
previous implementation adopts: it defines a range function, but then
the argument must be valid as a range not just as a count. In practice
this shouldn't be a problem, but it's not entirely correct. Moreover,
it is a problem for implementing the visual mode map. All in all I
feel the new approach is cleaner.

Carlos Pita

unread,
Jul 31, 2015, 7:03:53 PM7/31/15
to vim_dev, carlosj...@gmail.com
Here is an updated patch with a couple of improvements:

1. Reach BOF/EOF when there are no more class/method text objects remaining.

2. In visual mode select the object up to its beginning/end without matching the first line/char of the next object (I think it's not difficult to implement the omap version from here, but I don't have the time to do it right now).

Cheers
--
Carlos

0001-Python-plugin-movements-in-visual-mode.patch

Bram Moolenaar

unread,
Aug 2, 2015, 4:32:32 PM8/2/15
to Carlos Pita, Dr. Johannes Zellner, vim_dev
Perhaps you would like to take over maintenance of this file?


--
"Never be afraid to tell the world who you are."
-- Anonymous

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Carlos Pita

unread,
Aug 2, 2015, 4:35:13 PM8/2/15
to Bram Moolenaar, Dr. Johannes Zellner, vim_dev
> Perhaps you would like to take over maintenance of this file?

I would be glad to.

Cheers
--
Carlos

Carlos Pita

unread,
Aug 2, 2015, 6:58:52 PM8/2/15
to vim_dev, Br...@moolenaar.net, joha...@zellner.org
Updated patch with a couple of text objects (]] and ]m) defined on top of my previous n and v maps.

Regarding the maintenance I know nothing about the formalities yet but I promise to get informed ASAP.

Cheers
--
Carlos

0001-Python-plugin-movements-in-visual-mode.patch

Bram Moolenaar

unread,
Aug 4, 2015, 3:59:07 PM8/4/15
to Carlos Pita, vim_dev, joha...@zellner.org
The complicated part of maintaining a runtime file is making it work
better. You already did that. The easy part is updating the header to
announce you as the maintainer, moving the original maintainer to
another line.

It does mean that others may send you suggestions for improvement or
complain about something that doesn't work. Ideally you take care of
that.

And whenever you make improvements, mail me the new file.


--
Overflow on /dev/null, please empty the bit bucket.
Reply all
Reply to author
Forward
0 new messages