-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
File opened in multiple tabs #3507
Comments
You can implement a custom command in lua for that. Add e.g. something like this to your init.lua: local micro = import("micro")
local config = import("micro/config")
local filepath = import("filepath")
function switchCmd(bp, args)
if #args < 1 then
return
end
local abspath = filepath.Abs(args[1])
local tabs = micro.Tabs()
if tabs ~= nil then
for i, t in tabs.List() do
for j, p in t.Panes() do
if p.Buf.Path ~= "" and p.Buf.AbsPath == abspath then
tabs:SetActive(i-1)
t:SetActive(j-1)
return
end
end
end
end
bp:NewTabCmd(args)
end
function init()
config.MakeCommand("switch", switchCmd, config.FileComplete)
end |
Thanks for your smart answer 🙏 Unfortunately doing so you don't change the behavior of And that's specifically my case now, I've done a plugin last week that you can find here (pull requeted in the plugin-channel (let me dream 😅)) to integrate Yazi with Micro. |
@RichardFevrier maybe you could use |
Can't make it work with |
I think |
Sorry I didn't mention yesterday that I tried IMO the last option is a big no, because the idea is to not ask every plugins developer to implement such check, it as to be backed into micro. But your initial idea of using a callback was cleaver, it just doesn't work in this case (maybe I did implement it wrong, |
Hi everyone 👋
Probably a skill issue but I can't find a way to prevent a file to be opened multiple times in different tabs and switch to the tab instead.
Thank you.
The text was updated successfully, but these errors were encountered: