Solve the problem that vim enters visual mode when using mouse selection


  • If you just want to close it temporarily, directly enter the command line mode of vim, use the command
    :set mouse-=a
  • If you directly feel that this function is not needed,
    vim ~/.vimrcadd this configuration

:set mouse-=a

Vim's set mouse instructions

    Enable the use of the mouse.  Works for most terminals (xterm, Win32
    win32-mouse, QNX pterm, *BSD console with sysmouse and Linux console
    with gpm).  For using the mouse in the GUI, see gui-mouse.  The
    mouse can be enabled for different modes:
            n       Normal mode and Terminal modes
            v       Visual mode
            i       Insert mode
            c       Command-line mode
            h       all previous modes when editing a help file
            a       all previous modes
            r       for hit-enter and more-prompt prompt

Supplementary Note

What does '-=' mean?

Generally, use '=' directly to assign
'+=' to it, and '-=' can be used to add/remove specified values ​​to the configuration item

There is no .vimrc file in the home directory

Not necessarily, you can create it yourself
You can use package management to query Vim related files, it will display the location of Vim reference files,
for example
opkg files vim-fuller | grep vimrc

/usr/share/vim/vimrc
/usr/share/vim/vim82/gvimrc_example.vim
/usr/share/vim/vim82/vimrc_example.vim

some or no

There are also articles saying that the mouse selection in command line mode can be retained :set mouse=c
and at the same time, the same effect should be achieved :set mouse=with:set mouse-=a


Reference article:

Vim help doc
vim insert VISUAL mode cannot right-click to copy the problem (transfer)

Guess you like

Origin blog.csdn.net/sean908/article/details/124219565