Merge pull request #151 from davvid/absolute-paths

harpoon.ui: handle absolute paths
This commit is contained in:
ThePrimeagen 2022-02-14 13:00:49 -07:00 committed by GitHub
commit b5cc65c731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,11 @@ function M.nav_file(id)
end
local mark = Marked.get_marked_file(idx)
local buf_id = vim.fn.bufnr(vim.fn.getcwd() .. "/" .. mark.filename, true)
local filename = mark.filename
if filename:sub(1, 1) ~= "/" then
filename = vim.loop.cwd() .. "/" .. mark.filename
end
local buf_id = vim.fn.bufnr(filename, true)
local set_row = not vim.api.nvim_buf_is_loaded(buf_id)
vim.api.nvim_set_current_buf(buf_id)