@@ -305,6 +305,7 @@ M.open_file = function(state, path, open_cmd)
305305 end
306306
307307 if M .truthy (path ) then
308+ local escaped_path = vim .fn .fnameescape (path )
308309 local events = require (" neo-tree.events" )
309310 local event_result = events .fire_event (events .FILE_OPEN_REQUESTED , {
310311 state = state ,
@@ -316,7 +317,7 @@ M.open_file = function(state, path, open_cmd)
316317 return
317318 end
318319 if state .current_position == " current" then
319- vim .cmd (open_cmd .. " " .. path )
320+ vim .cmd (open_cmd .. " " .. escaped_path )
320321 else
321322 -- use last window if possible
322323 local suitable_window_found = false
@@ -348,10 +349,10 @@ M.open_file = function(state, path, open_cmd)
348349 -- Neo-tree must be the only window, restore it's status as a sidebar
349350 local winid = vim .api .nvim_get_current_win ()
350351 local width = M .get_value (state , " window.width" , 40 )
351- vim .cmd (" vsplit " .. path )
352+ vim .cmd (" vsplit " .. escaped_path )
352353 vim .api .nvim_win_set_width (winid , width )
353354 else
354- vim .cmd (open_cmd .. " " .. path )
355+ vim .cmd (open_cmd .. " " .. escaped_path )
355356 end
356357 end
357358 events .fire_event (events .FILE_OPENED , path )
0 commit comments