@@ -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)
269271end
270272
271273M .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 )
274277end
275278
@@ -606,7 +609,8 @@ M.help_vert = function(selected, opts)
606609end
607610
608611M .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" )
610614end
611615
612616local function mantags (s )
@@ -622,7 +626,8 @@ M.man_vert = function(selected)
622626end
623627
624628M .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" )
626631end
627632
628633M .git_switch = function (selected , opts )
0 commit comments