Move "blocks" up and down like an IDE

It’s already possible to move a list item up and down in a list with the “swap line up/down” shortcut, but if I do that, the child-items stay put.
I want to be able to move the entire list item with the children up and down.

More than that, I want to be able to move paragraphs up and down the same way. In fact, I want to be able to move headings with all the subheadings up and down the same way – If I move a H4 up or down, it should swap places with the next H4 and bring with it all the text, images, H5s, H6s and so on.

Preferably this should be a separate feature from the swap line up/down shortcuts - semantically, they’re completely different.

Is this possible to do with a plugin? I haven’t really used Javascript since 2014, and I have never even looked at making a plugin, so I have no idea, but I assume this would be quite easy if the Markdown files are loaded in an AST when editing…?

3 Likes

You can move headers around in the outline.

A paragraph is just a line (unless you’ve broken it up with single line breaks), so that already works with “swap line”.

If small, select the relevant section and use “swap line” .

If you have Settings > Editor > Fold heading and Fold indent enabled, you can collapse a list or section and “swap” or cut-paste it.

And as Dor says, you can move headers in the outline (but only on desktop, unfortunately).

(PS. “swap line” will be renamed to “move line” in a future release).

Thanks for the suggestions - I know they’re meant to be helpful, but I’m rather set in my ways. I spend most of my days writing code, and this is how I think about it - plus I have RSI, so I want to use my keyboard.

It’s really just a question of how difficult it would be to make a plugin - I don’t want to change my workflow. :slight_smile:

1 Like

I just discovered this by accident: GitHub - vslinko/obsidian-outliner: Work with your lists like in Workflowy or RoamResearch
This covers the list use-case, so this is quite a bit less important to me now :partying_face:

4 Likes