mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-05 06:54:36 +02:00
fix(markdown): disable headlines.nvim in insert mode. Fixes #2717
This commit is contained in:
parent
98c8226e21
commit
0ba731a879
1 changed files with 14 additions and 2 deletions
|
@ -82,8 +82,20 @@ return {
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- PERF: schedule to prevent headlines slowing down opening a file
|
-- PERF: schedule to prevent headlines slowing down opening a file
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
require("headlines").setup(opts)
|
local hl = require("headlines")
|
||||||
require("headlines").refresh()
|
hl.setup(opts)
|
||||||
|
local md = hl.config.markdown
|
||||||
|
hl.refresh()
|
||||||
|
|
||||||
|
-- Toggle markdown headlines on insert enter/leave
|
||||||
|
vim.api.nvim_create_autocmd({ "InsertEnter", "InsertLeave" }, {
|
||||||
|
callback = function(data)
|
||||||
|
if vim.bo.filetype == "markdown" then
|
||||||
|
hl.config.markdown = data.event == "InsertLeave" and md or nil
|
||||||
|
hl.refresh()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue