Whenever you open a file, vim performs a series of checks to determine the language of the file and applies the relevant syntax highlighting; first by checking the file extension, then by looking inside the file itself. Nothing new here.
When you create a new file including the file extension, e.g.,
test.sql, vim automatically highlights the SQL syntax to anything you type – again, nothing new here.
However, when you create a new file without a file extension but containing a shebang, e.g.,
#!/usr/bin/env python, it seems to be necessary to save the file and open it again for vim to apply the checks and decide that this is a python script.
My question is whether there is a vim command that triggers these checks, allowing a refresh of the highlighting in new (extensionless) files, avoiding the need to reopen the file.
Having a look at vim's documentation for syntax-loading I thought I would find something useful regarding my query – unfortunately I did not.