-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
No highlighting in org file #481
Comments
Update: I think this may be a lazy.nvim issue, because I do get highlighting when I use you're minimal_init.lua file. I am opening an issue at lazy.nvim and will close this if someone has a solution there. |
Ok, never mind, I think the problem was that I didn't have |
I'm also using lazy.nvim without any issues, so it might be some configuration issue. I do have that additional vim regex highlights. I'll check how it behaves without it |
I managed to reproduce it. It seems it's caused by some bad order of loading the plugins. I'm using I think there are 2 solutions to this:
I would suggest to go with first solution because I know for sure it works. Second one can bug sometimes if you open up Telescope too quickly. |
Hmm...for me, I have noticed however that lazily loading the orgmode plugin (i.e. |
|
Not sure if this is related, but might be a hint. |
@g0t0wasd does the problem disappear, when you remove the date entries? |
No, I did additional testing and it seems, like it is not related to the date entries. This is example of a file which I have. It works quite slow, but manages to eventually get highlighted. Similar but bigger file breaks highlighting completely
|
I assume this is the body of a heading? What syntax highlighting are you expecting beyond the timestamps? |
I have no heading in this file at all. As for highlighting I need only timestamps. The problems is that this file hangs nvim, while opens properly in Emacs |
Did you try with the minimal_init.lua? I can open it just fine
|
Tried with minimal_init.lua - gives same result: |
What nvim version are you using? Did you try the Also: what operating system are you on? |
Nvim 0.8.0 |
Ok, now we're talking. Things are definitely starting to break on my end. I'll keep you posted. Thanks for the file 👍 |
Any progress on this? I'm using AstroNvim which uses Lazy to manage plugins. I haven't landed on a way to successfully configure nvim-orgmode. The error I get is "no parser for 'org' language". I'd love to see a description of a configuration that works from someone else using Lazy. |
@mvolkmann I'm actually using Lazy as a package manager. Here's my orgmode configuration: https://github.com/kristijanhusak/neovim-config/blob/master/nvim/lua/partials/plugins/orgmode.lua It is a bit tricky to set it up with Lazy, but this works for me. Further investigation is needed. |
Thanks! I copied your configuration. When I start nvim I get this: Error detected while processing User Autocommands for "AstroMasonLspSetup"..FileType Autocommands for "org": I must need to install something additional. |
Do you have your configuration somewhere public so I can look at it? |
Yes. It is at https://github.com/mvolkmann/MyUnixEnv. See the Part of the code in tree-sitter.lua is commented out for now. But I tried with that uncommented. See .config/nvim/lua/user/plugins/tree-sitter.lua |
@mvolkmann You are missing this part: require('orgmode').setup_ts_grammar() I have it defined here https://github.com/kristijanhusak/neovim-config/blob/master/nvim/lua/partials/plugins/treesitter.lua#L13 |
That is on line 28 in my tree-sitter.lua file. The block it is inside is
currently commented out, but I get the error I described when I uncomment
that block.
…On Fri, May 5, 2023 at 10:08 AM Kristijan Husak ***@***.***> wrote:
@mvolkmann <https://github.com/mvolkmann> You are missing this part:
require('orgmode').setup_ts_grammar()
I have it defined here
https://github.com/kristijanhusak/neovim-config/blob/master/nvim/lua/partials/plugins/treesitter.lua#L13
—
Reply to this email directly, view it on GitHub
<#481 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATLUAFC6DQJYMAE33IDWDXEUJXLANCNFSM6AAAAAATRGX6P4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
R. Mark Volkmann
Object Computing, Inc.
|
Did you run |
I just now ran `:TSUpdate`, uncommented that block of code in my
`tree-sitter.lua` file, and restarted nvim. That certainly changed things!
Now when I open a `.org` file I get the following error which doesn't
include any of my files in the stack trace. Do you have any ideas about
what could cause this?
Error detected while processing User Autocommands for
"AstroMasonLspSetup"..FileType Autocommands for "*":
Error executing lua callback: vim/keymap.lua:0: E31: No such mapping
stack traceback:
[C]: in function 'nvim_buf_del_keymap'
vim/keymap.lua: in function 'del'
...treesitter/lua/nvim-treesitter/incremental_selection.lua:168: in
function 'detach'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:522: in
function 'detach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:531: in
function 'reattach_module'
...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:133: in
function <...vim/lazy/nvim-treesitter/lua/nvim-treesitter/configs.lua:132>
[C]: in function 'nvim_exec_autocmds'
...volkmannm/.config/nvim/lua/plugins/configs/lspconfig.lua:28: in
function <...volkmannm/.config/nvim/lua/plugins/configs/lspconfig.lua:26>
[C]: in function 'nvim_exec_autocmds'
/Users/volkmannm/.config/nvim/lua/astronvim/utils/init.lua:120: in
function </Users/volkmannm/.config/nvim/lua/astronvim/utils/init.lua:120>
…On Fri, May 5, 2023 at 10:17 AM Kristijan Husak ***@***.***> wrote:
Did you run :TSUpdate to install the parser? Also I can't find a call to
orgmode setup, it's maybe somewhere else.
—
Reply to this email directly, view it on GitHub
<#481 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATLUBLVLUF64D5MQWN4CDXEUKXJANCNFSM6AAAAAATRGX6P4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
R. Mark Volkmann
Object Computing, Inc.
|
For now I have gotten past the error by commenting out the following line in my function M.event(event) |
@mvolkmann you have some treesitter configs which you didn't install plugin for, maybe textobjects or refactor. Put only necessary things in the treesitter config. |
hello sir i facing a intersting kinda behavior relating to this i am using lunarvim with {'nvim-orgmode/orgmode',
lazy=false,
dependencies = {
'nvim-treesitter/nvim-treesitter'
},
config = function()
require('orgmode').setup_ts_grammar()
require('orgmode').setup{
org_agenda_files = {'~/org/*'},
org_default_notes_file = '~/org/refile.org',
}
end
}, highlighting only work when org document has a #+BEGIN_SRC and #+END_SRCwhen i open the file with
it do proper syntax highlighting but when i open
there is not sytax highlighting execpt the == block the highlight is working finw with minimal init.lua demo |
so it turn out |
@Aneeqasif I can't reproduce this, with or without |
as i have mentioned it worked totally fine with minimal.lua , it collapsed with some preconfigured distributions like lazyvim and lunarvim, i am on lunarvim you can try this on lunarvim or lazyvim to see the effect of `additional_vim_regex_highlighting |
I add this line return {
{
"nvim-orgmode/orgmode",
dependencies = {
{
"nvim-treesitter/nvim-treesitter",
lazy = true,
config = function() end,
},
},
event = { "LazyFile", "VeryLazy" },
config = function()
-- Load treesitter grammar for org
require("orgmode").setup_ts_grammar()
-- Setup orgmode
require("orgmode").setup({
org_agenda_files = "~/org/**/*",
org_default_notes_file = "~/org/tutorial.org",
})
require("nvim-treesitter.configs").setup({
highlight = {
enable = true,
additional_vim_regex_highlighting = { "org" },
},
ensure_installed = { "org" }, -- Or run :TSUpdate org
})
end,
},
{
"hrsh7th/nvim-cmp",
config = function()
require("cmp").setup({
sources = {
{ name = "orgmode" },
},
})
end,
},
} |
It is worth mentioning that |
I recently updated my orgmode install and got no highlighting, specifically when I run I traced it all back to commit 5baf0c5:
If I roll back to 82d6d94 syntax highlighting works fine, e.g. # Syntax
* OrgHeadlineLevel1 -> **OrgHeadlineLevel1**
* OrgKeywordFaceDOING -> **OrgKeywordFaceDOING** In the rolled back version highlighting works regardless of the lazy loading setting for orgmode (I have it set to On the taking a lot of CPU to highlight a file - this was happening to me when I was enabling the additinoal regex highlighting - so I was not using it. And I see it's not in the current suggested config anymore. Hope this helps 👍 |
I added short snippet in the notice about changing these, in case someone wants to use old highlights: #217 (comment) |
Ok thanks will do 👍 But shouldn't |
@gerazov do you get anything if you do Edit: https://github.com/nvim-treesitter/playground?tab=readme-ov-file#deprecation-notice |
i am sad to say but due bugs in this package and the sane philosophy behind orgmode. I have joined hands with emacs forces and completely left neovim behind. Please dont curse on me. |
|
I've been using this plugin for years now and I can atest to it being really robust. There have not been any major hickups in my experience so far .. |
That's odd. Can you try running minimal_init.lua ( |
Tried and it broke my whole config 😅 I barely rolled back to my config. There was some easy way to change configs |
Minimal init should not have any impact on your config. It creates and loads everything from the You need to run minimal init like this:
|
@gerazov I pushed a fix on master. I missed that they changed the default treesitter highlight names between the v0.9 and v0.10.
Please give it a try once more. You can re-use the same |
It's the same - no coloring. |
Ok, please open up a separate issue and provide some details about your system, neovim version etc, and all the steps you take to get to this point, so I can check. |
I am not sure this is of any interest to you, but I had the same problem on a first time install. I am using a LunarVim distribution, and I could not get any coloring. I tried all the suggestions I found here, and the only one that fixed the issue was commenting out On the other hand, I also tried intalling the plugin on an NvChad installation, and there, nothing helps even though all functionalities are working and the highlght groups are present. I am not a neovim power user, so I am not providing very useful info I guess, but if I can provide some logs or anything like that, just ask, I will gladly help out. |
Thanks for the info @lyndhurst, this is helpful information. I'll give it a try with LunarVim and NvChad and see if I can make installation instructions clearer. |
I am glad if it could help a little . I have settled for Not sure how it impacts performance compared to 'VeryLazy', I have to read about that when I get the time, but I thought that would at least be easier on startup than nothing. |
Thank you @lyndhurst! I wrestled to get folding and syntax highlighting to work for some time, until found your post. Commenting out I've installed nvim stable 0.9.5 with bob. My init.lua: -- install plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
print("Installing 'folke/lazy.nvim'")
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- bootstrap packages
require("lazy").setup("plugins", {
ui = { border = "single" },
change_detection = {
enabled = false,
notify = false
}
})
Plugins:
orgmode.lua:
return {
"nvim-orgmode/orgmode",
event = "BufRead", -- replace VeryLazy, otherwise syntax highlighting won't work
config = function()
-- Setup orgmode
require("orgmode").setup({
-- org_agenda_files = "~/orgfiles/**/*",
org_agenda_files = "~/orgfiles/*",
org_default_notes_file = "~/orgfiles/refile.org",
})
-- NOTE: If you are using nvim-treesitter with `ensure_installed = "all"` option
-- add `org` to ignore_install
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = 'all',
-- ignore_install = { 'org' },
-- })
end,
} Syntax highlighting did work with |
@pyyhttu thanks for detailed instructions how to reproduce the issue. You can stick with return {
"nvim-orgmode/orgmode",
event = "VeryLazy",
ft = { 'org' },
config = function()
-- Setup orgmode
require("orgmode").setup({
-- org_agenda_files = "~/orgfiles/**/*",
org_agenda_files = "~/orgfiles/*",
org_default_notes_file = "~/orgfiles/refile.org",
})
-- NOTE: If you are using nvim-treesitter with `ensure_installed = "all"` option
-- add `org` to ignore_install
-- require('nvim-treesitter.configs').setup({
-- ensure_installed = 'all',
-- ignore_install = { 'org' },
-- })
end,
} I'll update readme and minimal init to have that. |
Docs and minimal init are updated. I'll leave this issue open for some time, and if no one reports anything in a couple of weeks I'll close it. |
@kristijanhusak I guess this can be closed? Haven't seen issues created on syntax highlighting being broken. |
Yeah I think it can be closed. If anyone gets some problems around highlighting, please open up a separate issue. |
Describe the bug
Just what the title says - when I open a .org file, there is no syntax highlighting whatsoever. Highlighting works for all other filetypes for which I have a parser installed, and, strangely enough, other treesitter functions like folding, incremental selection, and the treesitter playground work...but I still have no highlighting at all in org files.
Steps to reproduce
Literally just open an org file. Same results with
nvim file.org
from the shell and:e file.org
from within neovim, or using telescope, etc.Expected behavior
I get syntax highlighting for org files.
Emacs functionality
I'm not using emacs, but obviously this works lol.
Minimal init.lua
I'm using lazy.nvim. Here's my current config (pretty barebones right now because I stripped it down to try to diagnose the problem to no avail):
init.lua:
lua/plugins/treesitter.lua:
lua/plugins/orgmode.lua:
lua/plugins/onedark.lua:
These files should be irrelevent because they're just mappings and options (hence their names :-P), but here they are anyway:
mappings.lua:
options.lua:
Screenshots and recordings
No response
OS / Distro
Debian 11
Neovim version/commit
0.8.2
Additional context
As mentioned above, I'm using lazy.nvim, not packer. Not sure if that's relevent, but there you go ;-).
The text was updated successfully, but these errors were encountered: