@@ -305,6 +305,7 @@ M.open_file = function(state, path, open_cmd)
305
305
end
306
306
307
307
if M .truthy (path ) then
308
+ local escaped_path = vim .fn .fnameescape (path )
308
309
local events = require (" neo-tree.events" )
309
310
local event_result = events .fire_event (events .FILE_OPEN_REQUESTED , {
310
311
state = state ,
@@ -316,7 +317,7 @@ M.open_file = function(state, path, open_cmd)
316
317
return
317
318
end
318
319
if state .current_position == " current" then
319
- vim .cmd (open_cmd .. " " .. path )
320
+ vim .cmd (open_cmd .. " " .. escaped_path )
320
321
else
321
322
-- use last window if possible
322
323
local suitable_window_found = false
@@ -348,10 +349,10 @@ M.open_file = function(state, path, open_cmd)
348
349
-- Neo-tree must be the only window, restore it's status as a sidebar
349
350
local winid = vim .api .nvim_get_current_win ()
350
351
local width = M .get_value (state , " window.width" , 40 )
351
- vim .cmd (" vsplit " .. path )
352
+ vim .cmd (" vsplit " .. escaped_path )
352
353
vim .api .nvim_win_set_width (winid , width )
353
354
else
354
- vim .cmd (open_cmd .. " " .. path )
355
+ vim .cmd (open_cmd .. " " .. escaped_path )
355
356
end
356
357
end
357
358
events .fire_event (events .FILE_OPENED , path )
0 commit comments