junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.7k stars 1.9k forks source link

vim-plug buffer inside popup window #1247

Closed YuFei29 closed 11 months ago

YuFei29 commented 1 year ago

Hello, everyone. I wonder how can I open vim-plug buffer inside a popup window? I mean after PlugInstall I can get a popup window like this

Screenshot 2023-07-15 at 13 22 36

I know there's a g:plug_window option, I searched vim help, seems like it only support normal window (vertical and horizontal). No functional enhancements, just aesthetic considerations, I want this.

benjaminchristie commented 11 months ago

A solution using lua:

    local w = [[width = math.ceil(vim.api.nvim_get_option("columns") * 0.8), ]]
    local h = [[height = math.ceil(vim.api.nvim_get_option("lines") * 0.8), ]]
    local r = [[col = math.ceil(vim.api.nvim_get_option("columns") * 0.1 - 1), ]]
    local c = [[row = math.ceil(vim.api.nvim_get_option("lines") * 0.1 - 1), ]]
    local floating_opts = [[relative = 'editor', style='minimal', border = "single"]]
    vim.g.plug_window = [[lua vim.api.nvim_open_win(vim.api.nvim_create_buf(true, false), true, {]] ..
        w .. h .. r .. c .. floating_opts .. "})"
    vim.cmd("PlugUpdate")
--- reset to default vim-plug behavior after opening in new window
    vim.fn.timer_start(5000, function()
        vim.g.plug_window = [[vertical topleft new]]
    end)
YuFei29 commented 11 months ago

thanks for your reply, but I use vim. seems like your solution based on neovim. anyway, thank you

junegunn commented 11 months ago

If I'm not mistaken, this is not possible due to the limitation of popup window of Vim. You can't put cursor on it.

See https://github.com/vim/vim/pull/7555.

YuFei29 commented 11 months ago

Thank you for pointing that out. I think I may have been mistaken. I vaguely recall seeing vim-plug pinned in a floating window in vim, so I must have remembered incorrectly. I probably implemented that previously when I trying out neovim.