在 Vim 中,为什么我的鼠标不能超过第 220 列? [英] In Vim, why doesn't my mouse work past the 220th column?

查看:26
本文介绍了在 Vim 中,为什么我的鼠标不能超过第 220 列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我倾向于将终端最大化到一个屏幕,并在 Vim 中垂直拆分多个窗口.对于左侧的前几个窗口,一切正常,但单击终端中的第 220 列后无法正常工作.任何鼠标点击第 220 列似乎都会环绕到第 1 列.总是相同的行为.如果我在 Gnome 终端中大幅增加字体大小,我可以点击最后一栏(虽然它不再是第 #220 栏).

I tend to maximize a terminal to one screen, and vertically split several windows in Vim. Everything works fine for the first few windows on the left, but clicking past about the 220th column in the terminal doesn't work correctly. Any mouse clicks past column 220 seem to be wrapping around to column 1. I've tested in xterm, urxvt, and Gnome terminal with and without tmux/screen; always the same behavior. If I greatly increase the size of the font in Gnome terminal, I can click on the last column (although it is no longer past column #220).

如果我在打印到标准输出的终端中运行命令,我可以一直单击终端右侧.问题似乎与 Vim 有关.

If I run a command in a terminal that prints to standard output, I can click all the way to the right of the terminal. The problem does seem to be related to Vim.

我在 .vimrc 中有 set mouse=a.我会根据要求发布整个文件,但它似乎没有与鼠标相关的任何其他内容.

I have set mouse=a in .vimrc. I'll post the entire file on request, but it doesn't seem to have anything else related to the mouse.

这可能无关紧要,但我正在运行 Xmonad+Gnome.提前致谢.

It's probably irrelevant, but I'm running Xmonad+Gnome. Thanks in advance.

推荐答案

这已在 Vim 7.3.632.参见 :h sgr-mouse.或者只是把它放在你的 ~/.vimrc 中:

This has been fixed in Vim 7.3.632. See :h sgr-mouse. Or just put this in your ~/.vimrc:

set ttymouse=sgr

如果您想与没有编译mouse_sgr 的版本兼容,请使用:

If you want to be compatible with versions that don't have mouse_sgr compiled in, use:

if has("mouse_sgr")
    set ttymouse=sgr
else
    set ttymouse=xterm2
end

要查看您的 Vim 版本是否有 mouse_sgr,请从命令行运行 vim --version,或在 Vim 中输入 :versioncode>,然后寻找 +mouse_sgr.

To see if your version of Vim has mouse_sgr, run vim --version from the command-line, or in Vim, enter :version, and look for +mouse_sgr.

如果您使用的是旧版本的屏幕或不支持 SGR 的终端模拟器,您可能需要升级或切换.这些设置适用于所有新版本的 screen、tmux、gnome-terminal、PuTTY/KitTY、iTerm2 和 Terminal.app,使用 TERM=xterm-256colorscreen-256color.

If you're using older versions of screen, or terminal emulators that don't support SGR, you may need to upgrade or switch. These settings work with all new versions of screen, tmux, gnome-terminal, PuTTY/KiTTY, iTerm2, and Terminal.app, using TERM=xterm-256color or screen-256color.

更新:如果您使用的是 neovim,则默认情况下会启用 SGR 支持.

Update: If you're using neovim, SGR support is enabled by default.

这篇关于在 Vim 中,为什么我的鼠标不能超过第 220 列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆