Syntax highlighting in Bash vi-input mode Syntax highlighting in Bash vi-input mode bash bash

Syntax highlighting in Bash vi-input mode


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.


Add this to your .vimrc

if expand('%:t') =~?'bash-fc-\d\+'  setfiletype shendif

the temporary files are of the form bash-fc-3537253897, so the regex matches if the file begins with bash-fc- and applies the filetype.