Vim/MacVim:当我用鼠标滚动时,文本光标也会移动! [英] Vim/MacVim: when I scroll with mouse, the text cursor moves too!

查看:279
本文介绍了Vim/MacVim:当我用鼠标滚动时,文本光标也会移动!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近几周我已经习惯了Vim/MacVim.我似乎遇到的主要问题之一是当我使用鼠标滚动时(特别是当我尝试选择大部分文本时),文本插入光标也移动并且不会停留在原处(例如在TextMate中例子).这意味着我已经选择了一大段文字,当我向上滚动以查看我的选择时,光标将移动,这会与我所做的选择混淆.

I've been getting used to Vim/MacVim for the last few weeks. One of main problems I seem to be having is when I scroll around using the mouse (especially when I'm trying to select large portions of text) the text insertion cursor moves too and doesn't stay where it was (like in TextMate for example). This means I've selected a large piece of text, when I scroll back up to review my selection the cursor will move which messes with the selection that I've made.

我确实意识到我应该习惯于使用可视模式进行文本选择,而且我只是一次,但是有时它是使用鼠标的最佳工具.

I do realise I should get used to text selection with visual mode, and I am one bit of a time, but sometimes it's the best tool to use the mouse.

是否有解决此问题的方法?

Is there a way of fixing this behaviour?

推荐答案

:help scrolling告诉您:

这些命令可移动以下内容 窗户.如果光标位置是 从窗口移开,光标是 移动到窗口(带有 滚动"屏幕周围的线条).

These commands move the contents of the window. If the cursor position is moved off of the window, the cursor is moved onto the window (with 'scrolloff' screen lines around it).

因此,基本上我会说不可能将光标留在滚动时的位置.光标始终在您的窗口中可见,因此您的视觉选择将会扩展.

So basically I would say that it is not possible to leave the cursor where it was when you are scrolling. The cursor is always visible in your window, and therefore your visual selection will extend.

可能您想xnoremap <ScrollWheelUp> <esc><ScrollWheelUp>,对于ScrollWheelDown也是如此.然后使用gv恢复选择.

Probably you would like to xnoremap <ScrollWheelUp> <esc><ScrollWheelUp> and same for ScrollWheelDown. Use then gv to restore your selection.

这篇关于Vim/MacVim:当我用鼠标滚动时,文本光标也会移动!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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