neorg icon indicating copy to clipboard operation
neorg copied to clipboard

Wrong formatting with nested lists

Open flexagoon opened this issue 1 year ago • 2 comments

Prerequisites

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

Neovim Version

NVIM v0.11.0-dev+18-g63e3a63d2

Neorg setup

    require("neorg").setup({
      load = {
        ["core.defaults"] = {},
        ["core.concealer"] = {},
      },
    })

Actual behavior

Nested lists are formatted to be a single line

Expected behavior

They should be properly wrapped and formatted

Steps to reproduce

Write the following:

- foo
-- bar

Execute gqip

The paragraph will be formatted like this:

- foo -- bar

Potentially conflicting plugins

No response

Other information

No response

Help

No

Implementation help

No response

flexagoon avatar May 21 '24 07:05 flexagoon

I don't think that neorg sets the format expression anywhere, and there is no norg lsp at the moment (so lsp format expression also wouldn't take effect). So it just falls back to default formatting which is controlled by text width.

Couple paths forward:

  • Just wait for LSP/external formatter to be built
  • implement a custom format expression (I'm already doing this in neorg-conceal-wrap, I could add this logic to that plugin)
  • you can use a custom text object for a list item, and use that instead of ip. This is less than ideal though if you want to format an entire group of bullets

benlubas avatar May 22 '24 13:05 benlubas

I could add this logic to that plugin

I did do this btw, but that plugin also formats based on concealed width obviously. benlubas/neorg-conceal-wrap

benlubas avatar Jun 07 '24 00:06 benlubas