Friday, April 13, 2012

balloonexpr depending on line content

I want to make a balloonexpr which shows something different depending
on the context of the thing being pointed at.

I tried to make it depend on the syntax of the item being pointed at,
and this mostly works. But it breaks when the user has multiple
windows open, because synID only gets the syntax of the current
window, and the user might point the mouse at a non-current window.

I cannot even piece apart the line being pointed at to determine the
context manually, because getline() only acts on the current buffer,
which similarly may not be what the user is pointing at.

balloonexpr has v:beval_winnr and v:beval_bufnr, but switching windows
or buffers is not allowed, because you can't do anything with "side
effects". So I'm not sure what good these do.

Incidentally, the value of v:beval_winnr seems to be a zero-based
index whereas the actual window number used for Vim commands and
functions is one-based. E.g. while pointing at the topleftmost window,
v:beval_winnr is zero. Is this a bug or am I missing something here?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: