When using haskell-mode
(the Haskell layer) with evil-mode
keybindings in spacemacs, the indentation created by pressing the o key is often incorrect.
For instance, imagine I want to write the following Haskell file:
module Foo where
foo :: Int
foo = 3
However, I've only written the following. I haven't yet created the function body for the foo
function:
module Foo where
foo :: Int
If I am in insert mode and have my cursor after the "t" in Int
and press Enter, the cursor goes to the next line in the first column, directly under the "f" in "foo". Using an underscore (_
) for the cursor position, it looks like this:
module Foo where
foo :: Int
_
This is correct.
However, if I am in normal mode and have my cursor anywhere in the line with "foo" and press o, the cursor goes to then next line in the third column. It looks like this:
module Foo where
foo :: Int
_
This is incorrect. I have to press Backspace twice to put the cursor in the first column before I can start writing the definition of foo
.
It seems like indentation rules are getting messed up. Why is the indentation different depending on whether Enter is pressed in insert mode, or o is pressed in normal mode?
How can I get o to indent the same as Enter in insert mode?
Here is my current .spacemacs
config file. To my knowledge, I don't have any settings set that effect indentation.
edit: Just so my intentions are clear, I do want indentation to be happening when I press either Enter or o. But I want it to be the appropriate indentation. Currently, pressing o results in incorrect indentation.