MyTetra Share
Делитесь знаниями!
Redefine tab as 4 spaces
Время создания: 04.05.2015 12:00
Текстовые метки: vim
Раздел: root - Linux - vim
Запись: Yurons/mytetra/master/base/1430730049ta2833aeoi/text.html на raw.github.com

Depending on what you mean by tab, one of the following should work:

" size of a hard tabstop
set tabstop=4

" size of an "indent"
set shiftwidth=4

" a combination of spaces and tabs are used to simulate tab stops at a width
" other than the (hard)tabstop
set softtabstop=4

You may also want to try the following:

" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab

" always uses spaces instead of tab characters
set expandtab

See :help 'optionname' (eg: :help 'tabstop') for more details on any of these.

tl;dr

In a codebase that uses space characters for each indent, here are good settings to start with:

set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab

In a codebase that uses a single tab character that appears 4-spaces-wide for each indent these settings should work:

set tabstop=4 softtabstop=0 noexpandtab shiftwidth=4

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования