neorg icon indicating copy to clipboard operation
neorg copied to clipboard

Better softwrap for neorg lists

Open jghauser opened this issue 3 years ago • 1 comments

Issues

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

Feature description

Softwrap for neorg lists usually doesn't work well at all, but today I realised that it can be tremendously improved by setting the following options. I suggest neorg sets this automatically for the norg filetype.

Settings:

vim.opt_local.breakindentopt = 'list:-1'
vim.opt_local.formatlistpat = [[^\s*[-~\*]\+\s\+]]

Before: 20220215_21h41m37s_grim

After: 20220215_21h42m17s_grim

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

This should be easy to do. I can probably write a PR. Would you simply set this in a ftplugin/norg.lua or do u have some other way of setting this? Would you prefer a .lua or a .vim?

EDIT: changed formatlistpat to correctly handle headings and lines that start with *, -, or ~ but shouldn't be indented in softwrap.

jghauser avatar Feb 15 '22 20:02 jghauser

@vhyrro This seems a good idea, however I'm not sure this can be natively done with indenting, or is it separated

danymat avatar Feb 27 '22 17:02 danymat

Wow, this is one relic of the past :p

This has been fixed a long time back thanks to the indent engine, which handles the softwrapping in a more sophisticated manner as soon as the user presses <CR> or <Esc>. Closing!

vhyrro avatar Apr 29 '23 16:04 vhyrro