[Info-vax] iTerm2 VMS-friendly keyboard map (Re: Terminal emulators, was: Re: OpenVMS graphics - once more)
Craig A. Berry
craigberry at nospam.mac.com
Thu Aug 20 19:01:57 EDT 2015
On 8/20/15 3:53 PM, Craig A. Berry wrote:
> On 8/20/15 1:02 PM, Galen wrote:
>>>
>>> If you want I could send you the output of:
>>>
>>> $ plutil -convert xml1 -o myiterm.plist
>>> ~/Library/Preferences/com.googlecode.iterm2.plist
>>>
>>> I haven't figured out how to export only the one profile designed to be
>>> VMS-friendly rather than the entire settings file.
>>
>> I'd very much like to have this, too. Is there anywhere it could be
>> posted for general access?
>>
>
> The problem with that is that as far as I can find there is no way to
> export just one profile or just the keyboard map. I'm not going to post
> my entire settings file as that has all sorts of stuff about my local
> network in it.
>
> I could in principle manually extract just the keyboard components of
> the settings. Those look like this snippet:
>
> <key>Keyboard Map</key>
> <dict>
> <key>0x2a-0x200000</key>
> <dict>
> <key>Action</key>
> <integer>10</integer>
> <key>Text</key>
> <string>OS</string>
> </dict>
>
> However, that's not very human readable, nor is there any convenient way
> to get the machine to read it outside of importing the entire settings
> file. So I've typed in below what I see under the Keys tab under
> Preferences->Profiles. To add them to your profile, click the plus sign
> to add a new shortcut, press the key you want to map, choose "Send
> Escape Sequence" and then type in anything after the first left bracket
> in the list below.
>
> Note: these are probably incomplete (for some reason I stopped at F10
> even though the Apple keyboard goes up to F19). Also note: these are
> designed to mimic the layout of an LK keyboard so labels on an Apple
> keyboard become irrelevant (e.g., "page up" now means Remove and "end"
> means Prev). Also, also note: don't use this profile for the EFI console
> on an Integrity server; the arrow keys won't work.
>
> num-* Send ^[OS
> num-+ Send ^[OI
> num-/ Send ^[OR
> num-= Send ^[OQ
> F1 Send ^[OP
> F2 Send ^[OQ
> F3 Send ^[OR
> F4 Send ^[OS
> F5 Send ^[Ot
> F6 Send ^[Ou
> F7 Send ^[Ov
> F8 Send ^[OI
> F9 Send ^[Ow
> F10 Send ^[Ox
> Del-> Send ^[[4-
> Home Send ^[[2-
> End Send ^[[5-
> Page Up Send ^[[3-
> Page Down Send ^[[6-
> Numlock Send ^[OP
> Help Send ^[[1-
>
>
I found another way to do this with less manual intervention. First make
a copy of the PresetKeyMappings.plist file from iTerm2 and make a backup
of it in case anything goes wrong:
$ cp /Applications/iTerm.app/Contents/Resources/PresetKeyMappings.plist ./
$ cp PresetKeyMappings.plist PresetKeyMappings.plist.backup
Now paste the XML snippet at the end of this message right before the final
</dict>
</plist>
at the end of the PresetKeyMappings.plist file using your editor of
choice. Save your changes.
Hint: close iTerm2 and run the next command from Terminal.
Now copy the modified file back to its canonical location:
$ sudo cp PresetKeyMappings.plist
/Applications/iTerm.app/Contents/Resources/PresetKeyMappings.plist
Open iTerm2 and create a new profile based on whatever you've been
using. Under Preferences-->Profiles select your new profile. Select the
Keys tab and then select "DEC LK-Style" from the "Load Preset"
drop-down. That's it.
N.B. I just discovered that most of the function keys don't work
according to LK keyboard expectations but instead perform the default OS
X function (e.g. F10 turns the volume down instead of saving in TPU).
I'm pretty sure this worked in earlier versions of iTerm2 -- let me know
if you find a way to make it work again.
Here's the XML section to paste into your PresetKeyMappings.plist file:
<key>DEC LK-Style</key>
<dict>
<key>0x2a-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OS</string>
</dict>
<key>0x2b-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ol</string>
</dict>
<key>0x2f-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OR</string>
</dict>
<key>0x3d-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OQ</string>
</dict>
<key>0xf700-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OA</string>
</dict>
<key>0xf701-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OB</string>
</dict>
<key>0xf702-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OD</string>
</dict>
<key>0xf703-0x200000</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OC</string>
</dict>
<key>0xf704-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OP</string>
</dict>
<key>0xf705-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OQ</string>
</dict>
<key>0xf706-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OR</string>
</dict>
<key>0xf707-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OS</string>
</dict>
<key>0xf708-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ot</string>
</dict>
<key>0xf709-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ou</string>
</dict>
<key>0xf70a-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ov</string>
</dict>
<key>0xf70b-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ol</string>
</dict>
<key>0xf70c-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ow</string>
</dict>
<key>0xf70d-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>Ox</string>
</dict>
<key>0xf728-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>[4~</string>
</dict>
<key>0xf729-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>[2~</string>
</dict>
<key>0xf72b-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>[5~</string>
</dict>
<key>0xf72c-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>[3~</string>
</dict>
<key>0xf72d-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>[6~</string>
</dict>
<key>0xf739-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>OP</string>
</dict>
<key>0xf746-0x0</key>
<dict>
<key>Action</key>
<integer>10</integer>
<key>Text</key>
<string>[1~</string>
</dict>
</dict>
More information about the Info-vax
mailing list