Re: adding a keyboard shortcut for double brackets
- To: mathgroup at smc.vnet.net
- Subject: [mg115892] Re: adding a keyboard shortcut for double brackets
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Tue, 25 Jan 2011 04:19:12 -0500 (EST)
- References: <ihe40t$q6m$1@smc.vnet.net>
Hi Paul,
It looks good, but doesn't work for me. Nothing happens. Are you sure
BTW that the last keyname should be "Command" instead of Alt? Sounds
mac-speek to me.
Cheers -- Sjoerd
On Jan 22, 9:20 am, gl... at flashmail.com wrote:
> Hello Barrie,
>
> What you want is not difficult. Since you will modify a system file,
> make a back-up copy.
>
> Open the
> file:
> ($InstallationDirectory)\SystemFiles\FrontEnd\TextResources\Windows\KeyEv=
entTranslations.tr
>
> Modify it to read:
> .
> .
> .
> EventTranslations[{
>
> (* User-added keyboard commands *)
> Item[KeyEvent["[", Modifiers -> {Control}],
> FrontEndExecute[{
> FrontEnd`NotebookWrite=
[FrontEnd`InputNotebook[],
> "\[Lef=
tDoubleBracket]", After]
> }]],
> Item[KeyEvent["]", Modifiers -> {Control}],
> FrontEndExecute[{
> FrontEnd`NotebookWrite=
[FrontEnd`InputNotebook[],
> "\[Rig=
htDoubleBracket]", After]
> }]],
> Item[KeyEvent["]", Modifiers -> {Control, Command}],
> FrontEndExecute[{
> FrontEnd`NotebookWrite=
[FrontEnd`InputNotebook[],
> "\[Lef=
tDoubleBracket]", After],
> FrontEnd`NotebookWrite=
[FrontEnd`InputNotebook[],
> "\[Rig=
htDoubleBracket]", Before]
> }]],
>
> (* Evaluation *)
> .
> .
> .
> Where the vertical . . . represents the original lines above and below.
>
> This adds three keyboard combinations, where "[[" and "]]" represent
> the proper forms, and "_" the cursor position:
>
> Ctrl+[ -> [[_
> Ctrl+] -> ]]_
> Ctrl+Alt+] -> [[_]]
>
> If you do not use the first two, simply remove those blocks from the
> file. It should be easy enough to change the keys or add other
> commands once you have a look at the file.
>
> Have a good day,
>
> Paul