Skip to content

Commit

Permalink
fix: support for file paths containing special characters (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
obaland committed Mar 14, 2023
1 parent 00c6c93 commit 17d673c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions lua/vfiler/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ end
-- Rerform auto cd
function Context:perform_auto_cd()
if self.options.auto_cd then
vim.fn.execute('lcd ' .. self.root.path, 'silent')
vim.fn.execute('lcd ' .. vim.fn.fnameescape(self.root.path), 'silent')
end
end

Expand Down Expand Up @@ -274,10 +274,6 @@ end
---@param dirpath string
function Context:switch(dirpath)
dirpath = core.path.normalize(dirpath)
-- perform auto cd
if self.options.auto_cd then
vim.fn.execute('lcd ' .. dirpath, 'silent')
end

-- reload git status
local job = self:_reload_gitstatus_job(dirpath)
Expand All @@ -288,6 +284,7 @@ function Context:switch(dirpath)
if job then
job:wait()
end
self:perform_auto_cd()
return path
end

Expand Down
3 changes: 1 addition & 2 deletions lua/vfiler/libs/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function M.window.open(layout, file)
end

if file then
command = command .. ' ' .. file
command = command .. ' ' .. vim.fn.fnameescape(file)
end
local ok = pcall(vim.command, command)
return ok
Expand Down Expand Up @@ -417,7 +417,6 @@ function M.table.inspect(t, level, indent)
indent = indent or 0
for key, value in pairs(t) do
local info = ('%s %s : %s'):format(('-'):rep(indent), key, value)
print(info)
if type(value) == 'table' and level > 0 then
M.table.inspect(value, level - 1, indent + 1)
end
Expand Down

0 comments on commit 17d673c

Please sign in to comment.