Skip to content

Commit 9dd089f

Browse files
committed
feat(actions): use tabnew instead of tab split
Closes #1785
1 parent 562593a commit 9dd089f

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

lua/fzf-lua/actions.lua

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,10 @@ M.vimcmd_entry = function(_vimcmd, selected, opts, pcall_vimcmd)
151151
end
152152
-- opts.__CTX isn't guaranteed by API users (#1414)
153153
local CTX = opts.__CTX or utils.CTX()
154-
local target_equals_current = entry.bufnr and entry.bufnr == CTX.bufnr
155-
or path.equals(fullpath, CTX.bname)
154+
local target_equals_current =
155+
(entry.bufnr and entry.bufnr == CTX.bufnr or path.equals(fullpath, CTX.bname))
156+
-- we open a new buffer on tabs so target is always different (#1785)
157+
and not _vimcmd:match("^tabnew")
156158
local vimcmd = (function()
157159
-- Do not execute "edit" commands if we already have the same buffer/file open
158160
-- or if we are dealing with a URI as it's open with `vim.lsp.util.show_document`
@@ -269,7 +271,8 @@ M.file_vsplit = function(selected, opts)
269271
end
270272

271273
M.file_tabedit = function(selected, opts)
272-
local vimcmd = "tab split | <auto>"
274+
-- local vimcmd = "tab split | <auto>"
275+
local vimcmd = "tabnew | setlocal bufhidden=wipe | <auto>"
273276
M.vimcmd_entry(vimcmd, selected, opts)
274277
end
275278

@@ -606,7 +609,8 @@ M.help_vert = function(selected, opts)
606609
end
607610

608611
M.help_tab = function(selected, opts)
609-
vim.cmd("tab help " .. helptags(selected, opts)[1])
612+
-- vim.cmd("tab help " .. helptags(selected, opts)[1])
613+
vim.cmd("tabnew | setlocal bufhidden=wipe | help " .. helptags(selected, opts)[1] .. " | only")
610614
end
611615

612616
local function mantags(s)
@@ -622,7 +626,8 @@ M.man_vert = function(selected)
622626
end
623627

624628
M.man_tab = function(selected)
625-
vim.cmd("tab Man " .. mantags(selected)[1])
629+
-- vim.cmd("tab Man " .. mantags(selected)[1])
630+
vim.cmd("tabnew | setlocal bufhidden=wipe | Man " .. mantags(selected)[1] .. " | only")
626631
end
627632

628633
M.git_switch = function(selected, opts)

0 commit comments

Comments
 (0)