simonmclean / triptych.nvim

Directory browser plugin for Neovim, inspired by Ranger
Apache License 2.0
160 stars 4 forks source link

Error when trying to delete file/folder #55

Closed chphungphat closed 1 month ago

chphungphat commented 3 months ago

Bug description Delete a file/folder in triptych window give the following error, regardless the file being open or not:

Error executing vim.schedule lua callback: ...cal/share/nvim/lazy/triptych.nvim/lua/triptych/float.lua:67: Invalid window id: 1002
stack traceback:
        [C]: in function 'nvim_win_call'
        ...cal/share/nvim/lazy/triptych.nvim/lua/triptych/float.lua:67: in function 'win_set_title'
        ...ocal/share/nvim/lazy/triptych.nvim/lua/triptych/view.lua:264: in function 'set_primary_and_parent_window_targets'
        ...ocal/share/nvim/lazy/triptych.nvim/lua/triptych/view.lua:467: in function 'refresh_view'
        ...ocal/share/nvim/lazy/triptych.nvim/lua/triptych/init.lua:105: in function 'refresh_view'
        ...l/share/nvim/lazy/triptych.nvim/lua/triptych/actions.lua:32: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Steps to reproduce

return {
    "simonmclean/triptych.nvim",
    dependencies = {
        "nvim-lua/plenary.nvim",
        "nvim-tree/nvim-web-devicons",
    },
    config = function()
        require("triptych").setup({
            mappings = {
                show_help = "g?",
                jump_to_cwd = ".", -- Pressing again will toggle back
                nav_left = "h",
                nav_right = { "l", "<CR>" }, -- If target is a file, opens the file in-place
                open_hsplit = { "-" },
                open_vsplit = { "|" },
                open_tab = { "<C-t>" },
                cd = "<leader>cd",
                delete = "d",
                add = "a",
                copy = "c",
                rename = "r",
                cut = "x",
                paste = "p",
                quit = "q",
                toggle_hidden = "<leader>.",
            },
            extension_mappings = {
                ["<C-f>"] = {
                    mode = "n",
                    fn = function(target, _)
                        require("telescope.builtin").live_grep({ search_dirs = { target.path } })
                    end,
                },
            },
        })

        vim.keymap.set("n", "<leader>t", "<cmd>Triptych<CR>", { desc = "Toggle Triptych", silent = true })
    end,
}
BobbyGerace commented 1 month ago

I am having the same problem and I think it's because I'm using the telescope ui-select extension, which seems to close the triptych window when it opens. When I remove that plugin it works correctly

simonmclean commented 1 month ago

I've merged a change which should fix this. Let me know how it goes

BobbyGerace commented 1 month ago

It's working for me! Thanks