Closed skwde closed 2 years ago
I don't think this is a worthwhile feature to include in this plugin. I think it's best something like this lives in your vimrc
or its own plugin. If you happen to make this I'd be happy to point to it in the readme.
I'm primarily not interested in taking on the extra tech debt to support this, but I also feel it's a rather poor practice to not give your template filenames fully descriptive extensions. There's no reason that file needs to be example_script.j2
when it could (arguably should) be example_script.bash.j2
or whatever.
@pearofducks I actually don't think it is an additional feature but rather standard vim behavior which gets removed (by accident?) by the plugin. If I open the file with vim (with default config) a file with shebang #!/usr/bin/env bash
gets recognized as ft=sh
and thus receives the correct syntax highlighting.
While I do agree that example_script.j2
can easily go to example_script.sh.j2
or example_script.bash.j2
I also think that basic vim functionality should be kept.
To my understanding the template syntax is only determined by the file ending and the content of
g:ansible_template_syntaxes
.An additional check for an existing shebang would be nice as well.
Currently a bash script template (without file ending), e.g.
example_script.j2
, with contentis only recognized as
ft=jinja2
.