On 2023-11-13, Igor Lerinc wrote:
> > This works as you want it to, right? Double- and triple- clicks work that
> way for me.
>
> Double click, should select word. Doesn't work.
That's odd. I've tried gvim, vim in an xterm, vim in a GNOME
Terminal, and vim in an xfce4-terminal (version 0.8.9.1) and
double-clicking always selects one word. I started each one with
"-N -u NONE -i NONE" arguments to make sure I didn't include
anything from my vimrc or plugins.
> > vnoremap <ScrollWheelUp> k
> > vnoremap <ScrollWheelDown> j
>
> this works, but is there way that it goes UP, like it does when going DOWN,
> that it automatically expands toward UP. I don't know if it's because of my
> xfce4 terminal, and terminal doesn't send some stuff ? Which terminal you use ?
To make those two mappings move in the opposite direction, just swap
the j and k, like this:
vnoremap <ScrollWheelUp> j
vnoremap <ScrollWheelDown> k
I almost always use an xterm, although I tried the others above to
see if they would behave any differently. It turned out that
mapping the scroll wheel worked in all cases, but it worked
differently depending on the terminal and the window manager.
You can determine the escape sequence received by Vim in response to
using the scroll wheel by opening a new line, typing Ctrl-K, the
moving the scroll wheel once up or down. You should see the key
code, like this:
<ScrollWheelUp>
or
<ScrollWheelDown>
That's what I see when using xterm or GNOME Terminal in a GNOME 42
desktop on Ubuntu 22.04. However, on my Ubuntu 20.04 system running
the xfce4 desktop, xfce4-terminal shows
<2-ScrollWheelUp>
and
<2-ScrollWheelDown>
while xterm shows
<3-ScrollWheelUp>
and
<3-ScrollWheelDown>
Very odd. It's a simple matter to change the mapping to match those
key codes, but I don't understand why they're different. You don't
seem to see those, but I thought I should mention it in case you had
problems with those mappings.
Since you said that you wanted Vim to behave as other GUI editors
do, I assumed at the time that you were using gvim. The 'guicursor'
option works in the GUI but not in a terminal. To change the cursor
shape or color when using vim in a terminal, see:
:help termcap-cursor-shape
Regards,
Gary