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.
If I enable bash’s input mode using set -o vi , then press Esc
Share
Add this to your
.vimrcthe temporary files are of the form
bash-fc-3537253897, so the regex matches if the file begins withbash-fc-and applies the filetype.