File type plugins

A file type plugin (ftplugin) is a script that is run automatically when Vim detects the type of file when the file is created or opened. The type can be detected from the file name (for example, file sample.c has file type c), or from the file contents.

When you edit a blank buffer (for example, just after starting Vim, or as a result of the :new command), the buffer will have no filetype so there will be no syntax highlighting or other ftplugin assistance.

You can check the filetype of the current buffer with command:

:set ft?

You can set the filetype of the current buffer with a command like this example:

:set ft=python

Another approach is to assign a file name when creating the blank buffer, for example, by entering a command like vim mynewfile.py to start Vim, or with commands like these from within Vim:

:new mynewfile.py
:edit mynewfile.py
:tabnew mynewfile.py

Alternatively, the following in your vimrc will set a default filetype for all new buffers: