Question

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.

Était-ce utile?

La solution

add set cindent to your vimrc and see effect.

Autres conseils

I think smartindent is depreciated. Try cindent for C-style languages. You could also try filetype indent on.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top