Search code examples
c++kate

Kate (text editor) indentation, c++


I use the kate text editor for writing c++ code. I really like the editor except for its indentation behavior which drives me mad. I have the following problem: If I want to write code like

if( true )
{
    //code
}

the indentation messes everything up initially: instead of inserting a tab and jumping to the position marked "//code" when hitting enter, kate just inserts a single blank space. So to describe it more in detail: You start from

if( true )
{//your cursor is here
}

and on pressing enter, kate produces something like

if( true )
{
[ ]//your cursor is here
}

where '[ ]' stands for a single blank space. But instead, I want kate to insert a tabulator to give the result indicated at the start. Or, to repeat it more verbosely, I want that kate gives me

if( true )
{
<tabulator>//your cursor is here
}

on hitting enter. I have played around with all settings and can not make it work. It drives me crazy. I selected "default identation mode normal", "Ident using tabulators" (8 characters). Does anybody know how to customize this behavior? I looked up the katerc file but couldn't find any options that would help me...

edit: I should add that it would be ok if kate would just give me

if( true )
{
//your cursor is here
}

on pressing enter. But this additional blank space is absolutely annoying.


Solution

  • Ok, I tried for half an hour, I don't know why I found out how to do it right AFTER posting the question :). So in case anybody has the same issue, here is the "solution": I missed that kate seems to have a global setting for the indentation mode as well as a local one for every file. In my case - for some reason - my file had special indentation options set. You can alter them via the menu bar by chosing "Tools -> Indentation". This local option overrides the global one! Or the global one is just the default for the local options, I don't know exactly...