Why does vim not obey my expandtab in python files?

后端 未结 2 822
余生分开走
余生分开走 2020-11-29 04:48

After I installed Vundle, my vim no longer obeys the expandtab settings I had. My tabs were set to 2 spaces, but now in python files it no longer does that. The problem is b

2条回答
  •  既然无缘
    2020-11-29 05:20

    Overridden settings

    It could be that the settings are being overridden by language-specific settings. See http://vim.wikia.com/wiki/Keep_your_vimrc_file_clean for more information:

    The quick way to get started is to move all the language-specific stuff from your .vimrc file into a file named .vim/ftplugin/language.vim (or $HOME/vimfiles/ftplugin/language.vim on Windows).

    Check in those locations for a python specific .vim file.

    Filetype on

    Vundle appears to require filetype off, and I'm not sure if you should turn it back on. There's a thread on the github issues page for Vundle explaining why filetype on is required. Perhaps this will provide some insight.

    I also think having filetype plugin indent on followed by filetype on is redundent. According to the vim help docs, the former turns detection, plugin and indent on, and the latter turn detection on and leaves the plugin and indent unchanged:

    Overview:                   *:filetype-overview*
    
    command                     detection       plugin          indent
    
    :filetype on                on              unchanged       unchanged
    :filetype off               off             unchanged       unchanged
    :filetype plugin on         on              on              unchanged
    :filetype plugin off        unchanged       off             unchanged
    :filetype indent on         on              unchanged       on
    :filetype indent off        unchanged       unchanged       off
    :filetype plugin indent on  on              on              on
    :filetype plugin indent off unchanged       off             off
    

提交回复
热议问题