I am looking for a way to create a newline with an indentation equal to the current column position of my cursor.
Here is an example. Say I'm editing some line of code looking like this, with my cursor on the opening bracket [
:
data Foo a = Bar a | Baz [a]
I'd like to have a command that act a bit like o
but instead of creating an empty line, it would create an indented line and leave me right under the opening bracket [
, allowing me to directly type e.g. (a,a)
to obtain
data Foo a = Bar a | Baz [a]
(a,a)
Please note this is not something that can be automated via the smartindent
option since there isn't only one interesting indentation (depending on what I want to do, the pipe or the beginning of the line could also be interesting positions to be at; forcing one of those via smartindent
wouldn't solve my problem in a general way).