I often edit different files in vim, some of which use tabs, and some and different amounts of spaces. With this, I have not found a combination of set expandtab
, set shiftwidth
, set softtabstop
, and filetype plugin indent on
that fit all use cases. How does one get vim to automatically apply the correct indentation? Some graphical editors on Windows including Notepad++ would use whatever indentation was present on the prior line, and would work with files that mixed tabs and spaces at different indentation levels, so I am asking if there is a way to implement this functionality in vim without using external plugins.
`
:h 'autoindent'
,:h 'smartindent'
,:h 'cindent'
for starters. The first one, when enabled, simply uses the indent from the previous line.