add set cindent
to your vimrc and see effect.
Vim is NOT indenting by spaces
-
14-06-2023 - |
Pergunta
I have a file that is set to indent by four spaces. I have a block of code that looks something like:
content
content
end
You can see how everything above is 4 spaces in. Vim likes to do something like:
content
content
new line #(2 spaces, not 4)
end
I set up my vimrc file to have the following lines, in addition to the default settings:
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
What's going on? Even if I do 1>>
it moves too far over and 1<<
moves to far left.
Solução
Outras dicas
I think smartindent
is depreciated. Try cindent
for C-style languages. You could also try filetype indent on
.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow