MyTetra Share
Делитесь знаниями!
О, смотри-ка какое хорошее место. Дайте два!
Redefine tab as 4 spaces
Текстовые метки: vim
Раздел: root - Linux - vim

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.


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.44
Яндекс индекс цитирования