Skip to content

Commit

Permalink
fix: call tostring on paths
Browse files Browse the repository at this point in the history
  • Loading branch information
taeruh authored and vhyrro committed Apr 5, 2024
1 parent ddd63b5 commit a4fc4eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lua/telescope/_extensions/neorg/insert_file_link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ local function generate_links()

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

local workspace_offset = #tostring(files[1]) + 1

for _, file in pairs(files[2]) do
local bufnr = dirman.get_file_bufnr(file)

Expand All @@ -59,8 +61,8 @@ local function generate_links()
if vim.api.nvim_get_current_buf() ~= bufnr then
local links = {
file = file,
display = "$" .. file:sub(#files[1] + 1, -1) .. title_display,
relative = file:sub(#files[1] + 1, -1):sub(0, -6),
display = "$" .. file:sub(workspace_offset, -1) .. title_display,
relative = file:sub(workspace_offset, -1):sub(0, -6),
title = title,
}
table.insert(res, links)
Expand Down
2 changes: 1 addition & 1 deletion lua/telescope/_extensions/neorg/insert_link.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ local function get_linkables(bufnr, file, workspace)

local lines
if file then
lines = vim.fn.readfile(file)
lines = vim.fn.readfile(tostring(file))
file = file:gsub(".norg", "")
file = "$" .. file:sub(#workspace + 1, -1)
else
Expand Down

0 comments on commit a4fc4eb

Please sign in to comment.