use*_*001 55 vim gnome mouse gnome-terminal
编辑:启用鼠标的问题vim
似乎特定于gnome-terminal
(版本 3.4.1.1-1;我使用的是 gnome 3 后备模式)。如果我运行xterm
,vim
默认情况下禁用鼠标支持,我可以选择启用它(:set mouse=a
,我从不这样做)和禁用它(:set mouse=
)。相比之下,当我运行vim
in 时gnome-terminal
,默认情况下启用鼠标支持并且无法禁用它(:set mouse=
无效)。有没有更换终端模拟器的解决方案?
我想在vim
. 我正在运行vim
版本 2:7.3.547-3 到gnome-terminal
版本 3.4.1.1-1。以下命令,无论是直接在vim中执行还是添加到我的.vimrc
文件中,都无法禁用鼠标支持:
set mouse =
set mouse =""
Run Code Online (Sandbox Code Playgroud)
基于阅读 vim 手册和在线帖子,这些命令中的一个或两个应该可以工作。特别是,vim 手册说明了以下内容
'mouse' string (default "", "a" for GUI, MS-DOS and Win32)
The mouse can be enabled for different modes:
n Normal mode
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
Normally you would enable the mouse in all four modes with: >
:set mouse=a
When the mouse is not enabled, the GUI will still use the mouse for
modeless selection. This doesn't move the text cursor.
Run Code Online (Sandbox Code Playgroud)
我正在使用笔记本电脑,每次我的手刷触控板时,我在 vim 中的光标位置都会突然移动。
Gil*_*not 32
我发现是什么导致了许多 linux 风格的这种不良行为:
/usr/share/vim/vim80/defaults.vim # may be "vim81" depending on your vim version
Run Code Online (Sandbox Code Playgroud)
如果没有~/.vimrc
但即使您有一个/etc/vimrc
或这样的/etc
文件,它也是“来源”的,所以如果您没有,只需按照@lgpasquale 的建议创建一个空白文件:
mkdir ~/.vim/; [[ -s ~/.vim/vimrc ]] && echo "aborted, file exists" || :> ~/.vim/vimrc
Run Code Online (Sandbox Code Playgroud)
如果你喜欢从 defaults.vim 获得的其他特性(比如语法高亮),你可以使用这个命令而不是上一个:
mkdir ~/.vim/; [[ -s ~/.vim/vimrc ]] && echo "aborted, file exists" || echo -e "source /usr/share/vim/vim80/defaults.vim\nset mouse=" > ~/.vim/vimrc
Run Code Online (Sandbox Code Playgroud)
phe*_*mer 27
默认情况下禁用鼠标支持,因此某些功能正在将其打开。您set mouse=
失败的原因可能是因为它在打开它之前正在运行。我会查看你的 vimrc 的其余部分,可能还有系统范围的 vimrc(/etc/vim/vimrc
是一个标准位置)。
作为最后的手段,您可以执行这个非常丑陋的 hack,这将导致命令作为在您控制编辑器之前完成的最后一件事之一运行。
autocmd BufEnter * set mouse=
Run Code Online (Sandbox Code Playgroud)
小智 11
我在 Fedora Server 25 主机上的 OS X“终端”应用程序上遇到了这个问题。我已经在我的 .vimrc 中永久解决了这个问题:
set mouse=
set ttymouse=
Run Code Online (Sandbox Code Playgroud)
现在我可以用鼠标在终端的回滚中向上滚动到我以前的 bash 历史记录。
在 Debian Stretch 上,一些中央设置会在加载后/etc/vim/vimrc
加载,并且/etc/vim/vimrc.local
. 看/etc/vim/vimrc
:
...
" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
" any settings in these files.
" If you don't want that to happen, uncomment the below line to prevent
" defaults.vim from being loaded.
"let g:skip_defaults_vim = 1
...
Run Code Online (Sandbox Code Playgroud)
该文件默认为/usr/share/vim/vim80/defaults.vim
. 现在更改下的中央文件/usr/share/...
是
skip_defaults_vim
通过取消注释上面的行来设置会删除该文件设置的所有其他选项。要删除不需要的选项,请将以下内容放入/etc/vimrc.local
:
" /etc/vim/vimrc.local
" honor skip_defaults_vim from the master /etc/vim/vimrc file
if ! exists('skip_defaults_vim')
" Source the defaults file manually from here
source $VIMRUNTIME/defaults.vim
endif
" avoid loading the defaults twice
let g:skip_defaults_vim = 1
" revert any unwanted changes the defaults file introduced
set mouse=
" set any other options you want centrally on your system
"set paste " uncomment if you want paste insert enabled
"...
Run Code Online (Sandbox Code Playgroud)
这将defaults.vim
手动加载并关闭自动加载,从而使您有机会恢复任何不需要的设置,而无需.vimrc
为每个用户帐户创建一个。
归档时间: |
|
查看次数: |
74062 次 |
最近记录: |