8

I would like to do multi-line edits in KDevelop, similar to the column-edit in Visual Studio when alt is held, such that my cursor extends accross multiple lines, and each key I press is written to each line simultaneously.

This link seems to show that Kate has such a feature, and my understanding is that Kate is KDevelop's text-editing engine. However, when I use ctrl-shft-B to enter block editing mode, the cursor only appears at the bottom of the block and types onto a single line. Am I doing something wrong, or is multi-line editing not actually supported?

I'm currently using version 4.7.2

Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97

2 Answers2

12

After activating block editing mode you can select multiple lines by using the mouse or eg. Shift+Down. Then just start typing.

enter image description here

Niko Sams
  • 4,304
  • 3
  • 25
  • 44
  • this only types one character for me, on the bottom row of the selection. – Nicolas Holthaus Dec 21 '15 at 18:22
  • @NicolasHolthaus: I'm not aware of any issues in KTextEditor (that's the Kate *part*) in Block Selection Mode. The following (example) procedure gives you a multi-line cursor: Position your cursor at the start of a multiline file, `Ctrl-Shift-B` (enable block selection), then `Shift+Key_Down`, type 'a' => you *should* end up with 'a' in line 1 and 2 – kfunk Jan 03 '16 at 23:26
  • @kfunk. Interesting. That doesn't work in my instance of KDevelop. Are there dependencies on other applications that would be required for this functionality, or some global KDE setting somewhere I don't have? – Nicolas Holthaus Jan 04 '16 at 12:49
  • @NicolasHolthaus: Can't think of anything... I'd suggest trying to search bugs.kde.org for known issues or even ask the Kate development mailing list. – kfunk Jan 05 '16 at 13:20
  • Accepting this because my issue seems to be a problem with KDE on CentOS 7. With Kubuntu, etc, block mode works as advertised. – Nicolas Holthaus Mar 31 '16 at 04:19
0

Multi-cursors or multi-selection are one of those features you start loving once you first try if only they're implemented correctly, UX-wise. I think the first guys, who made these features really useful were the guys who developed SublimeText editor. Just look what it can do:

Just in case Sublime is available for Linux and I also heard the same features been supported by MS Visual Code studio, which is also available for Linux. But all that off course is not an open-source software.

Speaking of KDevelop and Kate editor. They're both built on a top of KTextEditor KDE component. There were number of attempts made in the past to introduce these kind of advanced multi-cursor and multi-selection features on a top to what it already had (multi-cursor via block selection - https://kate-editor.org/2013/09/09/multi-line-text-editing-in-kate/ - which is pretty limited in terms of what you can do):

Unfortunately none of them were eventually merged to a mainline. So if you want to use one of these, you'll probably need to build it yourself.

But things has changed to a better just recently. From what I see in the recent news is that KDE dev team was advertising to support multi-cursors in KTextEditor starting from KDE Frameworks version 5.92 - https://kate-editor.org/post/2022/2022-03-10-ktexteditor-multicursor/

I guess it will take another while for major distros to update their KDE packages up to that version, so everyone could start enjoying multi-cursor and multi-selection in Kate. If you want to use it earlier you need either to build it yourself again, find a flatpak/appimage/snap package or just switch to KDE Neon :)

The world of Linux is tough one, yeah

Alex
  • 101
  • 1
  • 7