Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Auto syntax detector for bashrc, bash_profile, ... file formats #3145

Open
imahmadrezas opened this issue Dec 12, 2024 · 1 comment
Open
Labels
bug Something isn't working good first issue Good for newcomers syntax-mapping-request A syntax definition exists but isn't chosen automatically

Comments

@imahmadrezas
Copy link

imahmadrezas commented Dec 12, 2024

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.

Screenshot_20241212_180615

@imahmadrezas imahmadrezas added the feature-request New feature or request label Dec 12, 2024
@keith-hall keith-hall added bug Something isn't working good first issue Good for newcomers and removed feature-request New feature or request labels Dec 13, 2024
@keith-hall
Copy link
Collaborator

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

@keith-hall keith-hall added the syntax-mapping-request A syntax definition exists but isn't chosen automatically label Jan 27, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working good first issue Good for newcomers syntax-mapping-request A syntax definition exists but isn't chosen automatically
Projects
None yet
Development

No branches or pull requests

2 participants