让 Viper 状态全球化
EmacsWiki 说:
有一种方法可以使 Viper 状态和 Viper 插入状态全局化,就像在 Vim(也可能是 vi)中一样。在 Vim(可能还有 vi)中,您以普通模式开始。您可以切换缓冲区,Vim 会保持正常模式。按“i”使 Vim 进入插入模式。然后,如果您通过单击另一个窗口来切换缓冲区,Vim 将保持插入模式。你不必记住哪个缓冲区处于什么模式,你只需要记住 Vim 处于哪种模式即可。
但遗憾的是,他们并没有说这个方法是什么,我也无法很快找到。有人知道吗?
EmacsWiki says:
There is a way to make Viper state and Viper insert state global, like in Vim (and probably vi). In Vim (and probably vi), you start in Normal Mode. You can switch buffer, and Vim stays in Normal Mode. Pressing “i” puts Vim in Insert Mode. Then if you switch buffers by clicking on another window, Vim stays in Insert Mode. You don’t have to remember which buffer is in what mode, you only need to remember in which mode Vim is.
But unfortunately, they don't say what this method is, and I couldn't find it quickly. Does anybody know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有哪个设置或包可以满足您的要求。它不是由 viper 本身提供的。
也就是说,您可以写一些建议哪个可以完成这项工作。关键是您需要建议切换缓冲区/窗口的所有方式。例如,如果您通过
other-window
命令 (Cx o) 切换窗口,您将需要这样:但是,使用鼠标切换窗口不会通过该功能,并且要使其工作,您需要以完全相同的方式建议
select-window
:如果您发现使用另一种机制来切换不使用上述机制的窗口/缓冲区,那么它只需要一点点挖掘(Mxdescribe-key)即可找出您应该建议的新事物。
I don't know a single setting or package to do what you want. It's not provided by viper itself.
That said, you can write some advice which does the job. The key being that you need to advise all the ways you switch buffers/windows. For example, if you switch windows through the
other-window
command (C-x o), you'll want this:But, switching windows using the mouse doesn't go through that function, and to get that to work you need to advise
select-window
in exactly the same way:If you find you use another mechanism to switch windows/buffers that doesn't use the above, it just takes a tiny bit of digging (M-x describe-key ) to find out what new thing you should be advising.