What does <LeftMouseNM> mean?

9 views
Skip to first unread message

Gary Johnson

unread,
Dec 4, 2022, 2:05:19 AM12/4/22
to vim...@googlegroups.com
I was troubleshooting a problem with the behavior of my mouse in
gvim when I discovered that typing Ctrl-K in insert mode and moving
the mouse to another window enters the special key code
"<LeftMouseNM>". I can't find this special key documented anywhere.
Even ":helpgrep \cmousenm" didn't return any results.

Would someone please tell me what "<LeftMouseNM>" means?

I'm using gvim 9.0.929 on Ubuntu 22.04.

(The problem I'm troubleshooting is not a bug in Vim, it's a problem
with me dragging my thumb pads across my trackpad while I'm typing
which then moves the cursor. I thought I had fixed the problem but
then I encountered this mouse event.)

Regards,
Gary

Enan Ajmain

unread,
Dec 4, 2022, 3:13:23 AM12/4/22
to vim...@googlegroups.com
On Sat, 3 Dec 2022 23:07:15 -0800
Gary Johnson <gary...@spocom.com> wrote:
> I was troubleshooting a problem with the behavior of my mouse in
> gvim when I discovered that typing Ctrl-K in insert mode and moving
> the mouse to another window enters the special key code
> "<LeftMouseNM>". I can't find this special key documented anywhere.
> Even ":helpgrep \cmousenm" didn't return any results.
>
> Would someone please tell me what "<LeftMouseNM>" means?

I know that ‘NM’ stands for ‘Non Mappable’. And that there is one entry
in the docs, which you can find with this pattern:

:helpg \v\cmouse.?nm

Other than that I have no clue. But I'm sure the devs can help.

--
Enan
3nan....@gmail.com
https://git.sr.ht/~enan/
https://www.github.com/3N4N

Bram Moolenaar

unread,
Dec 4, 2022, 7:07:22 AM12/4/22
to vim...@googlegroups.com, Enan Ajmain

> On Sat, 3 Dec 2022 23:07:15 -0800
> Gary Johnson <gary...@spocom.com> wrote:
> > I was troubleshooting a problem with the behavior of my mouse in
> > gvim when I discovered that typing Ctrl-K in insert mode and moving
> > the mouse to another window enters the special key code
> > "<LeftMouseNM>". I can't find this special key documented anywhere.
> > Even ":helpgrep \cmousenm" didn't return any results.
> >
> > Would someone please tell me what "<LeftMouseNM>" means?
>
> I know that ‘NM’ stands for ‘Non Mappable’. And that there is one entry
> in the docs, which you can find with this pattern:
>
> :helpg \v\cmouse.?nm
>
> Other than that I have no clue. But I'm sure the devs can help.

You are right, these are non-mappable mouse clicks. They are used
internally, you can't really use them. But they might show up in some
places.

--
hundred-and-one symptoms of being an internet addict:
225. You sign up for free subscriptions for all the computer magazines

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

Gary Johnson

unread,
Dec 4, 2022, 11:18:30 AM12/4/22
to vim...@googlegroups.com
On 2022-12-04, Bram Moolenaar wrote:
> > On Sat, 3 Dec 2022 23:07:15 -0800
> > Gary Johnson wrote:
> > > I was troubleshooting a problem with the behavior of my mouse in
> > > gvim when I discovered that typing Ctrl-K in insert mode and moving
> > > the mouse to another window enters the special key code
> > > "<LeftMouseNM>". I can't find this special key documented anywhere.
> > > Even ":helpgrep \cmousenm" didn't return any results.
> > >
> > > Would someone please tell me what "<LeftMouseNM>" means?
> >
> > I know that ‘NM’ stands for ‘Non Mappable’. And that there is one entry
> > in the docs, which you can find with this pattern:
> >
> > :helpg \v\cmouse.?nm
> >
> > Other than that I have no clue. But I'm sure the devs can help.
>
> You are right, these are non-mappable mouse clicks. They are used
> internally, you can't really use them. But they might show up in some
> places.

Thank you both for the explanations.

I seem to be able to map it, though. I fixed my problem of
accidentally changing window focus while typing by adding this to my
vimrc:

imap <LeftMouseNM> <Nop>

Or does non-mappable mean that <LeftMouseNM> cannot be on the right
side of a mapping?

Regards,
Gary

Reply all
Reply to author
Forward
0 new messages