我最近使用 evil 模式从 vim 切换到 emacs,虽然使用 clojure 编码是一种乐趣,但我发现 haskell 环境不能很好地应对 evil-mode ......尤其是“o” , "O" 和 "RET"(在插入模式下)命令在打开新行时会中断当前缩进。例子:
say :: String |
按“o”..
say :: String
|
这很烦人,但我在另一个答案中找到了这个解决方案:
(defun evil-open-below (count)
"Insert a new line below point and switch to Insert state.
The insertion will be repeated COUNT times."
(interactive "p")
(evil-insert-newline-below)
(setq evil-insert-count count
evil-insert-lines t
evil-insert-vcount nil)
(evil-insert-state 1)
(add-hook 'post-command-hook #'evil-maybe-remove-spaces)
)
也就是说,覆盖每个键,但由于某种原因,“O”等效项不起作用:
(defun evil-open-above (count)
"Insert a new line above point and switch to Insert state.
The insertion will be repeated COUNT times."
(interactive "p")
(evil-insert-newline-above)
(setq evil-insert-count count
evil-insert-lines t
evil-insert-vcount nil)
(evil-insert-state 1)
(add-hook 'post-command-hook #'evil-maybe-remove-spaces)
)
另外,它如何对 RET 键做同样的事情?