Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error opening plenary.nvim popups: E592: 'winwidth' cannot be smaller than 'winminwidth' #138

Closed
Leandros opened this issue Oct 4, 2023 · 16 comments · Fixed by #140
Closed

Comments

@Leandros
Copy link

Leandros commented Oct 4, 2023

Steps to reproduce:

  1. Open nvim nvim -u vimrc (minimal vimrc below)
  2. Trigger a plenary.nvim popup with <leader>fg (<leader> is configured to be <space>)
  3. Observe the error from below.

I figured out that

autoresize = {
  minwidth = 80,
},

is the source of the error, once the minwidth is removed, no error is thrown.

Minimal Vimrc:

(using vundle for package management)

set nocompatible " be iMproved, required
filetype off     " required

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath

set background=dark

" Vundle Stuff
if has("win32") || has("win16")
    call plug#begin('$HOME/vimfiles/bundle/')
else
    call plug#begin('~/.vim/bundle')
endif

" Set mapleader before plugin loads
nnoremap <SPACE> <Nop>
let mapleader=" "
let maplocalleader=" "

if has('nvim')
    " Libraries
    Plug 'kyazdani42/nvim-web-devicons'
    Plug 'nvim-lua/plenary.nvim'               " Lua library

    Plug 'nvim-focus/focus.nvim'

    " Telescope
    Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' } " Improved LSP actions
    Plug 'nvim-telescope/telescope-live-grep-args.nvim'
    Plug 'nvim-telescope/telescope-ui-select.nvim' " Use telescope as native vim select popup, required from NVIM v0.7.0
    Plug 'nvim-telescope/telescope-fzy-native.nvim'
endif

call plug#end()

" =============================================================================
" Telescope
" =============================================================================
lua << EOF
local actions = require 'telescope.actions'
local lga_actions = require("telescope-live-grep-args.actions")
require('telescope').setup {}
require('telescope').load_extension('live_grep_args')
EOF

nnoremap <leader>fg <cmd>lua require('telescope').extensions.live_grep_args.live_grep_args()<cr>


" =============================================================================
" focus.nvim
" =============================================================================
lua <<EOF
require("focus").setup({
    enable = true, -- Enable module
    autoresize = {
      minwidth = 80, -- this is the culprit, once the `minwidth` is removed, no error is thrown.
    },
})
EOF

NeoVim Version:

NVIM v0.9.2
Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Full Error:

E5108: Error executing lua ...tarv/.vim/bundle/plenary.nvim/lua/plenary/popup/init.lua:408: WinEnter Autocommands for "*": Vim(append):Error executin
g lua callback: ...arv/.vim/bundle/focus.nvim/lua/focus/modules/resizer.lua:82: E592: 'winwidth' cannot be smaller than 'winminwidth'
stack traceback:
        [C]: in function '__newindex'
        ...arv/.vim/bundle/focus.nvim/lua/focus/modules/resizer.lua:82: in function 'split_resizer'
        .../home/gerstarv/.vim/bundle/focus.nvim/lua/focus/init.lua:97: in function 'resize'
        ...arv/.vim/bundle/focus.nvim/lua/focus/modules/autocmd.lua:43: in function <...arv/.vim/bundle/focus.nvim/lua/focus/modules/autocmd.lua:37>
        [C]: in function 'nvim_set_current_win'
        ...tarv/.vim/bundle/plenary.nvim/lua/plenary/popup/init.lua:408: in function 'create'
        ...arv/.vim/bundle/telescope.nvim/lua/telescope/pickers.lua:331: in function '_create_window'
        ...arv/.vim/bundle/telescope.nvim/lua/telescope/pickers.lua:401: in function 'find'
        ...p-args.nvim/lua/telescope/_extensions/live_grep_args.lua:79: in function 'live_grep_args'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'nvim_set_current_win'
        ...tarv/.vim/bundle/plenary.nvim/lua/plenary/popup/init.lua:408: in function 'create'
        ...arv/.vim/bundle/telescope.nvim/lua/telescope/pickers.lua:331: in function '_create_window'
        ...arv/.vim/bundle/telescope.nvim/lua/telescope/pickers.lua:401: in function 'find'
        ...p-args.nvim/lua/telescope/_extensions/live_grep_args.lua:79: in function 'live_grep_args'
        [string ":lua"]:1: in main chunk
@rustysec
Copy link

rustysec commented Oct 9, 2023

I am also experiencing this 😭

@Leandros
Copy link
Author

@rustysec, as a workaround, you can remove minwidth until it's fixed.

@rustysec
Copy link

I took it out, but telescope still causes the error 🤷‍♂️ I haven't spent any time trying to debug it at this point, maybe I will have some time later.

@willothy
Copy link
Collaborator

I will try to look into this today, definitely important to get this working ASAP. I haven't been able to reproduce without the minwidth property set though, not sure what would be causing that.

@rustysec
Copy link

I'm using it inside my lazyvim config, the telescope error pops without any setup params or with the defaults minus the minwidth property. I can try to debug it a bit more this evening.

@willothy
Copy link
Collaborator

I'm using it inside my lazyvim config, the telescope error pops without any setup params or with the defaults minus the minwidth property. I can try to debug it a bit more this evening.

Sounds good, thanks!

@Leandros
Copy link
Author

It's working. Brilliant! Thank you.

@simonlearnscoding
Copy link

I am still experiencing this issue with all popup windows does anyone have a fix for this?

@cryptomilk
Copy link
Collaborator

cryptomilk commented Jan 8, 2024

Do you use master? Can you provide a reproducer?

Here is a minimal config file you can modify. Save as repro.lua and run with nvim -u repro.lua. Once you have a reproducer create a tarball of the ~/.repro directory:

-- DO NOT change the paths and don't remove focus :-)
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/nvim-focus/focus.nvim", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "nvim-focus/focus.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

require('focus').setup()
-- add anything else here

@Martin1887
Copy link

I have checked that the problem keeps happening in sessions created with the latest version when restoring sessions early after opening Neovim. This is more noticeable in weak processors like ARM, when typically around 5 seconds must be waited before restoring the session to not get the error.

Apart from the notification message, the result is barbar buffers are not loaded in my case.

Note: I have set lazy=false in focus.nvim configuration to load it as soon as possible.

Thanks!

@cryptomilk
Copy link
Collaborator

a) This issue is already closed as it has been fixed, if you're running into a new issue please create a new bug
b) Please create a minimal reproducer, see https://github.com/nvim-focus/focus.nvim/tree/master/extras

@Martin1887
Copy link

OK, I'm busy now but I will open a new issue in a couple of weeks, thanks.

@xzbdmw
Copy link
Contributor

xzbdmw commented Feb 18, 2024

I've followed this advise still have same issue
Shatur/neovim-session-manager#47 (comment)
for me, the scrolloff is set to 0 after restore sessions.

@Martin1887
Copy link

I have tried to reproduce it using the repro.lua without success, but I have read the session files and I have noticed that removing the forced set winwidth=1 of those files fixes the issue. I don't know which thing is setting them though, because it does not happen in the repro.lua file loading persisted and focus.

Thanks!

@xzbdmw
Copy link
Contributor

xzbdmw commented Mar 4, 2024

I have tried to reproduce it using the repro.lua without success, but I have read the session files and I have noticed that removing the forced set winwidth=1 of those files fixes the issue. I don't know which thing is setting them though, because it does not happen in the repro.lua file loading persisted and focus.

Thanks!

Maybe you are using lazyvim? They set minwidth default option as I mentioned in readme in recent pr, you can try comment out that setting in lazyvim’s option.lua.

@Martin1887
Copy link

Exactly, I use LazyVim and they set winminwidth=5 in LazyVim/LazyVim@4c2ac6b (I don't know why).

Setting it to 0 in options.lua fixes the issue, I will report it in LazyVim repository.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants