I always prefer shebangs over extensions.
A lot of times I make a new file without an extension in vim, which gets opened as plain text, since no extension is provided, which is completely normal.
The first thing I write is a shebang, but the syntax doesn't get highlighted (even though the language is supported), closing and reopening the file is annoying.
Since I'm new to vim, I'm asking you vim lovers if there is a command which I can use, or maybe some modifications to my .vimrc file I can make to fix this issue.
:e
(after writing the file) to cause the buffer to reload and re-detect the filetype. This is almost a duplicate of: vi.stackexchange.com/questions/444/… but, that one asks about the file being modified outside of Vim.:filetype detect
, while longer, is my preferred option