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

ligatures font support #166

Closed
idealist1508 opened this issue Aug 6, 2016 · 21 comments
Closed

ligatures font support #166

idealist1508 opened this issue Aug 6, 2016 · 21 comments
Labels
font Relating to font options or rendering

Comments

@idealist1508
Copy link

It would be fantastic that NeoVim could support some ligatures programming font like FiraCode.

There exists a patch to VIM to enable this.

@equalsraf
Copy link
Owner

That is something that would have to be done upstream see neovim/neovim#1408

@idealist1508
Copy link
Author

I thought it is something that could be implemeted only in client gui.
See neovim/neovim#1408 (comment)

@equalsraf
Copy link
Owner

Possible. But would require some large changes in drawing. Need to check further.

@zovt
Copy link

zovt commented Sep 21, 2016

This weekend I'll try to take a look at this and see if I can figure something out

@equalsraf
Copy link
Owner

@zovt you might want to start from #141 instead of master

One aspect that is not clear to me is how to determine if two chars form a ligature, or if the fonts support it.

@razor-x
Copy link

razor-x commented Mar 21, 2018

I'd love is this could be a thing. I switched to neovim-gtk for a couple months simply for this feature, but I'm about to abandon that project due to UI lag, flickering, slowness, and general breakage of mappings. Never had any of those issues with neovim-qt.

Is there anyway you can use whatever ligature logic they have from that project and adapt it here?

@unclechu
Copy link

unclechu commented Apr 13, 2018

@razor-x It's probably offtopic, about flickering in neovim-gtk (I'm using this GUI for about half a year), it have been fixed in master branch, see this issue by enabling double-buffering with environment variable NVIM_GTK_DOUBLE_BUFFER set to 1.

It is also in active development by the maintainer, so other issues you had could be fixed too if you try latest commit from master branch.

UPD 19 June 2018: Now this flickering bug is fixed and you don't have to use any hacks such as double buffering enabled by environment variable.

@razor-x
Copy link

razor-x commented Apr 14, 2018

Thanks for the update. I may have been a bit harsh with my feedback on neovim-gtk. Some issues were plugin related I think. I also noticed a lag when writing with one of my keybinds, but now I suspect this is a lower-level issue unrelated to the GUIs (nnoremap <silent> <Leader>s :<C-U>update<CR>).

I did end up switching back to qt out of eventual frustration. The key factor was speed for me: neovim-qt just feels faster for my day to day work.

I'll keep trying out newer every so often to see how they compare.

@equalsraf equalsraf added the font Relating to font options or rendering label Jul 25, 2018
@kierun
Copy link

kierun commented Jul 30, 2018

Any update on this one?…

@equalsraf
Copy link
Owner

None on my end.

@concatime
Copy link

qTerminal is based on Qt and does support font ligature. Maybe you could take at look for inspiration?

@osa1
Copy link

osa1 commented Aug 29, 2018

👍 this would be great.

@Nuclearo
Copy link
Contributor

It seems like sending multiple characters at once to QPainter::drawText will automatically draw the ligatures. I managed to get them to show up, but there are still a couple of glitches. For example, the colon in airline (bottom right):
image

@jgehrig
Copy link
Collaborator

jgehrig commented Sep 29, 2020

Ligatures are now available in master, run :GuiRenderLigatures 1.

The feature should be available for release 0.2.17. Marking as closed.

@jgehrig jgehrig closed this as completed Sep 29, 2020
@kierun
Copy link

kierun commented Oct 1, 2020

I tried this:

√ (master|…56); git log | head -1
commit 5038ad11d27100889a69b079f1c0c2515687565a
√ (master|…56); lsd -l bin/nvim-qt
.rwxrwxr-x yann yann 4.4 MB Thu Oct  1 11:17:59 2020  nvim-qt
√ (master|…56); ./bin/nvim-qt ook

But got that:

screenshot

What am I doing wrong here?

@jgehrig
Copy link
Collaborator

jgehrig commented Oct 1, 2020

@kierun

From your commit hash, it looks like you have the required changes. I would guess the shim is not loading properly. There is a plugin that need to load for all of the Gui... commands to work.

You can see where the runtime is loaded from in the --version command:

$ nvim-qt --version
NVIM-QT v0.2.17.9999
Build type: Release
Compilation:-march=native -O2 -pipe -Wall -Wextra -Wno-unused-parameter -std=c++11 -Wfatal-errors
Qt Version: 5.14.2
Environment: 
  nvim: nvim
  args: --cmd let &rtp.=',/usr/share/nvim-qt/runtime' --cmd set termguicolors
  runtime: /usr/share/nvim-qt/runtime  <-- RUNTIME HERE

If you are compiling nvim-qt from source you need the latest master shim changes:
NVIM_QT_RUNTIME_PATH=src/gui/runtime build/bin/nvim-qt

If you are connecting to a remote instance of nvim you need:
Plugin 'equalsraf/neovim-gui-shim'

NOTE: As of writing this, I haven't added the changes to the plugin above. They will be added soon...

@kierun
Copy link

kierun commented Oct 1, 2020

Ah, I see. The runtime was wrong, installed and I can see ligatures.

screenshot

I mean, they are horribly broken but that could be my font.

screenshot1

Which it is.

However, using the mouse now causes neovim to crash… Should I open a new bug for that?

@unclechu
Copy link

unclechu commented Oct 1, 2020

I have also a couple of rendering issues, will open an issue later.

@Himujjal
Copy link

Himujjal commented Jan 1, 2021

If you are compiling nvim-qt from source you need the latest master shim changes:
NVIM_QT_RUNTIME_PATH=src/gui/runtime build/bin/nvim-qt

These are my logs:

$ echo NVIM_QT_RUNTIME_PATH
/home/himu/programs/neovim-qt/src/gui/runtime
$ ./build/bin/nvim-qt --version                                                
NVIM-QT v0.2.17.9999
Build type: Release
Compilation: -Wall -Wextra -Wno-unused-parameter -Wunused-variable -std=c++11
Qt Version: 5.15.2
Environment: 
  nvim: nvim
  args: --cmd set termguicolors
  runtime: 

NVIM v0.4.3
....

@Djedouas
Copy link

Djedouas commented May 4, 2021

Hi,

I installed neovim-qt using the Ubuntu package repository with sudo apt install neovim-qt.

The command GuiRenderLigatures was not available.

I added the function and command found here in my config.

Using the font JetBrains Mono I opened neovim-qt and typed GuiRenderLigatures 1 which resulted in no change in my opened file.

@jgehrig
Copy link
Collaborator

jgehrig commented May 4, 2021

@Djedouas

Font ligatures are only supported in not-yet released builds.

See:
#823 (comment)
https://github.com/equalsraf/neovim-qt/wiki/Windows-AppVeyor-Builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
font Relating to font options or rendering
Projects
None yet
Development

No branches or pull requests