在 Vim 中使用鼠标滚轮
我的 .vimrc
有以下几行
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
但是当我使用鼠标滚轮向上滚动时,我会得到 Vim 上方的文本。例如,如果我刚刚启动 Vim,我会收到终端会话文本。我最初在帮助文件上尝试使用鼠标滚轮,然后转向其他文件,因此使用 a
选项。
我还需要设置什么吗?我在终端内使用 Snow Leopard 和 Vim 7.3。
在这里,我刚刚做了一个轮子。请参阅顶部的终端会话。
My .vimrc
has the following lines
set mouse=a
map <ScrollWheelUp> <C-Y>
map <ScrollWheelDown> <C-E>
But when I scroll up using the mouse wheel, I'd get the text above Vim. For example, I'd get my terminal session text if I'd just started Vim. I'm initially experimenting with the mouse scroll wheel on help files, then move on to other files, hence the a
option.
What else do I need to set? I'm using Snow Leopard and Vim 7.3 inside a Terminal.
Here, I just did a wheel up. See the Terminal session at the top.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
在 OS X 的 iTerm 2 中使用 vim,您可以
:设置鼠标=a
启用滚轮滚动,以及选择进入可视模式等。
Using vim in iTerm 2 in OS X, you can
:set mouse=a
to enable scrolling with the scroll wheel, as well as selecting to enter Visual mode, etc.
如果您使用 iTerm,则只需执行以下命令:
defaults write com.googlecode.iterm2 AlternateMouseScroll -bool true
这将启用鼠标滚动,而无需在
.vimrc 中添加任何内容
代码>.If you use iTerm, you can simply execute the following command:
defaults write com.googlecode.iterm2 AlternateMouseScroll -bool true
This will enable mouse scrolling without having to add anything in your
.vimrc
.您可以尝试使用 https://github.com/brodie/mouseterm,它为终端添加了鼠标报告支持。
You could try using https://github.com/brodie/mouseterm, which adds mouse reporting support to Terminal.
我在使用 Mac 终端时遇到了同样的问题。我认为这是一个问题。升级到 Lion 后,我就不再遇到在 vim 中滚动的问题了。请考虑使用 iTerm2。它将解决滚动问题并为您提供 256 种术语颜色。
I had the same problem using Mac's Terminal. I think it is an issue with it. Once I upgraded to Lion I don't have the problem of scrolling in vim. Please consider using iTerm2. It will solve the problem of scrolling and gives you the 256 term colors.
只是一个选择。我错过了 OSX 中的很多功能,而我在 Linux 中已经完全习惯了这些功能。接近 urxvt + vim 的最佳设置是使用 iTerm2 + MacVim。
只是错过了一些东西并以这种方式恢复:
不幸的是,xorg 最出色的功能“middlemouse-clipboard”在我所知道的任何术语中都没有实现。正如所说,它是一个 xorg 功能,并且可能永远不会实现。
如果您正在使终端在 OS X 中发挥作用,请不要忘记杰作 homebrew。
Just an option. I missed a lot of functionality in OSX, which I was totally used to from linux. The best setup that comes close to urxvt + vim is to use iTerm2 + MacVim.
Just a few things is missed and got back this way:
Unfortunately the most outstanding feature "middlemouse-clipboard" from xorg is not implemented in any term I know. Well as said its an xorg feature, and will probably never be implemented.
If your on the way to make the terminal useful in OS X don't forget the masterpiece homebrew.
当您的术语设置为 xterm 而不是 linux 时,鼠标滚轮操作有效。
因此,请在.cshrc或.bashrc中设置“setenv TERM xterm”,然后它就会起作用。
Mouse wheel action works when your TERM is set to xterm not to linux.
So, please set "setenv TERM xterm" in the .cshrc or .bashrc, then it will work.