New plugin: QKeys

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
Here: prospero.unm.edu/plugins/qkeys.html

Inspired by a remark by Steve Fabian in another thread. This plugin lets you define custom hotkeys to grab the word at the cursor and do stuff with it. I don't know whether this one deserves much development, but some of the possibilities seem interesting, e.g. grab a mathematical expression and evaluate it with @EVAL while composing a command.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I found out how function keys with modifiers can be defined and use them already. But function keys defined without modifiers QKEY displays the definitions, but the result is an empty string.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
That's what failed, trying both F2 and F4. In the event it's significant, I just verified with @FULL[]. ctrl-f2 worked.
Not significant, but my batch file to list keystorke aliases is a bit stylized:
Code:
        @@F3 %loc\WINMIN.BTM
    @@alt-F3 %loc\WINMAX.BTM
   @@ctrl-F3 %bat\SHOWSIZE.BTM
  @@shift-F3 %loc\WINBIG.BTM
         @F4 %@full[
     @alt-F4 %@expand[
   @shift-F4 bdebugger %@search[
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Some keys I will switch ASAP to QKEY instead of keystroke aliases, because they need to postprocess it. Should I switch all? The execution time is not really critical when I must pay attention of what I do...

My current definitions are in a separate file last updated in Dec. of 2009.

BTW, keystroke aliases allow the same key defined both as autoexecute and as insert-only, but the insert-only overrides the autoexecute. I suppose QKEYS would just override the last definition all prior ones.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
Some keys I will switch ASAP to QKEY instead of keystroke aliases, because they need to postprocess it. Should I switch all? The execution time is not really critical when I must pay attention of what I do...

TCC seems to check key plugins before key aliases, so there's no need to change your aliases file. Define a QKey and it'll override the alias. Delete it, and you're back to the alias again.

BTW, keystroke aliases allow the same key defined both as autoexecute and as insert-only, but the insert-only overrides the autoexecute. I suppose QKEYS would just override the last definition all prior ones.

A new definition replaces any old one for the same key. (I thought that defining an @@-alias automatically removed any @-alias, and vice versa. No? Not when read in from a file, perhaps?)
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Very explicit comment from 2004 states that it is possible to define both @@ and @ for the same key, in which case @ is active, but both are listed by ALIAS. Never went back to try again. I avoid conflicts. Your statement (new definition replaces any old one) is perfectly fine.
The advantage of letting TCC taking key plugins over key aliases is that running older TCC that does not support QKEYS is self-adjusting. What is the oldest version of TCC compatible with QKEYS?
I have to apologize for the "plain function key". TCC does not permit a keyhandler for F2; it does for F4. There is a whole 4th paragraph of Special Considerations for Keystroke Aliases on the subject.
I tested the original QKEYS successfully in TCC version 11. It's what I use when installing new builds.
THANKS!
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
The advantage of letting TCC taking key plugins over key aliases is that running older TCC that does not support QKEYS is self-adjusting. What is the oldest version of TCC compatible with QKEYS?

I recommend at least 11.00.48. It will run in older versions, but hotkeys may require two presses after history recall, filename completion, and so on.

I just searched the forum for info on the above issue, and discovered that Vince has already written a QKEY plugin implementing a QKEY command. I am therefore open to suggestions for a new name....
 
May 20, 2008
3,515
4
Elkridge, MD, USA
HOTKEY?
BTW, I presume redirecting the command listing all to a file is the one I can use to reload with /R:filename'
Must treat the hotkeys as unique to each TCC instance, I presume, no equivalent to global aliases.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
BTW, I presume redirecting the command listing all to a file is the one I can use to reload with /R:filename
That's what /S: is for. Redirection should work too, but (a) may mangle high-order characters if UnicodeOutput=No, or (b) will produce a larger output file if UnicodeOutput=Yes.

Must treat the hotkeys as unique to each TCC instance, I presume, no equivalent to global aliases.
Yes, each gets its own list.
 
Here: prospero.unm.edu/plugins/qkeys.html

Inspired by a remark by Steve Fabian in another thread. This plugin lets you define custom hotkeys to grab the word at the cursor and do stuff with it. I don't know whether this one deserves much development, but some of the possibilities seem interesting, e.g. grab a mathematical expression and evaluate it with @EVAL while composing a command.

One of the things I enjoy about the PowerShell console is the ability to do math at the command line. You just type in your numbers and operators, press enter, and you have the result.

Using qkey /x alt-==%%@eval[#] now allows me to do almost the same thing in TCC, except I have to now press Alt= to get the result, instead of just pressing enter, which really isn't a problem. Another great tool for TCC. Thanks.

Joe
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
I've put up a new build here: prospero.unm.edu/plugins/ekeys.html

I have changed the name of the plugin, and its one command, to fix a collision with an earlier plugin of Vincent's. I've also added one new option allowing you to insert a word at the start of the command line, possibly useful for commands like BDEBUGGER and IDE.
 
May 29, 2008
566
4
Groton, CT
This sounded like exactly what I was waiting for. I often type a partial command and discover that I need to issue some other command first. So what I've been doing is hitting [Home] [Insert] then REM and a space, then hitting ENTER. I can bring back the REM command later with command recall and edit it.

So I thought that I'd be able to define a hotkey like

EKEY /C ALT-1=REM

No such luck. If I enter FOO BAR BAZ and hit ALT-1 while the cursor is on BAZ, the resulting line is FOO BAR REM, though I think it should be REM FOO BAR BAZ.

TCC 15 // Windows XP. I haven't tried it yet on Windows 7.
 
May 20, 2008
11,380
98
Syracuse, NY, USA
I've put up a new build here: prospero.unm.edu/plugins/ekeys.html

I have changed the name of the plugin, and its one command, to fix a collision with an earlier plugin of Vincent's. I've also added one new option allowing you to insert a word at the start of the command line, possibly useful for commands like BDEBUGGER and IDE.
Was anyone actually involved in a collision? I don't even remember QKEYS, and having just read its text file, I still don't remember it.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
This sounded like exactly what I was waiting for. I often type a partial command and discover that I need to issue some other command first. So what I've been doing is hitting [Home] [Insert] then REM and a space, then hitting ENTER. I can bring back the REM command later with command recall and edit it.

So I thought that I'd be able to define a hotkey like

EKEY /C ALT-1=REM

No such luck. If I enter FOO BAR BAZ and hit ALT-1 while the cursor is on BAZ, the resulting line is FOO BAR REM, though I think it should be REM FOO BAR BAZ.

Try EKEY /C ALT-1=REM #

The # stands for the word at the cursor, effectively replacing it with itself; the part before the space is moved to the start of the command line as the new command.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
Was anyone actually involved in a collision? I don't even remember QKEYS, and having just read its text file, I still don't remember it.

Don't know, but it can't be good to have two plugins with the same name.

I don't remember QKEYS either, but I had an old copy in my downloads directory, so I must have been aware of it at one time. Presumably the name stuck in my memory.
 
May 29, 2008
566
4
Groton, CT
Thanks, Charles. That wasn't obvious. So, maybe the documentation should say something like,
"When /C is used, the first token on the command line is altered, rather than the word under the cursor."

I found another use for this.

ekey /c /e alt-2=echo #
can be used see what the expanded version of a command looks like before execution.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
Thanks, Charles. That wasn't obvious. So, maybe the documentation should say something like,
"When /C is used, the first token on the command line is altered, rather than the word under the cursor."

No, it still picks up the word at the cursor. It's always the word at the cursor. To see how it works, try changing your original hotkey to something like:
Code:
ekey /c alt-1=rem (#)

(And if the cursor is not at a word, the hotkey does nothing at all. I may change that in a future build.)
 
May 29, 2008
566
4
Groton, CT
So /C doesn't work unless a # appears somewhere in the definition?

Whatever. It's working for me now.

I haven't tried it, but if the cursor were not on some word, I would still expect /C to work, but probably not anything else.
 
May 29, 2008
566
4
Groton, CT
Charles,

I'm sorry for sounding snotty in my last reply. I didn't mean to be, but as I reread my own words, I realize that it sounds that way.
I meant no disrespect.

I also reread the .html file description of /C, and I see that the behavior does match the description. However, I still think you need a note saying that a # must appear for the /C to be useful.

Sorry for the misunderstanding.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,446
88
Albuquerque, NM
prospero.unm.edu
I'm sorry for sounding snotty in my last reply. I didn't mean to be, but as I reread my own words, I realize that it sounds that way.
I meant no disrespect.

No worries. This is about the most amiable internet forum I've ever encountered. (Hey, I have the power to slap down trolls here! ...and have never yet found an excuse to try it out.)

I also reread the .html file description of /C, and I see that the behavior does match the description. However, I still think you need a note saying that a # must appear for the /C to be useful.

You'll almost always want a # in the definition, unless you intend to discard the word at the cursor. I suppose I might automatically append a #, if /C is specified and the definition text contains only one word.
 
Similar threads
Thread starter Title Forum Replies Date
Joe Caverly 64-bit Plugin development using PureBasic Plugins 8
R New Plugin Plugins 0
Alpengreis elevated plugin questions Plugins 3
fpefpe utf-8 support in sdk/plugin api Plugins 4
S How to? Can @DU function in 4Utils64 plugin somehow cater for dirs with spaces? Plugins 3
vefatica Plugin access to arrays? Plugins 4
vefatica How big is a plugin's parameter buffer? Plugins 5
C @knownpath plugin Plugins 0
Charles Dye Updated OSD plugin Plugins 0
Joe Caverly C# plugin framework for JPSoft's TCC Plugins 0
dcantor Help for newest version of TEXTUTILS plugin Plugins 10
dcantor UISTUFF plugin missing help topic Plugins 12
M How to? Use SafeChars plugin... Plugins 2
dcantor Error in SAFECHARS plugin v 1.9.0 Plugins 2
dcantor Request for documentation for ISO8601 plugin Plugins 4
vefatica Possible with a plugin? Plugins 6
dcantor Inconsistency between textutils plugin and wrap utility Plugins 2
M (Stupid?) Problem with 64-bit 4Utils plugin... Plugins 3
H Latest ISO8601 plugin? Plugins 1
S Plugin to quickly locate all files hard linked together Plugins 5
S Documentation Plugin everything.dll Plugins 5
newbie How to? Multi-plugin installation errors, Re: FedUtils8 Plugins 7
vefatica Plugin -> thread -> Command() -> Ctrl-C? Plugins 20
Charles Dye A weirdoid plugin question Plugins 6
M SafeChars plugin misbehaving... Plugins 3
M A weird error re a plugin... Plugins 0
vefatica Plugin dilemma Plugins 2
fpefpe Documentation Plugin API/SDK Plugins 3
C Looking for Vince's old 4UTILS plugin for TCMD v8 Plugins 1
S DESKTOP plugin - anyone ? Plugins 0
C How to? a plugin to sort Outlook Express "rules" Plugins 0
M ISO Plugin: Yes, it's wonderful, but it could be yet more wonderful... Plugins 7
M The ISO plugin is wonderful, but it lacks a little something... Plugins 22
Charles Dye Beta plugin: HidePasswords Plugins 3
M ISO8601 Plugin not "reporting" errors to TCC... Plugins 4
Frank 4console plugin Plugins 4
S WAD ISO8601 Plugin Plugins 15
Joe Caverly Plugin and 64-bit TCC Plugins 3
C Problem with FixNames plugin Plugins 9
dcantor Suggestion and request for DBF plugin Plugins 6
dcantor Suggestion for SafeChars plugin Plugins 7
M Charles, I just installed the "new" SafeChars plugin, ... Plugins 5
M A problem with the SafeChars Plugin... Plugins 30
S WHICHWIN (sysutils plugin) Plugins 13
M A (presumbly pretty simple) SafeChars plugin request... Plugins 2
M A "SafeChars" plugin request... Plugins 2
S ISO 8601 plugin enhancement Plugins 6
D UNKNOWN_CMD in Plugin Plugins 13
C Looking for isemailaddress[string] plugin Plugins 7
S ISO8601 Plugin Plugins 4

Similar threads