Opções de recuo do Vim
O Vim usa principalmente três configurações quanto ao tamanho do recuo:
tabstop, ts: quando o Vim encontra uma tabulação em um arquivo que você está abrindo, ele exibe a tab como espaços {ts} (consulte a ajuda do tabstop ou digite :help tabstopVim).
softtabstop, sts: quando você estiver editando um arquivo e pressionando a tecla tab, o Vim usa essa configuração para definir a largura da tabulação inserida (consulte a ajuda do softtabstop ou digite o :help softtabstopVim).
shiftwidth, sw: O número de espaços Vim usa ao recuar, utilizando material autoindent ou o costume >>, <<os comandos. Como Heptite percebeu, era isso que você estava procurando nesse caso em particular. E versões recentes do Vim realmente permitem que você não defina essa opção e, shiftwidthem seguida, use o valor definido por tabstop. Muito útil (consulte a ajuda da largura de turno ).
Exemplo
Por exemplo, se você usar as seguintes configurações:
set sts=4
set ts=2
set sw=8
Isso produziria o seguinte comportamento:
- Inserir uma tabulação no arquivo produziria um recuo de 4 espaços.
- Como você
tabstopestá definido como 2, isso seria o equivalente a 2 tabulações. É fácil verificar isso, basta usar as opções liste listcharspara exibir tabulações.
- Se você recuar uma linha usando
>>, o recuo teria 8 espaços de largura (portanto, o equivalente a 4 tabulações, com base no tabstopvalor, o mesmo que acima).

Recomendações de indentação do Vim (da documentação do Vim)
Da tabstopajuda ( :help tabstopno Vim):
There are four main ways to use tabs in Vim:
1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4
(or 3 or whatever you prefer) and use 'noexpandtab'. Then Vim
will use a mix of tabs and spaces, but typing <Tab> and <BS> will
behave like a tab appears every 4 (or 3) characters.
2. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use
'expandtab'. This way you will always insert spaces. The
formatting will never be messed up when 'tabstop' is changed.
3. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a
|modeline| to set these values when editing the file again. Only
works when using Vim to edit the file.
4. Always set 'tabstop' and 'shiftwidth' to the same value, and
'noexpandtab'. This should then work (for initial indents only)
for any tabstop setting that people use. It might be nice to have
tabs after the first non-blank inserted as spaces if you do this
though. Otherwise aligned comments will be wrong when 'tabstop' is
changed.
Pessoalmente, uso principalmente a segunda solução, com 2 espaços de tabulações.
set ts=2
set sts=2
set et "expand tabs to spaces
tscomo 2, 4 ou 8