Skip to content

Commit 1b0f6ae

Browse files
committed
feat(conceal): Conceal links in fold text
1 parent 27c4083 commit 1b0f6ae

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

lua/orgmode/org/indent.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,21 @@ end
9292

9393
local function foldtext()
9494
local line = vim.fn.getline(vim.v.foldstart)
95+
9596
if config.org_hide_leading_stars then
96-
return vim.fn.substitute(line, '\\(^\\*\\+\\)', '\\=repeat(" ", len(submatch(0))-1) . "*"', '')
97-
.. config.org_ellipsis
97+
line = vim.fn.substitute(line, '\\(^\\*\\+\\)', '\\=repeat(" ", len(submatch(0))-1) . "*"', '')
98+
end
99+
100+
if vim.opt.conceallevel:get() > 0 then
101+
line = string.gsub(line, '%[%[(.-)%]%[?(.-)%]%]$', function(link, text)
102+
if text == '' then
103+
return link
104+
else
105+
return text
106+
end
107+
end)
98108
end
109+
99110
return line .. config.org_ellipsis
100111
end
101112

0 commit comments

Comments
 (0)