Skip to content

Commit f339a7f

Browse files
Merge pull request #191 from levouh/conceal-folded-links
2 parents 27c4083 + 033121a commit f339a7f

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 and string.find(line, '[[', 1, true) 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)