Vim可以在程序打开后直接输入

:set mouse=

关闭具体的鼠标模式,使vim还原到默认的模式(左键选屏,右键粘贴)

简介

                                            'mouse'
'mouse' string (default "", "a" for GUI and Win32,
set to "a" or "nvi" in defaults.vim)
global
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

这是vim自带的帮助里面的内容,可以看到如果添加在等号后面不同内容有不同结果。

如何永久关闭鼠标模式?

在vim中输入:echo $VIMRUNTIME 可以获取运行时文件目录

找到目录打开defaults.vim文件就可以编辑内容了,具体在下文附近(大概75行左右,不确定)

" In many terminal emulators the mouse works just fine. By enabling it you
" can position the cursor, Visually select and scroll with the mouse.
" Only xterm can grab the mouse events when using the shift key, for other
" terminals use ":", select text and press Esc.
if has('mouse')
    if &term =~ 'xterm'
        set mouse=a
    else
        set mouse=nvi
    endif
endif
把里面的mouse-a删了改成mouse=""就行了
最后修改日期:2022年7月25日

作者

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。