[vim/vim] It would be better if vim's virtual text can overlay the actual text. (Issue #15007)

16 views
Skip to first unread message

Yggdroot

unread,
Jun 15, 2024, 12:29:46 AM (13 days ago) Jun 15
to vim/vim, Subscribed

neovim has nvim_buf_set_extmark to create virtual text, it supports the "overlay" virtual text positon.

                  • virt_text_pos : position of virtual text. Possible values:
                    • "eol": right after eol character (default).
                    • "overlay": display over the specified column, without
                      shifting the underlying text.
                    • "right_align": display right aligned in the window.
                    • "inline": display at the specified column, and shift the
                      buffer text to the right as needed.

vim's prop_add don't support the "overlay" virtual text position.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/15007@github.com>

Christian Brabandt

unread,
Jun 15, 2024, 9:01:54 AM (12 days ago) Jun 15
to vim/vim, Subscribed

so what does overlay do?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/15007/2169544431@github.com>

Yggdroot

unread,
Jun 15, 2024, 9:41:15 AM (12 days ago) Jun 15
to vim/vim, Subscribed

https://github.com/easymotion/vim-easymotion
https://github.com/hadronized/hop.nvim

vim-easymotion is a famous plugin used in vim, and hop.nvim is an alternative in neovim.

As the movivation of hop.vim says below:

Motivation

Hop is a complete from-scratch rewrite of EasyMotion, a famous plugin to enhance the native motions of Vim. Even though EasyMotion is usable in Neovim, it suffers from a few drawbacks making it not comfortable to use with Neovim version >0.5 – at least at the time of writing these lines:

EasyMotion uses an old trick to annotate jump targets by saving the contents of the buffer, replacing it with the highlighted annotations and then restoring the initial buffer after jump. This trick is dangerous as it will change the contents of your buffer. A UI plugin should never do anything to existing buffers’ contents.
Because the contents of buffers will temporarily change, other parts of the editor and/or plugins relying on buffer change events will react and will go mad. An example is the internal LSP client implementation of Neovim >0.5 or its treesitter native implementation. For LSP, it means that the connected LSP server will receive a buffer with the jump target annotations… not ideal.
Hop is a modern take implementing this concept for the latest versions of Neovim.

The drawback of EasyMotion in Vim is that virtual text cannot be overlaid on top of the actual text. However, Neovim does support this feature.

https://github.com/lukas-reineke/indent-blankline.nvim also uses this feature.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/15007/2169654775@github.com>

Christian Brabandt

unread,
Jun 15, 2024, 9:42:20 AM (12 days ago) Jun 15
to vim/vim, Subscribed

so, can you show an example/screenshot what exactly this does?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/15007/2169657156@github.com>

Yggdroot

unread,
Jun 15, 2024, 10:23:11 AM (12 days ago) Jun 15
to vim/vim, Subscribed

2.gif (view on web)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/15007/2169763579@github.com>

Reply all
Reply to author
Forward
0 new messages