Skip to content

Commit a4fc4eb

Browse files
taeruhvhyrro
authored andcommitted
fix: call tostring on paths
1 parent ddd63b5 commit a4fc4eb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lua/telescope/_extensions/neorg/insert_file_link.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ local function generate_links()
4343

4444
local ts = neorg.modules.get_module("core.integrations.treesitter")
4545

46+
local workspace_offset = #tostring(files[1]) + 1
47+
4648
for _, file in pairs(files[2]) do
4749
local bufnr = dirman.get_file_bufnr(file)
4850

@@ -59,8 +61,8 @@ local function generate_links()
5961
if vim.api.nvim_get_current_buf() ~= bufnr then
6062
local links = {
6163
file = file,
62-
display = "$" .. file:sub(#files[1] + 1, -1) .. title_display,
63-
relative = file:sub(#files[1] + 1, -1):sub(0, -6),
64+
display = "$" .. file:sub(workspace_offset, -1) .. title_display,
65+
relative = file:sub(workspace_offset, -1):sub(0, -6),
6466
title = title,
6567
}
6668
table.insert(res, links)

lua/telescope/_extensions/neorg/insert_link.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ local function get_linkables(bufnr, file, workspace)
3535

3636
local lines
3737
if file then
38-
lines = vim.fn.readfile(file)
38+
lines = vim.fn.readfile(tostring(file))
3939
file = file:gsub(".norg", "")
4040
file = "$" .. file:sub(#workspace + 1, -1)
4141
else

0 commit comments

Comments
 (0)