Skip to content

Commit acf2040

Browse files
committed
Escape filenames passed to tabedit/edit/split/vsplit commands. Fixes #143
1 parent cb0631c commit acf2040

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lua/carbon/init.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function carbon.tabe()
160160
view.execute(function(ctx)
161161
view.handle_sidebar_or_float()
162162
vim.cmd.tabedit({
163-
ctx.cursor.line.entry.path,
163+
vim.fn.fnameescape(ctx.cursor.line.entry.path),
164164
mods = { keepalt = #vim.fn.getreg('#') ~= 0 },
165165
})
166166
end)
@@ -177,7 +177,7 @@ function carbon.edit()
177177
else
178178
view.handle_sidebar_or_float()
179179
vim.cmd.edit({
180-
ctx.cursor.line.entry.path,
180+
vim.fn.fnameescape(ctx.cursor.line.entry.path),
181181
mods = { keepalt = #vim.fn.getreg('#') ~= 0 },
182182
})
183183
end
@@ -192,7 +192,7 @@ function carbon.split()
192192
end
193193

194194
view.handle_sidebar_or_float()
195-
vim.cmd.split(ctx.cursor.line.entry.path)
195+
vim.cmd.split(vim.fn.fnameescape(ctx.cursor.line.entry.path))
196196
end
197197
end)
198198
end
@@ -205,7 +205,7 @@ function carbon.vsplit()
205205
end
206206

207207
view.handle_sidebar_or_float()
208-
vim.cmd.vsplit(ctx.cursor.line.entry.path)
208+
vim.cmd.vsplit(vim.fn.fnameescape(ctx.cursor.line.entry.path))
209209
end
210210
end)
211211
end

0 commit comments

Comments
 (0)