In vim8 there is a popup window feature which seems like vscode peek definition. Often I use gF to go to file with particular line number. Is there a way to open a file in popup window?

  • 1
    Not what you want, but try this: :set pvp=height:10,width:60 | nno <key> :<c-u>pedit <c-r><c-p><cr>. Replace <key> with whatever key sequence you want. See :h preview-popup and :h c^r^p.
    – user938271
    Nov 6 '20 at 16:05
  • @user938271 to me that seems exactly what OP wants (didn't specify the ability to edit it..)
    – Mass
    Nov 6 '20 at 23:17
  • 1
    But it doesn't handle the line number; although, I guess it wouldn't be too difficult to support with a bit of Vim script.
    – user938271
    Nov 7 '20 at 4:32

You can use any of the popup_* functions that open popups with a buffer number, so,

let bufnr = bufadd(expand('<cfile>'))
let popup_id = popup_create (bufnr, {})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.