[OT(?)] Ubuntu 18 vim now defaults to 4-space tabs

Tobiah toby at tobiah.org
Tue Sep 10 17:27:42 EDT 2019


> Since it does not appear to have "filetype=python" in there, maybe I
> should have specified "Run vim with a .py filename".

Yes, that was a bit that took me a while to figure out!  So I used
your trick and did:

   :verbose set shiftwidth?

and it revealed:

   cd /usr/share/vim/vim80/ftplugin

And in that file I fount the clause:

   if !exists("g:python_recommended_style") || g:python_recommended_style != 0
       " As suggested by PEP8.
       setlocal expandtab shiftwidth=4 softtabstop=4 tabstop=8
   endif


So there it is.  I put

   let g:python_recommended_style = 0

in my ~/.vimrc and my problem was elegantly solved.

I continued here with the answer so that those that find
my original post by Googling the same question would not
be left hanging.


Tobiah



More information about the Python-list mailing list