Skip to content

Commit

Permalink
fix: escape path when opened
Browse files Browse the repository at this point in the history
  • Loading branch information
otavioschwanck committed Mar 20, 2024
1 parent 56e9d8b commit 7e74ae3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lua/arrow/persist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,13 @@ function M.open_cache_file()
local close_buffer = ":lua vim.api.nvim_win_close(" .. winid .. ", {force = true})<CR>"
vim.api.nvim_buf_set_keymap(bufnr, "n", "q", close_buffer, { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Esc>", close_buffer, { noremap = true, silent = true })
vim.keymap.set(
"n",
config.getState("leader_key"),
close_buffer,
{ noremap = true, silent = true, buffer = bufnr }
)
vim.keymap.set("n", config.getState("leader_key"), close_buffer, { noremap = true, silent = true, buffer = bufnr })

vim.keymap.set("n", "<CR>", function()
local line = vim.api.nvim_get_current_line()

vim.api.nvim_win_close(winid, true)
vim.cmd(":edit " .. line)
vim.cmd(":edit " .. vim.fn.fnameescape(line))
end, { noremap = true, silent = true, buffer = bufnr })

vim.api.nvim_create_autocmd("BufLeave", {
Expand Down
3 changes: 3 additions & 0 deletions lua/arrow/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,14 @@ function M.openFile(fileNumber, previousFile)
else
if not fileName then
print("Invalid file number")

return
end

local action

fileName = vim.fn.fnameescape(fileName)

if vim.b.arrow_current_mode == "" or not vim.b.arrow_current_mode then
action = config.getState("open_action")
elseif vim.b.arrow_current_mode == "vertical_mode" then
Expand Down

0 comments on commit 7e74ae3

Please sign in to comment.