Skip to main content
1 of 2
computronium
  • 878
  • 11
  • 19

How to make vim recognize the script type and turn on autoindent and syntax highlighting, without needing to save and reopen file?

I don't save my shell scripts with a .sh extension. So when i launch a new file with vim using vim <filename>, it identifies the script type by reading the shebang. Naturally, this only happens after I have typed in the shebang, saved and then reopened the file... Was wondering if there is some command line option or vim command mode option so I can avoid these unnecessary steps of saving and reopening, and vim just knows that i am working on a shell script.

computronium
  • 878
  • 11
  • 19