Skip to content

Add Neorg equivalent of Emacs' org-fill-paragraph #1749

@melindachang

Description

@melindachang

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

Vim already has gw and gq to hard-wrap text to the value of textwidth, which seem to be functionally identical to Emacs' fill-paragraph. See the docs.

Emacs also has an editor command in org-mode called org-fill-paragraph. It performs the hard-wrapping in a way that's compatible with the org standard (i.e., doesn't wrap headings, metadata...), such that you can highlight and fill the entire document. Here's the implementation. It would be very nice for QOL to have some module in Neorg that does the same.

A few requirements that come to mind:

  • Should skip headlines (i.e., no introducing line breaks or wrapping onto previous lines)
  • Should wrap hyperlinks by displayed text, not the full address
  • Should not wrap anything (?) enclosed in block indicators like @code <lang> or @document.meta

Help

Yes

Implementation help

Am willing to develop a module myself when I'm free, but I thought I would post in case anyone else is interested in getting this operational on a shorter timeline. Not super familiar with the entire Neorg spec, either - would appreciate additional suggestions for what to integrate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIssues related to feature proposals. Please attach a module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions