I often write shell scripts with no file extension, letting the shebang set the language for the script. I need color syntax highlighting to write any script longer than a couple lines efficiently. Rather than having to set the syntax for each file on a case by case basis for #!/usr/bin/env language, I wrote a simple ftdetect vimscript that will set the syntax based on the shebang:
" ~/.vim/ftdetect/usr_bin_env.vim fun s:DetectEnv() let tokens = split(getline(1)) if len(tokens) >= 2 setfiletype tokens[1] endif endfun autocmd BufNewFile,BufRead * call s:DetectEnv()