Replace the legacy &keywordprg commands using :term by system() calls showing up in below popup.
Just leaving here for reference. It's easy to do for programs showing a static single page help, say perldoc, go doc, ... Maybe a bit more involved for those navigating manpages.
vim9script
# Shows popup window at cursor position
def ShowAtCursor(text: any, Setup: func(number) = null_function): number
var new_text = text
if text->type() == v:t_string
new_text = text->trim("\<CR>")
else
new_text = text->mapnew((_, v) => v->trim("\<CR>"))
endif
var winid = popup_create(new_text, {
padding: [0, 1, 0, 1],
border: [],
borderchars: popup_borderchars,
borderhighlight: popup_borderhighlight,
highlight: popup_highlight,
pos: screencol() > &columns / 1.7 ? "botright" : "botleft",
line: 'cursor-1',
col: 'cursor',
moved: 'WORD',
mapping: 0,
filter: (winid, key) => {
if key == "\<Space>"
win_execute(winid, "normal! \<C-d>\<C-d>")
return true
elseif key == "j"
win_execute(winid, "normal! \<C-d>")
return true
elseif key == "k"
win_execute(winid, "normal! \<C-u>")
return true
elseif key == "g"
win_execute(winid, "normal! gg")
return true
elseif key == "G"
win_execute(winid, "normal! G")
return true
endif
if key == "\<ESC>"
popup_close(winid)
return true
endif
return true
}
})
if Setup != null_function
Setup(winid)
endif
return winid
enddef
def PopupHelp(symbol: string)
ShowAtCursor(systemlist("go doc " .. symbol))
enddef
nnoremap <silent><buffer> K <scriptcmd>PopupHelp(expand("<cfile>"))<CR>
Originally posted by @habamax in #16911 (comment)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It should have these defined as well (used in the function):
var popup_borderchars = get(g:, "popup_borderchars", ['─', '│', '─', '│', '┌', '┐', '┘', '└'])
var popup_borderhighlight = get(g:, "popup_borderhighlight", ['Normal'])
var popup_highlight = get(g:, "popup_highlight", 'Normal')
If there is a need I can add set of helper popup functions: https://github.com/habamax/.vim/blob/master/autoload/popup.vim#L1-L1
Or just a single one ShowAtCursor.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
popup.Commands is useful to create a small popup with single key shortcuts: https://github.com/habamax/.vim/blob/master/autoload/popup.vim#L12-L26
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
popup.Select is useful to create popup with a list of thing to select from and do something with it: https://github.com/habamax/.vim/blob/master/autoload/popup.vim#L134-L169
vim-fzzy-basic.gif (view on web)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I am happy both to add it to dist/ it or not to add it :)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Just leaving here for reference. It's easy to do for programs showing a static single page help, say perldoc, go doc, ... Maybe a bit more involved for those navigating manpages.
What about just using popup-terminal?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I think popup window keywordprg would help with previewing a quickfix list entry, which should be very useful
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
A quickfix list entry popup is useful, as these plug-ins testify, though seemingly already useful enough by previewing the surrounding lines of selected quickfix list entry, that is, the currently selected line in the quickfix list window. How would a popup window for a specific keyword in a quickfix list entry enhance that?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
How would a popup window for a specific keyword in a quickfix list entry enhance that?
It would still be a "preview current entry" command. Assigning it to 'keywordprg' is just to avoid remapping K
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
One really valuable thing about :terminal windows (or “normal” windows like from :Man or reading system outputs): I can navigate between then, yank and put text, and search them. I can also keep arrange them for reference while editing.
Popups lack much of this ability in their current incarnation as far as I can tell.
With that in mind, I still mostly prefer regular windows (although I do configure my LSP client to show popups!), so I want to decide which I use.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
popup.Commandsis useful to create a small popup with single key shortcuts: https://github.com/habamax/.vim/blob/master/autoload/popup.vim#L12-L26
You may be interested in https://github.com/benknoble/popsikey
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Popups lack much of this ability in their current incarnation as far as I can tell.
Then I think Vim popup should be improved, since Nvim's floatwin can do that easily. There is an issue tracking it #5639
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
But
There is an explicit exception for a terminal in a popup
according to #7555 (comment)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Popups lack much of this ability in their current incarnation as far as I can tell.
Another problem with popups is, if you don't messageopt-=hit-enter and messageopt+=wait:10000 and get a message/error while popup is visible;
popup/vim will appear stuck not responding to keys - when in reality behind the scenes its waiting for "ENTER" in the message window.
So save/restore &messageopt before display and in callback is how i fixed that. But its not obvious when you start using it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This deserves its own issue and needs fixture
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()