autolist.nvim icon indicating copy to clipboard operation
autolist.nvim copied to clipboard

[Feature]: Neorg support

Open ignamartinoli opened this issue 3 years ago • 3 comments
trafficstars

There is a project with a syntax really similar to Markdown called Neorg.

It would be nice to have support for that.

ignamartinoli avatar Oct 18 '22 19:10 ignamartinoli

Yeah I’ve been thinking about that, but the style of list would require quite a bit of modification to the code. This would mean that it would also support asciidoc, but I gotta revise for exams, might give it some thought after.

gaoDean avatar Oct 18 '22 20:10 gaoDean

Ohh, they have good support for tree sitter. That would make things easier.

gaoDean avatar Oct 18 '22 20:10 gaoDean

I would say, there's no rush. Neorg is an interesting project but far from finished, this suggestion can wait until you're more free. Your exams are the priority, don't worry, I hope you do well on them :wink:

ignamartinoli avatar Oct 18 '22 21:10 ignamartinoli

Sorry for the response time, idk if you can do this in the current autolist.nvim version (you are welcome to try?) but if you add the following into your config file you can make the "new" function work.

  list_patterns = { -- custom list types: see README -> Configuration -> defining custom lists
    norg_1 = "%-",
    norg_2 = "%-%-",
    norg_3 = "%-%-%-",
    norg_4 = "%-%-%-%-",
    norg_5 = "%-%-%-%-%-",
    unordered = "[-+*]", -- - + *
    digit = "%d+[.)]", -- 1. 2. 3.
    ascii = "%a[.)]", -- a) b) c)
    roman = "%u*[.)]", -- I. II. III.
    latex_item = "\\item",
  },
  lists = { -- configures list behavio
    -- Each key in lists represents a filetype.
    -- The value is a table of all the list patterns that the filetype implements.
    -- See how to define your custom list below
    -- You can see a few preloaded options in the default configuration such as "unordered" and "digit"
    -- of which the full set you can find in the config.list_patterns
    -- You must put the file name for the filetype, not the file extension
    -- To get the "file name", it is just =:set filetype?= or =:se ft?=.
    markdown = {
      "unordered",
      "digit",
      "ascii", -- specifies activate the ascii list type for markdown files
      "roman", -- see below on the list types
    },
    text = {
      "unordered",
      "digit",
      "ascii",
      "roman",
    },
    norg = { -- has to be reversed to work
        "norg_5",
        "norg_4",
        "norg_3",
        "norg_2",
        "norg_1",
    },
    tex = { "latex_item" },
    plaintex = { "latex_item" },
  },

(its quite a crude solution but it works i guess)

Just copy in the norg parts and you should be good to go. If it doesn't work, try version v3.0.0 (#72) with the very descriptive branch name "refac".

gaoDean avatar Apr 20 '23 22:04 gaoDean

Just curious, what is the point of the neorg type lists? its just harder to parse. I have gone to the dark side and use org-mode very often, i think the standard lists are fine?...

gaoDean avatar Apr 20 '23 22:04 gaoDean

also is set ft? return norg or neorg? i have commited changes to v3.0.0 to have this neorg support as well.

gaoDean avatar Apr 20 '23 22:04 gaoDean

:set ft? returns filetype=norg.

For lists I think it uses -, the Neorg concealer then converts it to a bullet.

I need to finish some work, after that I'm trying the configuration snippet you gave me :D

ignamartinoli avatar Apr 20 '23 23:04 ignamartinoli

Actually can you just try the 3.0.0 version? Should be less of a hassle. (see v3.0.0 readme for details on setup)

gaoDean avatar Apr 23 '23 22:04 gaoDean