How to indent highlighted blocks in Kate

Earlier this year, I switched to KDE Plasma, so I am still learning Kate’s secrets.

How do I indent highlighted blocks in Kate?

On the internet, I found that Ctrl + L would add spaces while Ctrl + Shift + L would remove spaces. However, this is not working. Do I need to set something in a configfile?

In Kate I went to “Settings” then “Configure Kate…” then “Editing” where I found an “Indentation” tab. I didn’t see anything about block indentation. :man_shrugging:


Err…unless I am missing what you are asking, you just hit the tab key.


Duh on my part. That works.
I was hoping to be able to indent one space at a time instead of by tab (four spaces).
But I will adjust.


Use multi-cursors - ctrl+alt+down, then press space.


The third way: change to [BLOCK] select mode by pressing Ctrl+Shift+B. Then make a vertical selection spanning multiple lines at the beginning of the lines you wish to indent (quick way to do it is Home, and then Shift+ multiple times, or you can use the mouse) and press     Space    .

Also, in the settings, you can change how many spaces a tab will indent. For most programming languages, I keep it at two, instead of the default four.

The fourth way: Kate will automatically indent blocks for most programming languages. Normally, you want to indent a block when you’ve added an encompassing outer block. You can do this by simply cutting and pasting the entire outside block. All inner blocks will then automatically indent properly upon pasting (assuming this option is enabled: “Adjust indentation of code pasted from the clipboard”).

1 Like

OK the secret is Ctrl+Shift+B.

I was just selecting several lines the same as one would for a copy - paste. Just left click and drag. I guess that means nothing to Kate. But by using the magic keys what you highlight tells Kate this is more than just highlighted text, it is a block meant for Kate’s use.

Kate is so fickle. :man_facepalming:


It does. You can do this and indent with Tab. But if you press     Space    , your selection will be overwritten by a single space character.

Block selection is just like the normal line selection, except it is rectangular. You can copy and paste rectangular blocks, too, like in this example:

1 Like

This is exactly what I was doing. I will try your fourth way when the image I am making is done.


Kate is not the only option… especially if you are writing source code.
Emacs can indent (reformat) practically any source code with the tab key. This is one of the main reasons I use emacs.

Of course it isn’t. There is a million text editors for GNU/Linux.

It’s just that Kate is the best one. :wink:

1 Like

Kate is great, and I use it too. For example, kate was the only editor that was able to (easily) move rectangular blocks of text (recently needed that feature).

But indentation of source code is a feature that I find emacs does the best of all editors I’ve ever used. And it does so with any language…

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.