Skip to content
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 syntax highlighting? #1616

Closed
2 tasks done
lcpichette opened this issue Dec 13, 2024 · 3 comments
Closed
2 tasks done

No syntax highlighting? #1616

lcpichette opened this issue Dec 13, 2024 · 3 comments
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.

Comments

@lcpichette
Copy link

Prerequisites

  • I am using the latest stable release of Neovim
  • I am using the latest version of the plugin

Neovim Version

NVIM v0.10.2, Build type: Release, LuaJIT 2.1.1732813678

Neorg setup

Using Astronvim, so this is just a package represented in: lua/plugins/neorg.lua:

return {
  -- Other plugin specifications
  {
    "nvim-neorg/neorg",
    build = ":Neorg sync-parsers",
    dependencies = { "nvim-lua/plenary.nvim", "luarocks.nvim" },
    config = function()
      -- Neorg setup
      require("neorg").setup {
        load = {
          ["core.defaults"] = {}, -- Loads default behavior
          ["core.concealer"] = {}, -- Adds pretty icons to your documents
          ["core.dirman"] = { -- Manages Neorg workspaces
            config = {
              workspaces = {
                notes = "~/neorg/notes",
              },
            },
          },
          ["core.keybinds"] = { -- Configure keybindings
            config = {
              default_keybinds = false, -- Disable default keybindings
              neorg_leader = "<Leader>n", -- Set Neorg leader key
              hook = function(keybinds)
                keybinds.map_event_to_mode("norg", {
                  n = { -- Normal mode
                    { "nn", "core.norg.dirman.new.note" },
                    { "nt", "core.norg.qol.todo_items.todo.task_done" },
                    -- Add more custom mappings here
                  },
                  i = { -- Insert mode
                    -- Insert mode mappings
                  },
                }, {
                  silent = true,
                  noremap = true,
                })
              end,
            },
          },
        },
      }
    end,
  },
}

I have luarocks installed via brew
2024-12-12@19 02 02 December-12@2x

I figured maybe this was an issue with neovim expecting luarocks as a neovim plugin when instead its installed via brew, so I also have a ~/.config/nvim/lua/plugins/luarocks.lua file:

return {
  "vhyrro/luarocks.nvim",
  priority = 1000,
  config = true,
}

Alas, the issue persists.

Trying to install neorg via luarocks is unsuccessful, but various tutorials online didn't even attempt this. Figured I'd show the results regardless -- but it does fail as [email protected] is expected for the latest install of luarocks via brew, but plenary.nvim only supports up to [email protected]. Again, I don't think this is the issue but figured it was worth mentioning!
2024-12-12@19 28 03 December-12@2x

:TSInstall norg does work and I do have it installed. I am running MacOS and have upgraded my gcc.

Actual behavior

Here's what :Neorg workspace notes looks like for me (mostly markdown not yet converted to new norg syntax yet, as I had just gotten done installing it! But Daily Notes should be the correct title syntax):
2024-12-12@19 02 07 December-12@2x

Expected behavior

There should be different syntax highlighting. Here we see a lot of markdown, as I've just pasted my working notes to an norg file. But you'll see the title Daily Notes should be of the correct title syntax. Yet, no syntax highlighting

Steps to reproduce

  1. MacOS Neovim 0.10.2 LuaJIT 2.1.1732813678
  2. Astronvim
  3. brew install luarocks
  4. :TSInstall norg
  5. See neorg setup for 2 packages
  6. Also, my nvim config is up-to-date at: https://github.com/lcpichette/nvim-config

Potentially conflicting plugins

No response

Other information

No response

Help

None

Implementation help

No response

@lcpichette lcpichette added the bug Issues related to bugs. Please attach a severity, a priority and category with this label. label Dec 13, 2024
@github-project-automation github-project-automation bot moved this to added-updated-reopened in sorting neorg issue tracker Dec 13, 2024
@max397574
Copy link
Contributor

perhaps just try out a proper norg file?

@lcpichette
Copy link
Author

@max397574 "Proper" is vague. It has a .norg extension, it does have some correct syntax highlighting. But For the sake of the argument I've deleted the entire contents of this index.norg and just added viable syntax. Still getting the same error

2024-12-12@23 56 14 December-12@2x

@lcpichette
Copy link
Author

lcpichette commented Dec 13, 2024

I did NOT have the correct syntax for the index.norg file. I needed to add a @end to the meta section. Once I did that the syntax highlighting was correct!

A silly but reasonable error given I just started learning what norg files are.

I'd like to apologize for the waste of time Max, and thank you for looking into the issue and (correctly) informing me as to what the issue was.

Maybe others which face this same issue in the future can just run start a boilerplate .norg file with the following (proven correct) syntax to see if this issue is also theirs:

@title: Daily Notes
@description: Converted from .md to Neorg format.
@end

* Daily Notes

- [x] Task 1
- [ ] Task 2

2024-12-13@10 57 37 December-13@2x

I also appreciate the empty-nature of a new .norg file, but I know that for me personally I wouldn't have been confused if A) I had just done more research before posting this comment, and B) if there had been some boilerplate meta in there which activates and shows the correct syntax highlighting (then if I change it and it breaks I know it's not an issue with my setup, but instead, an issue with how I modiified the file). Something like:

@title: New Note
@end

@github-project-automation github-project-automation bot moved this from added-updated-reopened to done in sorting neorg issue tracker Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues related to bugs. Please attach a severity, a priority and category with this label.
Projects
None yet
Development

No branches or pull requests

2 participants