Closed StephanieSunshine closed 4 weeks ago
Hi, a couple of things to try:
less file_name
?bat --paging=never file_name
?bat
? i.e. if ligatures work in plain text but not something else then it could mean that somehow syntax highlighting is interfering...MacOS:
With Iterm2:
/usr/bin/less
no ligatures, no syntax highlighting
/usr/bin/bat --paging=never
no ligatures, yes syntax highlighting
nvim
I see ligatures, yes syntax highlighting
With Tabby.sh:
/usr/bin/less
no ligatures, no syntax highlighting
/usr/bin/bat --paging=never
no ligatures, yes syntax highlighting
nvim
I see ligatures, yes syntax highlighting
With all of these tests I was using a simple go file that I will try to include in this response. Doing the same tests again with a python script instead of golang source code resolves with the exact same result.
Code used: https://github.com/StephanieSunshine/shaspider/blob/main/main.go https://github.com/StephanieSunshine/py-pascals-triangle/blob/main/triangle.py
Font Used: https://rubjo.github.io/victor-mono/
Thanks
Thanks for the update. Honestly I know very little about terminal emulators and font ligatures. But one thing I realize I forgot to ask is: Does plain cat
show ligatures? Because if not, then perhaps Neovim is doing something special to render them? I admit that I was working on an assumption that cat
shows them.
Also, probably this is a silly question, so please forgive me - are ligatures enabled in your iterm2 preferences? https://iterm2.com/documentation-fonts.html
If I ever get some spare time at the computer, I can try on Linux with a few terminal emulators also... 🙂
To answer your questions, Iterm2 and Tabby both have font ligatures on in their settings. Cat doesn't work, which is why I was interested in bat possibly doing it as an alternative, as I was already using it as an alternative to cat on my laptop.
.config/nvim/init.vim
call plug#begin()
" TailwindCSS vim improvements
Plug 'neovim/nvim-lspconfig'
Plug 'kabouzeid/nvim-lspinstall'
call plug#end()
set termguicolors
set background="dark"
colorscheme elflord
syntax on
set clipboard+=unnamedplus
nmap <C-N><C-N> :set invnumber<CR>
set tabstop=2
set expandtab
set shiftwidth=2
set autoindent
set smartindent
set number
filetype plugin indent on
highlight Comment cterm=italic gui=italic
That last line makes me wonder if I have been focusing too much on the comments changing and not the rest of the ligatures. I tested some of the other ligatures within Neovim and they were indeed working.
It turns out that bat is actually showing ligatures, but not the Victor Mono italic cursive italics, which I miss understood as ligatures too. I believe you can close this unless you have some way to make the highlight Comment cterm=italic gui=italic
work with bat. Thanks for your help.
it may be possible by getting your theme to style comments as italic. For example, if you are using the default theme, then adding
<key>fontStyle</key>
<string>italic</string>
to the "settings" dict
in
https://github.com/jonschlinkert/sublime-monokai-extended/blob/0ca4e75291515c4d47e2d455e598e03e0dc53745/Monokai%20Extended.tmTheme#L63-L72
and following the instructions at https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-themes to use your customized theme, might be worth a try
I tried what you suggested. I took the GitHub built in theme, cloned it from the bat repo into the custom themes folder, and edited the file. I can seem to make fontStyle bold work, but not italic. I checked Tabby and Iterm2, both are responding to bold as a fontStyle, both are ignoring italic. Line 44 is roughly where my changes are in the attached file. Is there something else I'm missing here? I checked out the Sublime documentation for tmThemes and it collaborates your suggestion. I checked both Golang and Python
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#969896</string>
<key>fontStyle</key>
<string>italic</string>
</dict>
</dict>
Hmm, I have a vague recollection that bat
might be disabling italic support by default because many terminal emulators don't support it. Apologies for not thinking of it sooner. Try running bat
with --italic-text=always
That did it thanks! I had just installed Sublime Text and managed to make it work there.
Here is the modified theme to add italics to comments: https://gist.github.com/StephanieSunshine/3986984473a9c14767ea6db4ae0389f7
Hi, I'm trying to find a cat clone for macos that supports font ligatures. I am trying to use the Victor Mono Nerd Font and I can see my ligatures working in Neovim, bat seems to not be showing them. Is there some switch I'm possibly missing? Thanks!