viper-auto-indent 打破了劣等模式
作为一个 vim 转换者,我已经相当习惯 viper 模式了。然而,我发现的一个问题是 viper-auto-indent 破坏了所有低级模式。发生的情况是,当我输入任何类型的低级模式(sql-mode、ess-mode 等)并按 Enter 键时,Enter 键实际上不会将命令发送到低级进程,而是给出进程的外观绞刑。
如果不设置 viper-auto-indent,我会遇到编写代码时 Enter 键不会自动缩进的问题,这意味着我在输入新行后总是需要按 Tab,这很烦人。我一直在使用的解决方法是默认启用 viper-auto-indent (因为我大部分时间都在编程),然后在进入劣质模式缓冲区时禁用它。
有谁知道如何解决这个问题?或者,任何人都可以帮助我提供 elisp,以在切换到内部模式缓冲区时禁用 viper-auto-indent,并在处于非劣等模式缓冲区时启用它?谢谢。
As a vim convert, I've gotten fairly used to viper mode. One issue that I've discovered, however, is that viper-auto-indent breaks all inferior modes. What happens is when I enter any sort of inferior mode (sql-mode, ess-mode, etc.) and hit Enter, the Enter key doesn't actually send the command off to the inferior process and gives the appearance of the process just hanging.
Without setting viper-auto-indent I have the problem that the Enter key doesn't automatically indent when writing code, meaning that I need to always hit tab after entering a new line, which is annoying. The workaround I've been using is to have viper-auto-indent enabled by default (since I spend most of my time programming), and then disabling it when I enter an inferior-mode buffer.
Does anyone know how to fix this problem? Alternatively, can anyone help supply me with the elisp to disable viper-auto-indent when switching to an interior mode buffer, and enabling it when in a non-inferior mode buffer? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为 Emacs 的意图是让您使用“Cj”进行换行和缩进,而让 Enter 保持不变。
如果您还不能接受,那么这个未经测试的代码可能会起作用:
I think Emacs' intent is to have you use "C-j" for newline-and-indent, and let Enter be left alone.
If that is not yet acceptable to you, then this untested code may work:
我无法重现你的问题。我尝试了 viper 模式的各个级别(1-5),以及一些较差的进程。也就是说,从您的实际问题来看,这段代码似乎应该符合要求。如果/当
'viper-autoindent
被调用时,如果当前缓冲区有一个进程,它会调用刚刚按下的键的原始绑定。如果没有进程,则调用原始的 viper-autoindent。I'm not able to reproduce your problem. I tried every level of viper-mode (1-5), and a number of inferior processes. That said, from your actual question, this code appears like it should fit the bill. If/when
'viper-autoindent
is called, if the current buffer has a process, it calls the original binding for the keys just pressed. If there's no process, the original viper-autoindent is called.