如何让 vim 在 Mac OS X 上像在 Ubuntu 上一样运行? [英] How to let vim behave on Mac OS X as on Ubuntu?

查看:65
本文介绍了如何让 vim 在 Mac OS X 上像在 Ubuntu 上一样运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我开始使用 Macbook Pro.安装的是 Mountain Lion,到目前为止一切都很好.我来自 Ubuntu 并且对 vim 非常上瘾,我真的无法忍受 Mac Os X 对待 vim 的方式.;)

Recently I started using a Macbook Pro. Installed is Mountain Lion and so far everything is good. I'm coming from Ubuntu and being pretty much addicted to vim, I can't really stand how Mac Os X is treating vim. ;)

例如,如果我在 Ubuntu 中使用鼠标向上滚动,当文件打开时,我可以滚动的最大内容是文件的顶部.当我在 Mac Os X 中尝试时,我直接滚动到 shell 历史记录.我更喜欢 Ubuntu 的行为,因为我发现它更简单、更合乎逻辑(即使我知道 vim 是一个终端"应用程序).

For instance, if I use the mouse in Ubuntu to scroll up, the max I can scroll is the top of the file when a file is open. When I try that in Mac Os X, I scroll straight into the shell history. I'd like the Ubuntu behaviour better, because I find it easier and more logical (even though I know that vim is a 'terminal' application).

我能对此做些什么吗?

如果有帮助,我已经安装了 iTerm2.

I have iTerm2 installed if that helps.

请注意,我使用的是常规 Vim,而不是 Macvim,我也阅读了很多内容.我更喜欢使用原始的vim",因为我熟悉按键/命令等.

Please note, I'm using the regular Vim, not Macvim of which I read a lot of things also. I prefer to use the original 'vim' because I'm familiar with the keys/commands etc.

推荐答案

Terminal.app 不支持鼠标.

Terminal.app does not support the mouse.

如果你想要鼠标,你可以安装支持鼠标的 iTerm2.

If you want the mouse you can to install iTerm2 which does support the mouse.

在 iTerm2 中:转到首选项 -> 配置文件 ->(当前配置文件)-> 终端并确保启用 xterm 鼠标报告.选择此项后,您可能需要重新启动 iTerm2.

In iTerm2: go to Preferences -> Profiles -> (current profile) -> Terminal and Make sure Enable xterm mouse reporting. After you select this you might need to restart iTerm2.

要在 vim 中启用鼠标支持,请将以下内容添加到您的 vimrc

To enable mouse support in vim add the following to your vimrc

set mouse=a

这篇关于如何让 vim 在 Mac OS X 上像在 Ubuntu 上一样运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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