triptych.nvim icon indicating copy to clipboard operation
triptych.nvim copied to clipboard

Error when trying to delete file/folder

Open chphungphat opened this issue 1 year ago • 2 comments

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

  • Open triptych
  • Delete a file or folder by pressing d

Setup

  • Operating system: Ubuntu 24.04
  • Nvim version: 0.10.0
  • Triptych config
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,
}

chphungphat avatar Jun 16 '24 23:06 chphungphat

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

BobbyGerace avatar Aug 07 '24 12:08 BobbyGerace

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

simonmclean avatar Aug 11 '24 14:08 simonmclean

It's working for me! Thanks

BobbyGerace avatar Aug 12 '24 00:08 BobbyGerace