Sometimes Vim keeps changing my expandtab
settings. I want spaces always for specific file types but sometimes, when I insert a new line, it gives me a tab instead.
verb set expandtab?
Tells me nonexpandtab
was set in this file:
set autoindent
set expandtab
set shiftwidth=4
set numberwidth=4
set softtabstop=4
set smartindent
autocmd FileType ruby,php,vim,jade,erb,css,scss,html,coffee,javascript setlocal expandtab sw=2 sts=2
au FileType xml exe ":silent 1,$!XMLLINT_INDENT=' ' xmllint --format --recover - 2>/dev/null"
set backspace=indent,eol,start
" Command to set how many spaces
command! -nargs=1 SetSpace call s:SetSpace(<f-args>)
function! s:SetSpace(space)
setlocal expandtab sta
let &sw = a:space
let &sts = a:space
endfunction
Where exactly did it set noexpandtab
?
Update
I notice that this problem happens when I enter a new line and if the line happens to be indented as 8 spaces then Vim converts to a tab. How to fix this?
The :verbose set
unfortunately doesn't capture all instances, so it may give no or a wrong answer.
Alternatively, you can capture a full log of a Vim session with vim -V20vimlog
. After quitting Vim, examine the vimlog
log file for suspect commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With