Open Rizhiy opened 5 days ago
The obsidian style. Would be great if we could have this feature
Last time I tried it was very VERY buggy.
I am going to try again later to see if I can do something.
Maybe this feature better suited to be in Neovim core?
Maybe this feature better suited to be in Neovim core?
Neovim core already has this. You can check it by setting the conceallevel
to 2.
The only issue is it doesn't hide virtual text
. So things like inline code
, link
have the same text shown twice.
I found a workaround for this, at least for markdown wiki links and md links.
I placed this in my after/ftplugin/markdown.lua
vim.api.nvim_create_autocmd("CursorMoved", {
buffer = vim.api.nvim_get_current_buf(),
callback = function()
if vim.fn.mode():sub(1, 1) == "i" then
return
end
local cursor = vim.api.nvim_win_get_cursor(0)
local line = vim.fn.getline(cursor[1])
local is_wiki_link = line:match("%[%[.*%]%]")
if is_wiki_link then
vim.o.concealcursor = ""
return
end
local is_md_link = line:match("%[.*%]%(.*%)")
if is_md_link then
vim.o.concealcursor = ""
return
end
-- local is_todo = line:match("- %[.%]")
-- if is_todo then
-- vim.o.concealcursor = ""
-- return
-- end
vim.o.concealcursor = "n"
end,
})
Currently, when I enter insert mode, the whole file changes the conceal level. What would be better is if only the current line changed the level of conceal, or perhaps the current "context", e.g. code block.