Home Explore Blog CI



neovim

5th chunk of `runtime/doc/gui.txt`
f2d762fc2909d9a80c3fc5ceaaf0ff89ba759045136c580d0000000100000fa0
 |keycodes|: >
      code           mouse button              normal action
  ---------------------------------------------------------------------------
  <LeftMouse>     left pressed               set cursor position
  <LeftDrag>      left moved while pressed   extend selection
  <LeftRelease>   left released              set selection end
  <MiddleMouse>   middle pressed             paste text at cursor position
  <MiddleDrag>    middle moved while pressed -
  <MiddleRelease> middle released            -
  <RightMouse>    right pressed              extend selection
  <RightDrag>     right moved while pressed  extend selection
  <RightRelease>  right released             set selection end
  <X1Mouse>       X1 button pressed          -
  <X1Drag>        X1 moved while pressed     -
  <X1Release>     X1 button release          -
  <X2Mouse>       X2 button pressed          -
  <X2Drag>        X2 moved while pressed     -
  <X2Release>     X2 button release          -

The X1 and X2 buttons refer to the extra buttons found on some mice (e.g. the
right thumb).

Examples: >vim
        :noremap <MiddleMouse> <LeftMouse><MiddleMouse>
Paste at the position of the middle mouse button click (otherwise the paste
would be done at the cursor position). >vim

        :noremap <LeftRelease> <LeftRelease>y
Immediately yank the selection, when using Visual mode.

Note the use of ":noremap" instead of "map" to avoid a recursive mapping.
>vim
        :map <X1Mouse> <C-O>
        :map <X2Mouse> <C-I>
Map the X1 and X2 buttons to go forwards and backwards in the jump list, see
|CTRL-O| and |CTRL-I|.

                                                *mouse-swap-buttons*
To swap the meaning of the left and right mouse buttons: >vim
        :noremap        <LeftMouse>     <RightMouse>
        :noremap        <LeftDrag>      <RightDrag>
        :noremap        <LeftRelease>   <RightRelease>
        :noremap        <RightMouse>    <LeftMouse>
        :noremap        <RightDrag>     <LeftDrag>
        :noremap        <RightRelease>  <LeftRelease>
        :noremap        g<LeftMouse>    <C-RightMouse>
        :noremap        g<RightMouse>   <C-LeftMouse>
        :noremap!       <LeftMouse>     <RightMouse>
        :noremap!       <LeftDrag>      <RightDrag>
        :noremap!       <LeftRelease>   <RightRelease>
        :noremap!       <RightMouse>    <LeftMouse>
        :noremap!       <RightDrag>     <LeftDrag>
        :noremap!       <RightRelease>  <LeftRelease>
<

==============================================================================
Scrollbars                                              *gui-scrollbars*

There are vertical scrollbars and a horizontal scrollbar.  You may
configure which ones appear with the 'guioptions' option.

The interface looks like this (with `:set guioptions=mlrb`):
>
                       +------------------------------+ `
                       | File  Edit              Help | <- Menu bar (m) `
                       +-+--------------------------+-+ `
                       |^|                          |^| `
                       |#| Text area.               |#| `
                       | |                          | | `
                       |v|__________________________|v| `
 Normal status line -> |-+ File.c              5,2  +-| `
 between Vim windows   |^|""""""""""""""""""""""""""|^| `
                       | |                          | | `
                       | | Another file buffer.     | | `
                       | |                          | | `
                       |#|                          |#| `
 Left scrollbar (l) -> |#|                          |#| <- Right `
                       |#|                          |#|    scrollbar (r) `
                       | |                          | | `
                       |v|                          |v| `
                       +-+--------------------------+-+ `
                       | |< ####                   >| | <- Bottom `
                  

Title: Mouse Button Mapping and Scrollbars
Summary
This section provides examples of how to map mouse buttons to different actions, including pasting at the click position and immediately yanking the selection in Visual mode. It shows how to map the X1 and X2 buttons for navigation. It also includes instructions for swapping the left and right mouse buttons and describes how to configure the visibility of scrollbars using the 'guioptions' option, illustrating the GUI interface layout.