Giter Club home page Giter Club logo

Comments (8)

keith-hall avatar keith-hall commented on July 24, 2024

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.

StephanieSunshine avatar StephanieSunshine commented on July 24, 2024

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.

keith-hall avatar keith-hall commented on July 24, 2024

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.

StephanieSunshine avatar StephanieSunshine commented on July 24, 2024

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 Screenshot 2024-06-01 at 1 51 47 AM

.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

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

from bat.

keith-hall avatar keith-hall commented on July 24, 2024

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.

StephanieSunshine avatar StephanieSunshine commented on July 24, 2024

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>

VictorMono.tmTheme.txt

from bat.

keith-hall avatar keith-hall commented on July 24, 2024

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.

StephanieSunshine avatar StephanieSunshine commented on July 24, 2024

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

from bat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.