@@ -204,8 +204,6 @@ M.vimcmd_entry = function(vimcmd, selected, opts, bufedit)
204204 (function ()
205205 -- Lua 5.1 goto compatiblity hack (function wrap)
206206 local entry = path .entry_to_file (sel , opts , opts ._uri )
207- -- "<none>" could be set by `autocmds`
208- if entry .path == " <none>" then return end
209207 local fullpath = entry .bufname
210208 or entry .uri and entry .uri :match (" ^[%a%-]+://(.*)" )
211209 or entry .path
@@ -216,17 +214,19 @@ M.vimcmd_entry = function(vimcmd, selected, opts, bufedit)
216214 -- technically we should never get to the `uv.cwd()` fallback
217215 fullpath = path .join ({ opts .cwd or opts ._cwd or utils .cwd (), fullpath })
218216 end
217+ -- Always open files relative to the current win/tab cwd (#1854)
218+ -- We normalize the path or Windows will fail with directories starting
219+ -- with special characters, for example "C:\app\(web)" will be translated
220+ -- by neovim to "c:\app(web)" (#1082)
221+ local relpath = path .normalize (path .relative_to (fullpath , utils .cwd ()))
222+ -- "<none>" could be set by `autocmds`
223+ if relpath == " <none>" then return end
219224 -- Can't be called from term window (for example, "reload" actions) due to
220225 -- nvim_exec2(): Vim(normal):Can't re-enter normal mode from terminal mode
221226 -- NOTE: we do not use `opts.__CTX.bufnr` as caller might be the fzf term
222227 if not utils .is_term_buffer (0 ) then
223228 vim .cmd (" normal! m`" )
224229 end
225- -- Always open files relative to the current win/tab cwd (#1854)
226- -- We normalize the path or Windows will fail with directories starting
227- -- with special characters, for example "C:\app\(web)" will be translated
228- -- by neovim to "c:\app(web)" (#1082)
229- local relpath = path .normalize (path .relative_to (fullpath , utils .cwd ()))
230230 if bufedit then
231231 local will_replace_curbuf = # vimcmd == 0 and not buf_edited (entry .bufnr , fullpath )
232232 if will_replace_curbuf then
0 commit comments