Skip to content

Commit 26dd5e3

Browse files
committed
feat(marks): use make_entry.file (#2658)
1 parent 1c983b3 commit 26dd5e3

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

lua/fzf-lua/previewer/builtin.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,8 +1507,7 @@ function Previewer.marks:parse_entry(entry_str)
15071507
filepath = api.nvim_buf_get_name(bufnr)
15081508
end
15091509
if #filepath > 0 then
1510-
filepath = vim.F.npcall(libuv.expand, filepath) or ""
1511-
filepath = path.relative_to(filepath, utils.cwd())
1510+
filepath = path.entry_to_file(filepath --[[@as string]], self.opts).path
15121511
end
15131512
return {
15141513
bufnr = bufnr,

lua/fzf-lua/providers/nvim.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local path = require "fzf-lua.path"
55
local utils = require "fzf-lua.utils"
66
local config = require "fzf-lua.config"
77
local devicons = require "fzf-lua.devicons"
8+
local make_entry = require "fzf-lua.make_entry"
89

910
local M = {}
1011

@@ -301,10 +302,7 @@ M.marks = function(opts)
301302
-- global marks
302303
for _, m in ipairs(vim.fn.getmarklist()) do
303304
local mark, bufnr, lnum, col, file = m.mark:sub(2, 2), m.pos[1], m.pos[2], m.pos[3], m.file
304-
file = path.relative_to(file, utils.cwd())
305-
if path.is_absolute(file) then
306-
file = path.HOME_to_tilde(file)
307-
end
305+
file = make_entry.file(file, opts)
308306
if bufnr == utils.CTX().bufnr then
309307
local text = vim.api.nvim_buf_get_lines(bufnr, lnum - 1, lnum, false)[1]
310308
add_mark(mark, lnum, col, utils.ansi_from_hl("Directory", text or "-invalid-"))

0 commit comments

Comments
 (0)