Outlining: Extend the convenience "Enter → un-indent" to text selection

Use case or problem

I like current behavior where additional presses of Enter within indented (nested) list
first reduce indentation of automatically added itemization mark (hyphen)
before producing new lines.
Issue: when some text is selected, then this convenience does not work, Enter deletes selected text instead.

I am never deleting selected text by pressing Enter. Currently do not see any case where the behavior suggested below would cause problem. Please, mention if you know counter examples.

Proposed solution

I would be interested in trying complementary behavior where:

  • If some text (containing indentation) is selected, then press of Enter reduces indentation of the selection.

Reasons / motivation:

  • Consistency with pressing Enter in indented empty list-item.
  • Simple press of Enter key is easier than coordinated pressing of Shift+Tab.

Avoid sudden deletion of selection after the repeated press of Enter removes all indentation.
E.g. add new line after the block of (partially) selected lines and put cursor there (cancel the selection but do not delete the selected text).


key-words: deindent, nested list, outliner, outlining, remove indentation, unindent

2 Likes

Seconded… it is not terribly common, but occasionally I will start a list, one list item will end up with dozens/hundreds of nested child items, and I realize “oh crap, this should have been a header with its own list under it”, and I have no recourse but to make heavy use of the down arrow key + Delete to remove the resulting broken indentation. I did eventually build a macro for this but it often breaks other stuff. Would be a great addition to the command palette.

With a block of text selected:

  • Tab to indent block
  • Shift+Tab un-indent block
1 Like

The above is the way to go. Hitting enter to undent a selection is very unnatural.

@cerement I know of these shortcuts. In fact I mentioned Shift+Tab under Proposed solution in the feature request above. But you are right, as WhiteNoise confirms it solves the issue which kennnnnneth had.

@WhiteNoise Before introduction in Obsidian, “Hitting enter to undent a line which contains only hyphen” was also unnatural for me but now I use it all the time in Obsidian. Thanks for this feature.

This request is not about creating hotkeys for indentation management. It is about unification/extension of current behavior to cases when text is selected.

Use-case:

I have mouse / graphical tablet with Enter mapped to one of it’s buttons.
When organizing notes into nested lists, I can press Tab by left hand to nest line or selected text. Or I can press Enter by the right hand, while keeping right hand on mouse in order to select and drag portions of text. Now Enter “unnests” as desired except when text is selected.

  • Simple press of Enter key is easier than coordinated pressing of Shift+Tab.

It saves less than one second but over time it adds up.
I do not have that many buttons available to dedicate another one only to Shift+Tab.

@WhiteNoise question: Perhaps it would be more appropriate to realize by some plugin. Could plugins realize such behavior? I am not familiar with writing plugins and with their limits.

That’s not unnatural and other sw do it (Especially Outliners). Because you already are in an empty line of list, what enter should do is either 1) create a full empty line, 2) create another empty line at the same level, or move the current empty line that you not using one level below.

The behavior of enter when there is text in a line and/or is select is a different game.

I am gonna move this to plugin ideas. This can be done with plugins.

2 Likes