Kim Schulz wrote:
Hi is there a way to make indentation in Vim "lock" like in emacs so that if I press tab in the beginning of a line, then it indents the line to the correct place. Pressing tab multiple times does not change the indentation any further - it is locked.
'autoindent' will indent the line to the same location as the line the
cursor was on before hitting Enter in Insert mode, o or O in Normal
mode, etc.
I suppose that you could force a fixed indent of, say, 6 characters
(i.e., always indent to column 7) by using
:setlocal indentexpr=6
To use it in all buffers, use
:filetype indent off
:set indentexpr=6
Best regards,
Tony.