所有模式下的 Viper 模式
我正在从 vi 转移到 emacs,并且使用 viper 和 vimpulse,当我 Cw Cw 到一个窗口并且无法使用相同的命令返回到原始窗口时,这会变得非常烦人,因为另一个缓冲区,这可能是一个帮助缓冲区,但不在 Viper 模式下。我该如何解决这个问题?
我尝试将其他模式添加到 viper 配置中,并使用钩子使它们默认以 viper 模式启动:
(add-to-list viper-vi-state-mode-list 'help-mode) (add-hook 'help-mode (lambda () (setq viper-mode t)))
但这些命令都不起作用。事实上,第一个产生了以下错误:
Warning (initialization): An error occurred while loading `/home/konrad/.emacs.d/init.el': Wrong type argument: symbolp, (fundamental-mode ...
除了 Cw Cw
之外,我还怀念无法使用 hjkl 进行导航的情况。有没有办法重用 viper 设置的键绑定,而不是为每种模式再次重新绑定它们?
I'm moving from vi to emacs and, using viper and vimpulse, it gets pretty annoying when I C-w C-w
to a window and cannot get back to the original one with the same command because the other buffer, which could be a help buffer, is not in the Viper mode. How can I fix this?
I tried to add other modes to the viper configuration and make them start with the viper mode on by default using hooks:
(add-to-list viper-vi-state-mode-list 'help-mode) (add-hook 'help-mode (lambda () (setq viper-mode t)))
But none of these commands did work. In fact, the first one yielded the following error:
Warning (initialization): An error occurred while loading `/home/konrad/.emacs.d/init.el': Wrong type argument: symbolp, (fundamental-mode ...
Besides the C-w C-w
, I also miss not being able to navigate using hjkl. Isn't there a way to reuse the keybindings set by viper, instead of rebinding them again for every mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该错误是因为您忽略了引用变量
viper-vi-state-mode-list
,如下所示:请参阅这个问题说明为什么需要引用
'viper-vi-state-mode-list
。但是,这并没有解决我的问题,这就是我如何让 Cw Cw 按照你想要的方式工作:
The error is because you neglected to quote the variable
viper-vi-state-mode-list
like so:See this question as to why you need to quote
'viper-vi-state-mode-list
.But, that didn't solve the problem for me, this is how I got C-w C-w to work the way you want:
将钩子添加到 help-mode 的语法如下所示:
请注意,钩子变量以“-hook”命名,并且 setq 在这里不起作用,因为
viper-mode
是命令,而不是一个变量。您也许可以获得所有模式来激活 viper:
因为所有模式都继承自基本模式。
The syntax for adding the hook to help-mode would look like this:
Note the hook variable is named with "-hook", and setq doesn't work here because
viper-mode
is a command, not a variable.You might be able to get all modes to activate viper with:
since all modes inherit from fundamental-mode.