I have most of the usual tab commands in ~/.vimrc
:
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set breakindent
set autoindent
set smartindent
.
There are no problems when I open a file that uses spaces over tabs; all tabs produce 4 spaces. But when I open a file someone else has written using tabs, the tabs produce a space of length 8 and stretches out the lines. I can remove this by typing :set tabstop=4
but why must I do this when that command is already loaded in ~/.vimrc
? How can I make it automatically alter the tabs to length 4 upon opening the file?
tabstop
. You can also use:verbose set tabstop
to check where it was last set.tabstop
or where I can look this up? Does this apply to e.g.C
,C++
, orJava
files?ag setlocal /usr/share/vim/vim80/{ftplugin,indent,syntax}
comes reasonably close (usegrep -r
if you don't haveag
installed).