Auto syntax detector for bashrc, bash_profile, ... file formats
Opened this issue · 1 comments
Well...
bat can automatically highlight .bashrc
and .bash_profile
, etc; but it doesn't include files like xyz.bashrc
or something.bash_profile
.
In archlinux files /etc/bash.bash_bashrc
and /etc/bash.bash_bash_logout
are not automatically hightlighted. Of course the issue can be solved by adding -l <syntax>
but that's such a pain.
Thanks for reporting. I can confirm that I see the same behavior. I consider this to be a bug because I would expect it to work. I have a feeling that it is due to the unnecessary dots here: https://github.com/sublimehq/Packages/blob/759d6eed9b4beed87e602a23303a121c3a6c2fb3/ShellScript/Bash.sublime-syntax#L17-L25
As we can't really update this sublime-syntax
at the moment (see trishume/syntect#323 and trishume/syntect#271 - and if we did we would likely run into #2227), it may be easier to add mappings to https://github.com/sharkdp/bat/blob/master/src/syntax_mapping/builtins/unix-family/50-shell.toml
In the meantime, you can map it in your configuration file so that you don't need to specify -l
on every invocation: https://github.com/sharkdp/bat?tab=readme-ov-file#adding-or-changing-file-type-associations