Jade Han
Jade Han

Reputation: 1305

How can I apply vimrc conf file in .py

when I run

vim good.html

and

:verbose set et?
  expandtab
        Last set from ~/.vimrc

but when I run

vim good.py

and

:verbose set et?
 expandtab
        Last set from /usr/share/vim/vim74/ftplugin/python.vim

I want apply ~/.vimrc file in .py, not python.vim

Yesterday I all is fine but today suddenly path was changed

please someone teach me how can I change the path

Upvotes: 0

Views: 150

Answers (1)

Put this into your .vimrc:

autocmd VimEnter *.py set expandtab

or if you want to have the configuration of .vimrc to be executed after all plugins being loaded - in case they have changed some settings -, you can add this line:

autocmd VimEnter * source ~/.vimrc

Note: It could have a side-effect depending on the content of your .vimrc because the latter actually will be executed twice (at the begining and at the end of vim startup) so you need to consider that.

Concerning Plugins now, if they are logged in some specific folders like .vim or vim installation path they will be loaded automatically unless you removed them or run some specific commands to be ignored.

Vim has also the ability to detect the type of file which is being edited, and this occurs when the option filetype is activated and probably this is what happened to you.

So typing :filetype will confirm that. Maybe you can desactivate it for some specific files if you wish. It is up to you !


:help VimEnter

                                                   VimEnter

VimEnter                        After doing all the startup stuff, including
                                loading .vimrc files, executing the "-c cmd" 
                                arguments, creating all windows and loading
                                the buffers in them.

Upvotes: 2

Related Questions