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

feat(icons): use virtual text if possible #255

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

brianhuster
Copy link
Contributor

@brianhuster brianhuster commented Feb 6, 2025

Closes #145, #253

Screenshot of vim-dirvish with Nerdfont icon
image

Regarding #253, I don't see the bug when using virtual text (both extmark and textprop) instead of conceal for icons, so it's possibly a bug with icons. That's why I think PR can also close that issue

@brianhuster brianhuster force-pushed the master branch 2 times, most recently from fc6b544 to b9f240c Compare February 6, 2025 15:24
@brianhuster
Copy link
Contributor Author

@justinmk Icon providers like mini.icons also returns highlight group for icon. Also, both extmark and textprop supports highlight group for virtual text (though the API of textprop seems trickier), I would also like to allow the callback param of add_icon_fn to be able to return a dictionary that includes 2 field : text and highlight.

Copy link
Owner

@justinmk justinmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done! I'll go ahead and merge this since it's low-risk.

@justinmk justinmk merged commit 5d1d1ef into justinmk:master Feb 6, 2025
@@ -426,7 +426,20 @@ func! s:apply_icons() abort
if 0 == len(s:cb_map)
return
endif
highlight clear Conceal
let l:feat = has('nvim-0.8') ? 'extmark' : ((v:version >= 901 && has('textprop'))? 'textprop': 'conceal')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be a script-level var.

@justinmk
Copy link
Owner

justinmk commented Feb 6, 2025

I would also like to allow the callback param of add_icon_fn to be able to return a dictionary that includes 2 field : text and highlight.

Ok.

brianhuster added a commit to brianhuster/vim-dirvish that referenced this pull request Feb 6, 2025
feat(icons): use virtual text if possible justinmk#255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

more than one character as an icon
2 participants