0

I've recently switched from vim to emacs using evil mode and while coding with clojure has been a pleasure, I've found out that the haskell environment doesn't cope well with evil-mode... in particular, the "o", "O" and "RET" (while in insert mode) commands break the current indentation when they open a new line. Example:

say :: String |

press "o"..

say :: String
       |

That's quite annoying but I've found this solution in another answer:

    (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)
    )

That is, overriding every key, but for some reason the "O" equivalent isn't working:

    (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)
    )

Also, how would have it do the same for the RET key?

Dr_Benway
  • 61
  • 5

0 Answers0