Kate: keyboard shortcut to move a line up or down

VSCode and GNOME Text Editor let you move a whole line up or down with the shortcuts Alt and Alt . I could not find out how to enable this in Kate.

It’s useful when you use a “todo.txt” file and want to move tasks around; and also when coding.

The shortcuts are called “Move Lines Up” and “Move Lines Down”.

For me the defaults seem to be CTRL+SHIFT+UP and CTRL+SHIFT+DOWN

3 Likes

first, your best friend is the Help→Find Action menu

once in there you can search for “line” or “move” or “up” and perhaps you’ll find what you’re looking for

3 Likes

That’s a good shortcut to remember;

F10 (Menu) H for Help This reveals that the ‘interactive’ ‘Find Action’ is available via direct shortcut:

Find Action

CtrlAlti is an excellent one to engrave… as many actions are a bit niche to ascribe or remember keyboard shortcuts.

Keyboard Shortcuts

Also (the way I’ve been doing it - as I never found ‘find Actions’ before):
Ctrl ⇧ Shift , (comma) type ‘move line’ - to see, or edit, or assign your own keyboard shortcut. It won’t do the action directly, but it’s a way to help adjust shortcuts more to your taste (or find out why it’s a bad idea; like losing Alt_S function in Konsole if you set it for something else).

I would suggest that this is the better solution - as it helps find out WHY your keyboard shortcut isn’t available, what IS available, and enables you to change them to your liking interactively with warnings about any clashes.

The “Alt+Up” shortcut is ambiguous with the following shortcut.
Do you want to assign an empty shortcut to this action?
Shortcut ‘Alt+Up’ for action ‘Previous Document’

Basically meaning that your shortcut is defined for Previous Document - you can set it and clear ‘Previous Document’ if you think that’s more useful.

So really, the final answer/solution is there - remember shortcuts with the Comma for KDE Plasma for settings/keyboard shortcuts (Alt or Shift)

Alt and Alt are useable, if you don’t want them for ‘Previous’ or ‘Next’ Document.

:light_bulb: Thanks for this - I learned something new today!

In this instance, I prefer the idea of adding ‘SHIFT’ for a kind of ‘DRAG’ concept to drag the line up or down in Kate… I don’t have the need for an advanced ‘prev/next’ option though, so I’d say OP should consider just going with Alt up/down anyway.

2 Likes