All,
Does anyone know how we can currently assign a short-cut key in kate/kwrite to:
Tools > Highlighting > Scripts > Bash
(alt+t, h, r, b -- isn't what I was thinking)
Or associate any of the other highlighting files with a short-cut? If there is no way to do that, then it would be worth putting on the enhancement list. Kwrite isn't that big of deal, but there are numerous times in kate where I will have 10-20 files open that I would like to set with a syntax file without having to mouse through Tools > Highlighting > Scripts > Bash that many times.
We could either have a key that popped open the Tools > Highlighting menu and gave the user the ability to scroll and select. Or, my preference, would be to provide a configuration option under highlighting that would be a "Quick List" that allowed the user to configure his "Top 10" syntax files that would pop up with a shortcut and allow the user to select from the list of 10.
It would need to be a katepart plugin to be available to both kate/kwrite, but it shouldn't be that difficult to do.
Worth an enhancement request? There are already shortcut options for just about everything in kate, just not syntax...
Does anyone know how we can currently assign a short-cut key in kate/kwrite to:
Tools > Highlighting > Scripts > Bash
(alt+t, h, r, b -- isn't what I was thinking)
Or associate any of the other highlighting files with a short-cut? If there is no way to do that, then it would be worth putting on the enhancement list. Kwrite isn't that big of deal, but there are numerous times in kate where I will have 10-20 files open that I would like to set with a syntax file without having to mouse through Tools > Highlighting > Scripts > Bash that many times.
We could either have a key that popped open the Tools
Highlighting menu and
gave the user the ability to scroll and select. Or, my preference, would be to provide a configuration option under highlighting that would be a "Quick List" that allowed the user to configure his "Top 10" syntax files that would pop up with a shortcut and allow the user to select from the list of 10.
It would need to be a katepart plugin to be available to both kate/kwrite, but it shouldn't be that difficult to do.
Worth an enhancement request? There are already shortcut options for just about everything in kate, just not syntax...
The kate-part toolbar supports Highlighting. That will save a mouse click but not any key presses.
To me the root problem of your description is why kate is not detecting the file type. I have seen this often enough and is frustrating. Before submitting an enhancement request, perhaps browse the code to learn how detection functions. Possibly an extra if-then statement or equivalent is all that is needed to address some of these shortcomings.
Darrell
On Fri, 9 Mar 2012 15:15:28 -0800 (PST) Darrell Anderson humanreadable@yahoo.com wrote:
To me the root problem of your description is why kate is not detecting the file type. I have seen this often enough and is frustrating. Before submitting an enhancement request, perhaps browse the code to learn how detection functions. Possibly an extra if-then statement or equivalent is all that is needed to address some of these shortcomings.
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).
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 :)
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
On Sat, 10 Mar 2012 11:32:36 -0600 "David C. Rankin" drankinatty@suddenlinkmail.com wrote:
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.
I suspect the reason this isn't in there already is that it only works for a few of the available file types. That being said, I don't see how it can actually *hurt* anything.