Fixing the recognition problem would solve most people's problem with highlighting. But I often turn highlighting on in a plan text file, when I am documenting or looking at a snippet of code in a standard text file. That makes it easier to find simple but hard to see mistakes in the code. Because of this, I too wanted a single key activation of a specific file type highlighting.
I was unable to do this by modifying the Kate ".rc" files. The highlight feature is based on a drop-down menu and seems to require being attached to other "actions". I think that prevents you from calling the highlight menu from anything except a toolbar or menu selection.
You can create a toolbar icon for the highlight menu (which only saves you one click--but is easier to find). You do this in the "Main Toolbar <KatedPartView>. Note that you will have to assign an icon.
The only way I found, to set a specific highlighting in a single keystroke, is to use a program like AutoKey (a massive improvement over KHotKeys, which might also work, but is more trouble to create control character phrase strings with). Simply by sending this string from AutoKey, I was able to turn on the "bash highlighting" with one keystroke":
<alt>+TH<right>SS<right>B
It took about 3 min. to get it right and test it. For simple menu calls it only takes seconds to test and setup.
Keith
On Sat, Mar 10, 2012 at 12:32 PM, David C. Rankin drankinatty@suddenlinkmail.com wrote:
On 03/10/2012 09:09 AM, E. Liddell wrote:
I believe the detection is by file extension (ran into this when adding WesnothML to the list of available highlight types in an older version that didn't have it by default--its extension is also sometimes used by . . . I think it was QuakeScript).
It is not only by file extension, but also by file pattern. Thinking about it, Darrell is on to the root cause of the problem. The detection does not seem to be using any 'file <filename>' information. Archlinux uses PKGBUILD scripts as the build scripts for building packages. PKGBUILD is nothing more than a special name for a bash script. In order to have unique filenames in kate, I append the trinity package name to the end so that I clean list, eg:
PKGBUILD-tde-arts PKGBUILD-tde-avahi-tqt PKGBUILD-tde-dbus-1-tqt PKGBUILD-tde-dbus-tqt PKGBUILD-tde-libart-lgpl PKGBUILD-tde-libcaldav PKGBUILD-tde-libcarddav PKGBUILD-tde-tdeartwork
<snip>
For these build scripts, I can configure a highlighting rule so that kate/kwrite properly recognize them as bash scripts by including ';PKGBUILD*;' in Configure kate -> Editor -> Highlighting -> Properties -> file extensions.
For special cases, where there is some consistent filename patter, this works, but kate should be smart enough to parse the 'head <filename>' information and at least look for a '#!<something>' or something similar. I'll have time to dig into this further once I get the remaining TDE build scripts done. That has been my big push lately. You guys don't have any other thoughts on 'tdeutils' or 'tdepim' failures I'm seeing do you :)
-- David C. Rankin, J.D.,P.E.
To unsubscribe, e-mail: trinity-devel-unsubscribe@lists.pearsoncomputing.net For additional commands, e-mail: trinity-devel-help@lists.pearsoncomputing.net Read list messages on the web archive: http://trinity-devel.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting