Open hopezh opened 1 year ago
no parser for 'norg' language, see :help treesitter-parsers
do you have treesitter and the norg
parser installed?
Yes, I solved the norg
related issue by installing norg
in treesitter
. I also have markdown
installed in treesitter
, as shown below by running :TSModuleInfor
in neovim
:
However, I still can't get the highlight to work, as shown in the config file below, even after I changed the guibg
color for all three headers and code block to red
(#ff0000). It seems. only Headline3
is affected.
Did I specify the colors for headers and code block correctly in the config file?
My modifed lazyvim
config with headlines.nvim
installed is shown here.
headlines.lua
in the lua/plugins
folder:
return {
"lukas-reineke/headlines.nvim",
ft = "markdown",
event = "VeryLazy",
lazy = false,
dependencies = {
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("headlines").setup({
markdown = {
query = vim.treesitter.query.parse(
"markdown",
[[
(atx_heading [
(atx_h1_marker)
(atx_h2_marker)
(atx_h3_marker)
(atx_h4_marker)
(atx_h5_marker)
(atx_h6_marker)
] @headline)
(thematic_break) @dash
(fenced_code_block) @codeblock
(block_quote_marker) @quote
(block_quote (paragraph (inline (block_continuation) @quote)))
]]
),
headline_highlights = {
"Headline1",
"Headline2",
"Headline3",
},
codeblock_highlight = "CodeBlock",
dash_highlight = "Dash",
dash_string = "-",
quote_highlight = "Quote",
quote_string = "┃",
fat_headlines = true,
-- fat_headline_upper_string = "▃",
-- fat_headline_lower_string = "🬂",
fat_headline_upper_string = "-",
fat_headline_lower_string = "",
},
})
vim.cmd([[highlight Headline1 guibg=#ff0000]])
vim.cmd([[highlight Headline2 guibg=#ff0000]])
vim.cmd([[highlight Headline3 guibg=#ff0000]])
vim.cmd([[highlight CodeBlock guibg=#ff0000]])
vim.cmd([[highlight Dash guibg=#ff0000 gui=bold]])
end,
}
Ok, allow me to reply to myself.
I think I managed to make headlines.nvim
work, and for both .md
and .qmd
files, as shown in this post .
For normal markdown
.md
file:
For quarto
.qmd
file:
My updated /lua/plugins/headlines.lua
config is shown here.
Note that the colors for headlines and code block are defined in the /lua/config/options.lua file, rather than inside the headlines.nvim
file.
I got the following error after installing
headlines.nvim
:I'm unable to get any highlight for a simple
test.md
file:I'm using
lazy.nvim
to installheadlines.nvim
. My config fileheadlines.lua
is the default one, and it's put in thelua/plugins
folder of alazynvim
installation: