-
-
Notifications
You must be signed in to change notification settings - Fork 159
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for filetype-specific styling options #251
Comments
I'm not sold on adding this functionality into our theme itself due to the potential cost of autocmds and such but I tried this locally and think you could pull it off: vim.api.nvim_create_autocmd({ "BufEnter" }, {
callback = function()
local italic = false
if vim.bo.filetype == "markdown" then
italic = true
end
require("rose-pine").setup({
styles = { italic = italic },
})
end,
}) You may want to do your own research on autocmds and such as I believe you will want to assign a group to the autocmd to prevent duplication. Hopping between my init.lua and a readme.md successfully toggles italic on and off, however. Hope this helps. |
The solution works well for regular filetypes like Markdown, but the problem is that Norg is a custom filetype provided by the Neorg plugin. Using autocmds doesn't seem to work for Norg buffers. Considering the popularity of the Neorg plugin, maybe there is a reason to add specific support for it, especially since the customization problem with other filetypes is basically resolved at this point, which could potentially lessen the overhead of approaching the problem. But at the same maybe it's something that should be solved from the side of Neorg. P.S I had to slightly modify your code by adding 'vim.cmd('colorscheme rose-pine')':
|
After reading more about Neorg it looks like it should set the filetype but others are having issues (see nvim-neorg/neorg#937). This comment has a fix that may help. |
Nah, i think it's not the same thing, because in case of norg, it's not just about bold and italic rendering, the whole rendering of Neorg breaks because of the autocmd. So i'm willing to think it's not that easy to fix because Neorg's rendering is more complex. |
I've tried to set norg type manually, it doesn't help. |
Are you able to provide some highlight groups from a Neorg file? For example, if you would want Personally, I disable italic via Edit: This probably won't be useful for embedded language highlighting if they provide that but could at least highlight intentionally italic or bold text. |
Running ':Inspect' on italic character gives this: Treesitter
|
In that case, you should be able do: require('rose-pine').setup({
highlight_groups = {
['@neorg.markup.italic.norg'] = { italic = true }
}
}) |
Yep, it looks like it actually works, big thanks! |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the solution you'd like
Currently i'm able to set global styling options for bold and italic text. I dont' like them in a code so i turned them off, but i would like to be able to enable them for specific filetypes where it makes more sense like norg or markdown.
Additional context
No response
The text was updated successfully, but these errors were encountered: