file_switch_or_edit and buf_switch_or_edit only switches within the current window/tab? #1997
-
Hi, just trying to work out how these options work. Forgive me if I'm misunderstanding them. :) Let's say I have a.ts and b.ts open in a split in a tab, and c.ts open in a second tab:
Let's say I run But if I run Running Is there a way to combine these behaviours? Focus the existing open split if a file is already opened, and if it's not opened, open the file? I also want to accomplish this for the tabedit, split, and vsplit options. I've tried the following, but it exhibits the same behaviour as described above:
Looking at the implementation, maybe this requires a tabs + files command where tabs are preferred and it falls back to files if not found? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 14 replies
-
I know there's a |
Beta Was this translation helpful? Give feedback.
-
I test a bit, I think it work well: ['enter'] = function(sel, o)
local entry = require('fzf-lua.path').entry_to_file(sel[1], o, o._uri)
local fullpath = entry.bufname or entry.uri and entry.uri:match("^%a+://(.*)") or entry.path
vim.cmd(([[drop %s]]):format(fullpath))
end, |
Beta Was this translation helpful? Give feedback.
-
@dominickng Thanks for the snippet. It worked as expected for buffer switching, but the cursor is not jumping to the correct line when using Have you faced this or fixed this? Looks like not just buffers but other actions like blines, btags are also using the same mappings. I tried overriding everything after the setup, but btags keymap also gets updated. I don't know how to preserver the old keymaps for all other actions like btags, blines etc, while just overriding it for the files actions. |
Beta Was this translation helpful? Give feedback.
I test a bit, I think it work well: