Skip to content

Floating nvim-tree + update_focused_file gives error #20

@Cliffback

Description

@Cliffback

When using nvim-tree.lua-float-preview with nvim-tree in the split screen configuration (like in #14), I get this when closing nvim-tree

Error executing Lua callback: ...e/nvim-modular/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:223: Failed to switch to window 1008                                                                                  
stack traceback:                                                                                                                                                                                                
        [C]: in function 'nvim_set_current_win'                                                                                                                                                                 
        ...e/nvim-modular/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:223: in function 'close'                                                                                                                    
        ...e/nvim-modular/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:235: in function 'close_this_tab_only'                                                                                                      
        ...e/nvim-modular/lazy/nvim-tree.lua/lua/nvim-tree/view.lua:248: in function 'close'                                                                                                                    
        ...lazy/nvim-tree.lua/lua/nvim-tree/actions/tree/toggle.lua:45: in function 'toggle'                                                                                                                    
        ...im-modular/lazy/nvim-tree.lua/lua/nvim-tree/commands.lua:36: in function <...im-modular/lazy/nvim-tree.lua/lua/nvim-tree/commands.lua:35>

the on_attach for nvim-tree is configured like this:

local api = require "nvim-tree.api"

  local FloatPreview = require("float-preview")
  FloatPreview.attach_nvimtree(bufnr)

  local function opts(desc)
    return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
  end

  local close_wrap = FloatPreview.close_wrap

If I wrap the functions in the close_wrap, the error won't show up, but I have defined a global keymap for :NvimTreeToggle, and that will throw the error regardless. I can perphaps wrap the keymap with the close_wrap globally, but it still won't really solve the issue, just bypass it.

Is there known solution to this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions