Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Keyboard shortcut to move current line/selection up or down, like in most code editors, iawriter, microsoft word
-
Is it possible to create a workflow to move the current line (or all lines containing a selection, if there is a selection) up or down? If so, how? This is a feature that exists in most programming editors and is really handy. It is also a feature of iawriter, Word, and OneNote. It would be great to have it here. Cut-and-paste gets really old when you have a long series of lines that you have to reorganize manually.
-
Have you seen the "arrange paragaraphs" mode (in the
Aa
popup)? It adds drag handles to every line, so you can rearrange them using drag'n'drop. -
That's cool, although there's a bit of disconnect — it's easy to drag the wrong handle, and you have to sweep your eyes from the text in the center of the screen to the handles at the edge of the screen. Plus you have to take your hand off the keyboard.
The handles can feel very effortful to use in the worst scenarios. They're especially difficult to use if the paragraphs take up only one line of text each. A keyboard shortcut on the other hand would feel effortless. I quite love this app and just wish for this one feature 😞.
-
It would be possible to build a workflow for moving paragraphs, and then assigning a keyboard shortcut to it. I don't think anyone has done this so far though.
-
I did put together a workflow like this, but never published it— I originally thought a shortcut would be useful when using an external keyboard, but went through a phase of trying to minimalist my workflow list, and decided to rely on the existing drag handles instead. If I’ve got it archived anywhere, I’ll post it... (but please don’t hold breath in anticipation!)
-
Up: http://www.editorial-workflows.com/workflow/5900873318268928/jTSfUw5xcs8
Down: http://www.editorial-workflows.com/workflow/5812251499954176/gxIFRX9kMvICouldn't find the originals, so put these together. Could be improved, but should offer a basic solution. I love the fact that Editorial allows you to put this kind of thing together so quickly!
-
Update: V2 auto-indents individual items with respects to header levels. Also maintains selection so you can fire the shortcut repeatedly in quick succession (doh!)...
Up: http://www.editorial-workflows.com/workflow/5900619277664256/SONfDKRJ4VM
Down: http://www.editorial-workflows.com/workflow/5910247084392448/sEf36J2wCuY -
Hey neat! I will try it out in a while and report back.
-
@jsamlarose47
I've tried the v2, they work really well. Really happy with this.I'd like to throw in some bonus requests: Would it be possible for the script to auto-deselect if the script started without selected text, but preserve selection if there was a starting selection? (How about preserving the cursor position within the moved line? I don't know if that's too much to ask.)
-
A little 'bug' i noticed just now: the second line in the document cannot be moved up to first place position.
Would it also be possible to make it as nondestructive as possible, ie., to preserve any whitespace characters at the beginning of the line? V2 of the script removes any indentation.
-
Glad they work for you. ;)
- Auto-deselect if nothing's been selected: pretty easily done (updates now available via v2 links previously posted).
- Cursor position in line: that's a little more challenging for me. Range math in Editorial hurts my brain.
- First line / last line bugs: noted that in v1, but shouldn't be a problem in v2. Can you confirm you were using v2 when you saw this issue?
- Non-destructive handling of items: v2 tries to be a bit smarter about indents. I acknowledged in the description that If you select a block of text that doesn't have a # in it (very simple check for markdown/taskpaper headers), the workflow will trim whitespace from each item/line and attempt to reconstruct indents depending on where the block is moved to. Admittedly not so good for blocks of items with variable indentation. Workaround for now: insert a # anywhere in the block you want to move to skip any trimming— that'll just move the blocks as they are.
-
Hey @jsamlarose47 , thanks for the fixes! They work great, and they’re very useful now as they are. Sorry I got back just now — busy with work travel.
Anyway, I can confirm that the first line/last line bug is still there (in the version that has auto-deselect if there’s no selection.) It’s more obvious if the first line is not just whitespace — cannot move second line up to first line position. Not a big deal though. Thank you!