Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Some *.conf files not highlighted #1703

Closed
eggbean opened this issue Jun 24, 2021 · 9 comments · Fixed by #1889
Closed

Some *.conf files not highlighted #1703

eggbean opened this issue Jun 24, 2021 · 9 comments · Fixed by #1889
Labels
bug Something isn't working

Comments

@eggbean
Copy link

eggbean commented Jun 24, 2021

I wanted to add syntax highlighting for for .tmux.conf file, so I add this file to bat/syntaxes/

https://raw.githubusercontent.com/gerardroche/sublime-tmux/master/Tmux.sublime-syntax

I then bat cache -b and try viewing my .tmux.conf file, but it is still plain with no syntax highlighting. Have I missed something or does this file not work with bat for some reason? Tmux and the file extensions do appear with bat -L.

@eggbean eggbean added the question Further information is requested label Jun 24, 2021
@eggbean
Copy link
Author

eggbean commented Jun 24, 2021

I just realised that it works when I force it like this:

$ bat -l Tmux .tmux.conf

So why is it not detecting the file when it is named in the same way that the bat -L mentions?

ie.

Tmux tmux.conf, tmux, .tmux.conf, .tmux

@keith-hall
Copy link
Collaborator

likely related:
#1510 (comment)

@eggbean
Copy link
Author

eggbean commented Jun 25, 2021

@keith-hall After reading that I noticed that /etc/resolv.conf was not syntax-highlighted either. I upgraded from 0.17.1 to 0.18.1, rebuilt the cache and now /etc/resolv.conf is coloured, but tmux.conf is still not, unless that I specify with --language.

@sharkdp
Copy link
Owner

sharkdp commented Jun 28, 2021

I think this might be due to this explicit syntax mapping to "unknown":

// Nginx and Apache syntax files both want to style all ".conf" files
// see #1131 and #1137
mapping
.insert("*.conf", MappingTarget::MapToUnknown)
.unwrap();

I think you could fix it locally by adding:

--map-syntax tmux.conf:Tmux

to your config file.

But that still leaves the question if this should be fixed somehow...

@eggbean
Copy link
Author

eggbean commented Jun 28, 2021

Thanks, I've added that line to my config for the time being.

@Enselic Enselic changed the title Why isn't this Tmux.sublime-syntax file working for me? Some *.conf files not highlighted Aug 4, 2021
@Enselic Enselic added bug Something isn't working and removed question Further information is requested labels Aug 4, 2021
@cbolgiano
Copy link
Contributor

I can take a look at this issue.

@Integralist
Copy link

👋🏻 I've just installed bat version 0.19.0 and I still find tmux.conf files are plaintext.

I tried bat --map-syntax tmux.conf:Tmux but it didn't work (bat just hung) and so looking at bat --list-languages I realised I don't see Tmux in the list.

Is there anything in particular I need to do to get support for tmux.conf ?

Thanks!

@eggbean
Copy link
Author

eggbean commented Feb 25, 2022

@Integralist If it's not part of bat, add the file I linked to in the top comment to your ~/.config/bat/syntaxes directory and rebuild the cache with bat cache --build.

@Integralist
Copy link

@eggbean ah! nice OK I see. Thank you that works great 🙂

jluckyiv added a commit to jluckyiv/dotfiles-2022 that referenced this issue Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants