nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.35k stars 209 forks source link

fix(promo): promote/demote range + keybinds #1487

Closed benlubas closed 2 months ago

benlubas commented 3 months ago

what it says on the tin. These were broken/removed a while ago. Presumably due to concealer changes but I'm not sure. Someone asked about bringing them back today, so here they are.

The re-indentation code in this module seems to struggle a little though. Not sure what's up with that.

mtrajano commented 3 months ago

Looks to be working fine for me. Tried indenting several nested lists with no problem, what issues did you run into re: the indentation?

vhyrro commented 3 months ago

@mtrajano the issue stems from e.g. paragraphs. It seems that the indentation is cumulative: with the following snippet:

* One
** Two
     content.

Doing a ranged promotion indents the paragraph twice as far:

** One
*** Two
              content.

This isn't the absolute end of the world, but would be nice to have fixed somehow :thinking:

edit: wow, github rendering makes the indentation look really bad in the code block. it's less bad in a Norg buffer haha

benlubas commented 3 months ago

@mtrajano @vhyrro

Now this behaves itself a little better. There is still one behavior that might be unexpected. If you promote:

* heading
  Normal text

Normal text is correctly indented. But if you promote:

normal text
- list item

Then "normal text" is indented, while "list item" is promoted. However, this case:

- list

new paragraph
- new list

"new paragraph" is not indented.


I think this behavior is fine. It allows visual >/< to still work like normal in norg documents when you don't highlight anything promote-able. And if you only highlight the things you want to promote without extra paragraphs, there's no problem with it.

mtrajano commented 3 months ago

Changes make sense to make, there's just a random print statement there

vhyrro commented 3 months ago

@benlubas the new behaviour is much better than what we had previously, so that sounds good enough for the time being. Running out of time today, but I'll revisit this PR tomorrow :)