Version: KDE 3.90.1 (using KDE Devel) Installed from: Compiled sources Compiler: g++ 4.1.1-51.fc6 OS: Linux I normally indent with spaces, so I want to have the indentation mode set to spaces, however when I press the TAB key, I really really want a tab, not a bunch of spaces, I'd have pressed the space key if I wanted that! ;-) I don't think I'm the only one who wants that, thus this RFE. Note that I can get the KDE 3.5 KatePart to mostly do what I want by disabling "use spaces instead of tabs" under Editing and enabling it under Indentation (and also disabling the "Emacs-style" option, which isn't there in KDE 3.90.1 anymore either), but the fact that this works is probably more accidental than intentional. :-) Speaking of that "Emacs-style" option which can't be disabled anymore, I think that's a horrible way to do indentation. For example, the following code: [TAB]if (foo [TAB]____&& bar) will only align correctly independently of the tabstop setting (which is something the user should be able to set, otherwise what's the point of using tabs at all?) if tabs are used where I used [TAB] and spaces where I used _. The "Emacs-style" indentation breaks that (try it with 4-space tabs and it will change the spaces to a tab, then try switching to 8-space tabs and look at the resulting mess!). But that's a separate issue, the fact that the tab key can't be configured to simply insert a tab without setting the indentation mode to tabs throughout is much worse.
Switch to Command Line (F7), type 'char 9' and a tab is inserted
Unfortunately, that doesn't work either (it also inserts a bunch of spaces in space-indentation mode, at least in KWrite), and it isn't quite what I'm after anyway (8 keypresses all over the keyboard to insert 1 character).
What about creating a shortcut to do that ? for example shift+tab would do. And of course you could change it.
*** Bug 172950 has been marked as a duplicate of this bug. ***
i suggest doing it like vim does it: have one special key press who inserts whatever you press afterwards literally. that way one can insert a tab even if tabs are set to expand to spaces, insert a special character like escape and so on. in vim it is also possible to press number keys to insert an ascii code or, by prepending the numbers with 'u', insert a unicode char. examples: <key combo><tab> inserts a tab character <key combo>009 inserts a tab character <key combo>u0937 inserts a 'Ω' <key combo>ux3c0 inserts a 'π' ('x' indicates hexadecimal)
There's a reason I'm using kwrite instead of vim or emacs. If I wanted to use vim as my default editor, I would. If you want to have an editor that replaces tabs with spaces by default, that's fine (though strongly not my preference). It must be intuitive to get them back, though. Anything less frustrates users. MS style access to code-points is fine and all, but if I cannot make the tab key produce x09, then something is seriously wrong. Chew on that for a minute. (Note that I did find the answer to my problem in bug report 172950. What should be intuitively obvious is as obscure as it could possibly be. I think most non-programmers still wouldn't be able to figure it out, let alone find the solution.) The mantra that should be followed: Get out of my way and let me work!
In newer Kate versions, you can configure shortcut for "insert tab char". If you don't enforce indent with spaces, tabs are insertable anyway, if you enforce indent with spaces, you can use that shortcut.
Uh, being able to set an obscure shortcut is no substitute for having the Tab key behave as designed.
Well, actually, Tab can be used as a shortcut, but: * This is not a very intuitive way to set this up. * The "insert tab" action does not behave like normal typing: For example, it always INSERTS a tab, even if you have text selected, it doesn't replace the selected text. * Kate also messes with my indentation characters in other cases, e.g. when I paste stuff from the clipboard. So I can't even copy a line of code with unchanged indentation without changing my indentation settings all the time. There really needs to be a "Don't mess with my indentation characters" option.
There is also no way to set a shortcut for "insert tab char" in other applications embedding the KatePart, e.g. Krusader.
*** Bug 184260 has been marked as a duplicate of this bug. ***
There was a bug that the "Insert Tab" action that it did not overwrite selected text, but that was fixed actually quite some time ago. I am able to use the shortcut in KWrite and Kate... I think it should also appear in all applications that use the KatePart It is not the nicest or most intuitive way but it gets it done... :) Please reopen if it does not work in some situation. I will close this as fixed as the added Insert Tab action works for me.