Given a file with a weird extension but an underlying known filetype e.g.
yaml file with a
.config extension. It is possible to force vim to set the filetype to
yaml for that file:
At the top/bottom of the file add a comment (with the filetypes acceptable comment syntax - for yaml it is
# vi: ft=yaml baz: foo: 'bar'
Re-open the file and vim will automatically set the filetype to
yaml for that file.
This can also be used for setting other setting such as
I’ve been using this trick for a while but keep forgetting it the exact syntax, usually using
# vim: instead of
# vi:. Hopefully my wording will make it more easily duckduckgoable.