Skip to content

Commit 6340494

Browse files
authored
fix: open files under cwd with relative name (#693)
1 parent bbfa7cb commit 6340494

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lua/oil/adapters/files.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ M.normalize_url = function(url, callback)
277277
local norm_path = util.addslash(fs.os_to_posix_path(realpath))
278278
callback(scheme .. norm_path)
279279
else
280-
callback(realpath)
280+
callback(vim.fn.fnamemodify(realpath, ":."))
281281
end
282282
end)
283283
)

tests/files_spec.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,6 @@ a.describe("files adapter", function()
168168
test_util.wait_for_autocmd("BufReadPost")
169169
assert.equals("ruby", vim.bo.filetype)
170170
assert.equals(vim.fn.fnamemodify(tmpdir.path, ":p") .. "file.rb", vim.api.nvim_buf_get_name(0))
171+
assert.equals(tmpdir.path .. "/file.rb", vim.fn.bufname())
171172
end)
172173
end)

0 commit comments

Comments
 (0)