Skip Huffman
Skip Huffman

Reputation: 5459

VIM tab oddities, have to retab every save?

Ok, this is really weird. I have used VIM forever, literally twenty years. And now I have a very weird behavior. This just started this week.

My whitespace is getting screwed up with almost every edit.

I have long working code. I open it up, use "o" to add a line, even just a print statement, it seems that I am getting improper indentation errors from python, even though the code LOOKS good.

I can solve this by running set et|retab every time before I save, but that seems wrong and cumbersome.

What might I be missing? And if this should be somewhere else in StackExchange, let me know.

Thanks.

--edit--

verbose setlocal et? gives this:

expandtab Last set from ~/.vimrc

which is what I expect

relevant portion of .vimrc:

set shiftwidth=4 set softtabstop=4 set tabstop=4 set expandtab


No vim version changes in quite a few months. I think windows may have had one of its update parties late last week or early this week. Which may or may not be a coincidence.

Upvotes: 1

Views: 1042

Answers (2)

flaudre
flaudre

Reputation: 2298

I am having a similar problem funnily only with *.slim files. I solved it by forcing a retab for those files on every :write in my .vimrc:

fu! ResetSpaces()
    set tabstop=2
    set noexpandtab
    %retab!
endfunction

autocmd BufWritePre *.slim :call ResetSpaces()

Upvotes: 2

Skip Huffman
Skip Huffman

Reputation: 5459

Ok, weirdness went away. Maybe just over time, maybe it was more Windows updates. Dunno, but all better now. Sigh. I hate problems that fix themselves. They always worry me.

Upvotes: -1

Related Questions