Comments (8)
Hi, a couple of things to try:
- does ligatures show when you open the file directly in your pager? i.e.
less file_name
? - if they don't, does it work with
bat --paging=never file_name
? - does it make a different which types of file you view in
bat
? i.e. if ligatures work in plain text but not something else then it could mean that somehow syntax highlighting is interfering...
from bat.
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
from bat.
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... 🙂
from bat.
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.
![Screenshot 2024-06-01 at 1 50 44 AM](https://private-user-images.githubusercontent.com/3218304/335789683-5b32d681-954d-41cf-8244-6760dccd7605.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDc4MDEsIm5iZiI6MTcxOTMwNzUwMSwicGF0aCI6Ii8zMjE4MzA0LzMzNTc4OTY4My01YjMyZDY4MS05NTRkLTQxY2YtODI0NC02NzYwZGNjZDc2MDUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDkyNTAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWM0ODk3ODA2ODI2OTlmYjA1MTFlMDI2MmQ0ZTg4YzY1ODkxNDA2Y2VkNmNkYTlmN2Y1YWQxODE3MWYyZGUzMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.HKUdzqPHR3U2LTeKkYfggzAbZga8mngeFUx5kr1VRyo)
![Screenshot 2024-06-01 at 1 51 47 AM](https://private-user-images.githubusercontent.com/3218304/335789685-af029dbe-821a-4f0c-983f-427294ccff98.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDc4MDEsIm5iZiI6MTcxOTMwNzUwMSwicGF0aCI6Ii8zMjE4MzA0LzMzNTc4OTY4NS1hZjAyOWRiZS04MjFhLTRmMGMtOTgzZi00MjcyOTRjY2ZmOTgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDkyNTAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NWUxN2VkNDhhOWJmM2JhOTcwZTJlMDQ5ZGY5ZTRmNmQxMmYzZWFlMmU5MmVkMDNlNTdiOWNkMjg0NGMxZTdmZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.A1HqEr2TTc7z8jYzc1iTtZ11y9cMgXvH9jRB3O7PrBM)
.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.
![Screenshot 2024-06-01 at 2 02 36 AM](https://private-user-images.githubusercontent.com/3218304/335790320-2fbfef2a-124d-4a59-840e-0f76bff8f7d7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDc4MDEsIm5iZiI6MTcxOTMwNzUwMSwicGF0aCI6Ii8zMjE4MzA0LzMzNTc5MDMyMC0yZmJmZWYyYS0xMjRkLTRhNTktODQwZS0wZjc2YmZmOGY3ZDcucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDkyNTAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzBkZTc5NGFiOWRmODdjYzU2NWI4YTM4ODUyYWEyMzRlNTIwODU2YjZkZGNjMzJhMjA1Njc5MTAzZWUwN2I0NCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.R-fhYSbtnMFkNEFzX2HDXObIktygerqAbKzMn70Pils)
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.
![Screenshot 2024-06-01 at 2 05 31 AM](https://private-user-images.githubusercontent.com/3218304/335790496-a0e4422c-9d68-4c58-8346-139c6d63df85.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDc4MDEsIm5iZiI6MTcxOTMwNzUwMSwicGF0aCI6Ii8zMjE4MzA0LzMzNTc5MDQ5Ni1hMGU0NDIyYy05ZDY4LTRjNTgtODM0Ni0xMzljNmQ2M2RmODUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDkyNTAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjU1OWE1NWVlZmQyZjdhOWFhMDYxZjEyMzZjNjlhN2Q1YjAxMmY5NTFjMDA0YjQxYTM4MzRkMjE3ZmVjNDBjNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.IV4hPHcpy1nSm5u3scbe6AOs0HgS3mToJDxuXVDyYCk)
from bat.
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
from bat.
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>
from bat.
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
from bat.
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
![Screenshot 2024-06-01 at 7 12 12 AM](https://private-user-images.githubusercontent.com/3218304/335806740-33a48e5a-9306-4e28-92cd-18c9ba413603.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMDc4MDEsIm5iZiI6MTcxOTMwNzUwMSwicGF0aCI6Ii8zMjE4MzA0LzMzNTgwNjc0MC0zM2E0OGU1YS05MzA2LTRlMjgtOTJjZC0xOGM5YmE0MTM2MDMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMDkyNTAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWEyZjlkY2I0YWQ3YTlkMzYyNjhjOTQ2NWFlZmFhOTBmM2JlNjliYzk5OThkMWQ5N2YwNTdlOTkzOTQyMjQ5MSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.BrHB56PjdeO4mBnuNecMjJVWKZGLpS5soTW1sGZTNm0)
from bat.
Related Issues (20)
- Add Flag to Avoid Treating NUL Separated Input as Binary HOT 11
- [bat error]: 'REPLY': No such file or directory (os error 2) HOT 1
- no license for bundled github-sublime-theme
- no license for bundled sublime-snazzy theme HOT 1
- no license for bundled visual-studio-dark-plus theme
- no license text for bundled Nord-sublime theme HOT 1
- mis-behaviour of `--style=plain` while itegrating with `fzf` HOT 2
- musl asset: inconsistent between output of `file` and `ldd` HOT 2
- Request for a 'statically compiled binary' for aarch64 HOT 5
- Unable to compile bat on Windows from Git HOT 2
- Support ignoring the system-wide configuration file HOT 4
- Format of the man page of `bat` (`assets/manual/bat.1.in`) HOT 1
- (Feature request) Add an option to disable the line numbers HOT 2
- Failure to read config in MSYS2
- Reports no error but empty file when EIO on read()
- Support for CITATION.cff aka citation files from GitHub HOT 4
- `bat -pp` Adds Non-Printable Characters, Making it Incompatible with `cat` HOT 1
- Can we show folded output for language (c / java) files ? HOT 1
- markdown feature request for quarto codeblocks HOT 1
- Print out code and outputs rather than json format of ipynb files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bat.