Вопрос

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.

Это было полезно?

Решение

add set cindent to your vimrc and see effect.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top