Whenever I open a line using o
or O
, the cursor starts at the correct indentation (I'm not sure if vim uses syntax hints for this or just mimics the position of first character of the neighboring lines). Same happens when opening a line in insert mode with Enter
keypress.
Is there a quick way to similarly auto-indent an empty line? Currently I'm just getting into insert mode and pressing tab manually to manually indent.
I most likely want to map this functionality to when A
(append to line) is pressed on an empty line.
EDIT: I've seen How do I prevent vim from unindenting empty lines. This question is however different since I don't want to prevent vim from unindenting empty lines. I just want to be able to "revive indentation of emptied lines" so not all answers to that question apply to this question.
:help S
to understand why it works) and I'll accept itS
work for you? I think I have the same question as you do butS
did not work for me, it only works in a line that already texts and correct indention.