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.

Was it helpful?

Solution

add set cindent to your vimrc and see effect.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top