Whenever I press o or O, VIM starts the line with the desired indentation. At work, people have decided that they want empty lines to be indented as if it contained code, such that code can be copied and pasted into an interpreter without empty lines terminating function, if, for, and other similar blocks.

Is there a way to customize the visual mode "=" functionality to adapt for this? And is there a way to make VIM not remove indentation on an indented but otherwise empty line when I leave insert mode?

  • Welcome to Vi and Vim!
    – D. Ben Knoble
    Feb 2, 2022 at 14:55
  • It is possible to customize = (equalprg or indentexpr, for example), but I'm not yet sure how to put all the pieces together
    – D. Ben Knoble
    Feb 3, 2022 at 1:43


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.