0

To run an autocommand on a python file I can do:

:autocmd FileType python     nnoremap ...

However, what 'event' does this run on? Is the event FileType or is Filetype python basically doing a replacement for *.py ? I would assume it's the former but I just wanted to understand the difference (if any) between doing the following two commands:

:autocmd FileType python     nnoremap ...
:autocmd FileType *.py       nnoremap ...
1

The autocmd FileType python is run whenever the file type is set to python.

This happens for following files by default: *.py, *.pyw , .pythonstartup ,.pythonrc, *.ptl , *.pyi and SConstruct.

But it is also run when you change the filetype manually by executing :setf python or :set ft=python.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.