How do I get Kwrite to stop playing guessing games?

Sometimes when I’m editing a plain text file (extension .txt), Kwrite decides that I’m editing something other than a plain text file. Usually, it decides that my plain text file is really an XML document. Sometimes it decides that my plain text file is really C source code. It then proceeds to highlight everything in sight. This is annoying enough, but it also flags all the “errors,” and I get a window full of underlined red-on-yellow text. This is very distracting, especially when less-than signs look like less-than-or-equal signs, or when I have a pound sign at the start of a line and Kwrite decides that I’ve screwed up a C macro.

If there’s something in the Kwrite documentation about overriding the file extension and (mis)interpreting the file contents, I can’t find it.

How do I tell it to stop second-guessing me?

P.S. This is the sort of nonsense that pisses me off about Microsoft. Is everyone doing the user “favors” without permission nowadays?

I do not know the asnwer (still using *vi *out of old habit), but you might search for a solution in the wrong direction. As the “extention” is not a native Unix/Linux thing, it might be that Kwrite does not detect his misbehaviour based on the characters in the filename that come after the last dot in that filename, but by an “iintelligent” guess based on the contents of the file.

This would mean that a solution to your problem might be found in a configuration parameter that is named very different from what you expect.

A lot of “might” here, but narrowing your search for elements that include the word “extention” might not be the right approach.

I haven’t come across that. But then I only use kwrite for temporary stuff that I plan to copy/paste elsewhere (on a web forum, etc). I mostly use vi.

I do find that “vi” does some of the same nasty stuff. So I just remove “/etc/vimrc” and vi starts to behave sanely (until I update to the next opensuse release).

This might be helpful.

On 2012-05-11 18:26, CousinRicky wrote:

> If there’s something in the Kwrite documentation about overriding the
> file extension and (mis)interpreting the file contents, I can’t find
> it.
>
> How do I tell it to stop second-guessing me?

I do not know, I don’t see that in kwrite configuration; you have to use
kate instead who does have that.

However… I open a text file and I don’t know what format it thinks it is,
but it is displayed as light blue on white, totally unreadable. A new text
file does the same. I have no idea who designed such a color theme.

I’m running gnome. I tried to run “kde-config”, but it died, so I can’t
change colors.

Anyway, in kate, tools, you can choose the “syntax” highlight and the mode
used for the text.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)