If I enable bash's input mode using set -o vi, then press Esc followed by v, I get a vi window which allows me to edit a temporary file which is executed once I leave. In that window I would like to enjoy Vim syntax highlighting for Bash scripts. It doesn't suffice to execute :syntax enable. The problem might be related to the fact that the temporary file has no .sh ending nor a #!/bin/bash head which could be used to determine the filetype.
2 Answers
I'd use the shorter formulation:
au BufRead,BufNewFile bash-fc-* set filetype=sh
I believe this type of autocmd is the canonical way to handle filetype assignments (at least, my .vimrc has a number of them).
@Eric Fortis, please chime in or correct me if there's a reason you did it differently.
echo $EDITORoutput? Might be that you are actually callingviorvimin compatible mode instead ofvim.vimcan usually pick up the filetype from heuristics like the shebang line.