Unfortunately Vim has a hard filetype detection on the name catalog
. It detects it as SGML catalog file. I'm not sure if that is a wise idea.
Anyway here is a workaround. Add the following line as last line in your script:
# vim: ft=sh
Save and then reload the file with :e!
. And the file should be detected as shell script. (If not, see below.)
The line you inserted, is called "modeline". Vim checks the first few and last few lines for such a modeline (5 by default). If it is found, the settings are applied. In this case it sets the filetype to sh
.
A modeline could contain multiple settings, like:
# vim: ft=sh et sw=2
This sets the filetype to sh
it sets expandtab
and a shiftwidth of 2.
If this doesn't work, check the modeline option with
:set modeline?
If it prints nomodeline
you have to adjust your vimrc
.
More details about modeline can be found with :help 'modeline'
and :help modeline
.
The number of checked lines at start/end of the file is configured with modelines
(plural). See :help 'modelines'
.