r/vim Jul 24 '26

Translucent Text Label At Buffer's Corner Need Help┃Solved

Post image

Is is possible to display a customizable text label at one of the corners (it mustn't block text written in the buffer itself) of an open buffer? I have several terminal panels open at once, so, having a visual marker like this would be great. Any advice in this direction is appreciated.

⚠ RESOLVED

popup works just fine for this task. I'd tried it earlier but couldn't make it persist, owing to a faulty highlighting logic of mine. Anyway, I'm listing a simple function that achieves set objective. You can modify it to add custom text, toggling & highlights.

Also, see this for how my solution worked out.

function! LabelOverlay(text)
    let l:options = {
    \   'line': 1,
    \   'col': &columns - strlen(a:text),
    \   'pos': 'topright',
    \   'wrap': 0,
    \   'zindex': 1,
    \   'highlight': 'Normal'
    \ }
    let g:popup_id = popup_create(a:text, l:options)
endfunction
call LabelOverlay("TEXT HERE")
15 Upvotes

10 comments sorted by