patch: v:motion_force

51 views
Skip to first unread message

Kana Natsuno

unread,
Dec 5, 2008, 12:55:31 PM12/5/08
to vim...@googlegroups.com
When I wrote some Vim scripts to implement new motions and new text objects,
I noticed that there is no way to check whether the type of a motion is forced
or not. (e.g. :help o_v is given or not)

I wrote a patch to add the variable v:motion_force which contains the
information about this problem. See the attached file for the details.
Please include this patch if it is useful for other users.


--
To Vim, or not to Vim.
kana <http://whileimautomaton.net/>

vim-motion_force.patch

Bram Moolenaar

unread,
Dec 5, 2008, 4:33:31 PM12/5/08
to Kana Natsuno, vim...@googlegroups.com

Kana Natsuno wrote:

> When I wrote some Vim scripts to implement new motions and new text
> objects, I noticed that there is no way to check whether the type of a
> motion is forced or not. (e.g. :help o_v is given or not)
>
> I wrote a patch to add the variable v:motion_force which contains the
> information about this problem. See the attached file for the
> details. Please include this patch if it is useful for other users.

Yes, this sounds useful. Thanks for making the patch.

I wonder if the name "v:motion_force" is the best choice. Does someone
know a better name?

--
-rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed
-rwxr-xr-t 4 root 131720 Jan 1 1970 /usr/ucb/vi
-rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Tony Mechelynck

unread,
Dec 5, 2008, 5:27:55 PM12/5/08
to vim...@googlegroups.com, Kana Natsuno, Bram Moolenaar
On 05/12/08 22:33, Bram Moolenaar wrote:
>
> Kana Natsuno wrote:
>
>> When I wrote some Vim scripts to implement new motions and new text
>> objects, I noticed that there is no way to check whether the type of a
>> motion is forced or not. (e.g. :help o_v is given or not)
>>
>> I wrote a patch to add the variable v:motion_force which contains the
>> information about this problem. See the attached file for the
>> details. Please include this patch if it is useful for other users.
>
> Yes, this sounds useful. Thanks for making the patch.
>
> I wonder if the name "v:motion_force" is the best choice. Does someone
> know a better name?
>

v:operator_mode? v:motion_mode? I didn't read the patch so I might be
off-target.

Best regards,
Tony.
--
Everyone can be taught to sculpt: Michelangelo would have had to be
taught how _not_ to. So it is with the great programmers.

Kana Natsuno

unread,
Dec 6, 2008, 12:10:20 AM12/6/08
to Bram Moolenaar, vim...@googlegroups.com
On Sat, Dec 6, 2008 at 6:33 AM, Bram Moolenaar <Br...@moolenaar.net> wrote:
> I wonder if the name "v:motion_force" is the best choice. Does someone
> know a better name?

Though I also (and still) wonder about that, I chose the name from
the definition of struct oparg_S in src/structs.h which has the member
"motion_force" to contain the information about this problem.

Bram Moolenaar

unread,
Dec 6, 2008, 8:21:48 AM12/6/08
to Kana Natsuno, vim...@googlegroups.com

Kana Natsuno wrote:

> On Sat, Dec 6, 2008 at 6:33 AM, Bram Moolenaar <Br...@moolenaar.net> wrote:
> > I wonder if the name "v:motion_force" is the best choice. Does someone
> > know a better name?
>
> Though I also (and still) wonder about that, I chose the name from
> the definition of struct oparg_S in src/structs.h which has the member
> "motion_force" to contain the information about this problem.

I understand. But this is a user facing name, what's used in the C code
is not that important.

Reading the help for o_v and around, we don't actually force the motion,
but the motion type. "v:force_motiontype" ?

--
FATHER: We are here today to witness the union of two young people in the
joyful bond of the holy wedlock. Unfortunately, one of them, my son
Herbert, has just fallen to his death.
[Murmurs from CROWD; the BRIDE smiles with relief, coughs.]
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Reply all
Reply to author
Forward
0 new messages