"*
* Encoding: iso8859-1
*
* $Header$
*
* MIMEType: application/x-smalltalk-source
*
* ST/X startup configuration file:
*
* sample keyboard.rc - file
*
* this file defines some mappings for common function keys.
* These definitions used to be in 'private.rc',
* but have been extracted into this separate file to allow easier
* sharing of rc files (users having different private files, but want
* to use the same keyboard mappings / keyboard macros)
*
* A copy of this file can reside in $home/.smalltalk/keyboard.rc or
* in the current directory.
*
* These are my personal preferrences which may not be
* correct for your environment.
*
* WARNING:
* please keep the expressions below free from manipulating
* global state - all that should be done here is to set up the current
* screens keyboard map.
* Reason: in multihead applications, this will be consulted for each
* new display screen.
*"
Smalltalk fileIn:'keyboardMacros.rc'.
!
"*
* key bindings common to all display types
* use event monitor, to see what the Xserver sends us;
* put display-specific stuff into a d_hostName.rc file.
*"
|map screen|
screen := Screen current.
map := screen keyboardMap.
(screen serverVendor startsWith:'DECWINDOWS') ifTrue:[
"/ DEC has messed up the ESC key completely.
"/ map ALT-` onto ESC for our convenience.
"/
"/ also, the right compose key (comes in as 'AltMulti_key' or
"/ 'CtrlMulti_key' depending on the keyboard) is mapped
"/ to 'Compose'.
map bindValue:#Escape to:#'Cmd`'.
map bindValue:#Compose to:#'AltMulti_key'. "/ the right compose key
map bindValue:#Return to:#'KP_Enter'. "/ the keypads return key
].
"/ map bindValue:#'Hardcopy' to:#'Super_R'.
map bindValue:#'Alt' to:#'Super_L'.
map bindValue:#'Alt' to:#'Hyper_R'.
"/ map bindValue:#UserInterrupt to:#Ctrlc. "interrupt window process"
map bindValue:#UserAbort to:#Ctrly. "abort window process, but no debugger"
map bindValue:#FlushInput to:#CtrlX. "flush typeahead input"
map bindValue:#DestroyView to:#CmdCtrlX. "to destroy dead views"
map bindValue:#DestroyTopView to:#CmdCtrlx. "to destroy dead views"
map bindValue:#DoIt to:#Cmdd. "i.e. Cmd-d / Alt-d (sometimes Meta-d)"
map bindValue:#DoIt to:#Ctrld.
map bindValue:#InspectIt to:#Cmdi. "evaluate & inspect result"
map bindValue:#InspectIt to:#Ctrlq.
map bindValue:#PrintIt to:#Cmdp. "evaluate and paste result"
map bindValue:#PrintIt to:#Ctrlp.
map bindValue:#ReplaceIt to:#CmdP. "evaluate and replace selection by result"
map bindValue:#BrowseIt to:#CmdB.
map bindValue:#BrowseIt to:#CtrlB.
map bindValue:#ImplementorsOfIt to:#CmdI.
map bindValue:#ToggleInsertMode to:#Ctrli.
map bindValue:#Copy to:#Cmdc. "copy selection to buffer"
map bindValue:#Copy to:#Ctrlc. "copy selection to buffer"
map bindValue:#Cut to:#Cmdx. "cut selection into buffer"
map bindValue:#Cut to:#Ctrlx.
map bindValue:#Paste to:#Cmdv. "paste buffer or external selection"
map bindValue:#Paste to:#Ctrlv.
map bindValue:#Paste to:#CmdV. "paste buffer or external selection"
map bindValue:#Replace to:#Cmdr. "same as paste"
map bindValue:#Replace to:#Ctrlr.
map bindValue:#Find to:#Cmds. "open searchbox"
map bindValue:#Find to:#Ctrlf.
map bindValue:#FindNext to:#Cmdf. "search fwd for last searchpattern or selection"
map bindValue:#FindPrev to:#Cmdb. "search bwd for last searchpattern or selection"
map bindValue:#FindPrev to:#Ctrlb.
map bindValue:#SelectAll to:#CmdA. "that is Alt-shift-a"
map bindValue:#SelectAll to:#Ctrla. "that is Alt-shift-a"
map bindValue:#GotoLine to:#Cmdg.
map bindValue:#GotoLine to:#Ctrlg.
map bindValue:#SelectWord to:#Cmdw. "select word under cursor"
"/ map bindValue:#Undo to:#Cmdu.
"/ map bindValue:#Undo to:#Ctrlu.
map bindValue:#Undo to:#Ctrlz.
map bindValue:#Accept to:#Cmda.
map bindValue:#Accept to:#Ctrls.
map bindValue:#Explain to:#Cmde.
map bindValue:#Explain to:#Cmdh.
map bindValue:#Format to:#CmdF. "that is Alt-shift-F"
"/ map bindValue:#Format to:#CtrlF. "that is Ctrl-shift-F"
"/ map bindValue:#DeleteLine to:#CtrlX.
map bindValue:#NextPage to:#Next. "typically labelled PageDown on keyboard"
map bindValue:#PreviousPage to:#Prior. "typically labelled PageUp on keyboard"
"/ map bindValue:#PreviousPage to:#Ctrlb. "vi behavior"
"/ map bindValue:#NextPage to:#Ctrlf. "vi behavior"
"/ map bindValue:#HalfPageUp to:#Ctrlu.
"/ map bindValue:#HalfPageDown to:#Ctrld.
"/ old setting:
"/ map bindValue:#BeginOfText to:#Home. "some prefer to bind #BeginOfLine to #Home"
"/ map bindValue:#EndOfText to:#End. "some prefer to bind #EndOfLine to #End"
"/
"/ new setting:
map bindValue:#BeginOfLine to:#Home.
map bindValue:#EndOfLine to:#End.
map bindValue:#BeginOfText to:#CtrlHome.
map bindValue:#EndOfText to:#CtrlEnd.
"/ map bindValue:#BeginOfLine to:#Ctrla.
map bindValue:#EndOfLine to:#Ctrle.
map bindValue:#NextWord to:#Ctrlw.
map bindValue:#EndOfWord to:#CtrlW.
map bindValue:#NextWord to:#CtrlCursorRight.
map bindValue:#PreviousWord to:#CtrlCursorLeft.
map bindValue:#ScrollUp to:#CtrlCursorUp.
map bindValue:#ScrollDown to:#CtrlCursorDown.
map bindValue:#SearchMatchingParent to:#Ctrlm.
map bindValue:#SelectMatchingParents to:#Cmdm.
map bindValue:#SelectToEnd to:#CtrlE. "that is ctrl-shift-e"
map bindValue:#SelectFromBeginning to:#CtrlA. "that is ctrl-shift-a"
map bindValue:#ExpandSelectionByLine to:#Ctrll. "try multiple Ctrl-l's ..."
"Notice:
Cmd-CursorLeft/Right and Alt-CursorLeft/Right
are also used by some winmdowmanagers (fvwm)
if this is the case on your system, either
change the following to use different keys,
or change the windowmanagers configuration file
(usr/lib/X11/xxxwm/*rc).
The above is the reason that the following defines Ctrl-xxx
as an alternative (mwm in the INDY also uses the alt-sequences)
"
map bindValue:#FocusNext to:#CmdCursorRight. "experimental"
map bindValue:#FocusPrevious to:#CmdCursorLeft. "experimental"
map bindValue:#FocusNext to:#CmdCursorDown. "experimental"
map bindValue:#FocusPrevious to:#CmdCursorUp. "experimental"
map bindValue:#FocusNext to:#AltCursorRight. "experimental"
map bindValue:#FocusPrevious to:#AltCursorLeft. "experimental"
map bindValue:#FocusNext to:#AltCursorDown. "experimental"
map bindValue:#FocusPrevious to:#AltCursorUp. "experimental"
"/ map bindValue:#FocusNext to:#CtrlCursorRight. "experimental"
"/ map bindValue:#FocusPrevious to:#CtrlCursorLeft. "experimental"
map bindValue:#NonInsertingTab to:#ShiftTab.
"/ map bindValue:#BackTab to:#ShiftTab.
map bindValue:#BackTab to:#CtrlTab.
map bindValue:#NonInsertingTab to:#'ISO_Left_Tab'.
"/ map bindValue:#ToggleTabs to:#CtrlTab.
"/ map bindValue:#FocusNext to:#CtrlTab. "experimental"
map bindValue:#FocusNext to:#CmdTab. "experimental"
"/ map bindValue:#FocusPrevious to:#'ISO_Left_Tab'.
map bindValue:#FocusPrevious to:#'CmdISO_Left_Tab'.
"/ map bindValue:#Tab to:#'ISO_Left_Tab'.
map bindValue:#Menu to:#Cmdz.
"*
* ISO LATIN 1 symbolic characters - map to iso8859 values
* not all Xservers send those correctly.
* As a fall back, dieresis mappings using Alt-key sequences are found at
* the end.
*"
#(
"/ dieresis characters
Udiaeresis 16rDC
Adiaeresis 16rC4
Odiaeresis 16rD6
udiaeresis 16rFC
adiaeresis 16rE4
odiaeresis 16rF6
ydiaeresis 16rFF
"/ grave
Agrave 16rC0
Egrave 16rC8
Igrave 16rCC
Ograve 16rCC
Ugrave 16rD9
agrave 16rE0
egrave 16rE8
igrave 16rEC
ograve 16rF2
ugrave 16rF9
"/ acute
Aacute 16rC1
Eacute 16rC9
Iacute 16rCD
Oacute 16rD3
Uacute 16rDA
Yacute 16rDD
aacute 16rE1
eacute 16rE9
iacute 16rED
oacute 16rF3
uacute 16rFA
yacute 16rFD
"/ circumflex
Acircumflex 16rC2
Ecircumflex 16rCA
Icircumflex 16rCE
Ocircumflex 16rD4
Ucircumflex 16rDB
acircumflex 16rE2
ecircumflex 16rEA
icircumflex 16rEE
ocircumflex 16rF4
ucircumflex 16rFB
"/ tilde
Atilde 16rC3
Ntilde 16rD1
atilde 16rE3
ntilde 16rF1
"/ ring
Aring 16rC4
aring 16rE4
"/ ligatures
AE 16rC5
ae 16rE5
ssharp 16rDF
"/ cedilla
Ccedilla 16rC7
ccedilla 16rE7
"/ slashed
Ooblique 16rD8
oslash 16rF8
"/ misc (if on your keyboard)
Eth 16rD0 "/ some old servers still use this
ETH 16rD0
eth 16rF0
multiply 16rD7
Thorn 16rDE "/ some old servers still use this
THORN 16rDE "/ some old servers still use this
division 16rF7
thorn 16rFE
section 16rA7
degree 16rB0
twosuperior 16rB2
threesuperior 16rB3
mu 16rB5
) pairWiseDo:[:symbolic :numeric |
map bindValue:(Character value:numeric) to:symbolic.
].
"*
* need more here (katakana, arabic, cyrillic, greek etc.)
*"
"*
* numeric keypad - binding to normal numeric keys
*"
"/ map bindValue:$0 to:#'KP_Insert'.
"/ map bindValue:$1 to:#'KP_End'.
"/ map bindValue:$2 to:#'KP_Down'.
"/ map bindValue:$3 to:#'KP_Next'.
"/ map bindValue:$4 to:#'KP_Left'.
"/ map bindValue:$5 to:#'KP_Begin'.
"/ map bindValue:$6 to:#'KP_Right'.
"/ map bindValue:$7 to:#'KP_Home'.
"/ map bindValue:$8 to:#'KP_Up'.
"/ map bindValue:$9 to:#'KP_Prior'.
map bindValue:#Return to:#'KP_Enter'.
map bindValue:#Delete to:#'KP_Delete'.
"/ remove these lines, if your keyboard has a COMPOSE-key.
"/ None of our Xdisplays here has one - so we simulate it using CTRL-R ...
"/ which on some (of our) servers comes pretranslated as Multi_key,
"/ CtrlMulti_key or even Mode_switch.
map bindValue:#Compose to:#'Control_R'. "/ the right compose key
"/ map bindValue:#Compose to:#'Control_L'. "/ the right compose key
map bindValue:#Compose to:#'Multi_key'. "/ the right compose key
map bindValue:#Compose to:#'CtrlMulti_key'. "/ the right compose key
"/ map bindValue:#Compose to:#'Mode_switch'.
"/ a kludge: some Xservers send #Delete for both the backspace
"/ and the Delete key. In this case, we use the Backspace function
"/ for both keys. If your Xserver does not do this (it should not)
"/ remove or comment the following 'bindValue:#BackSpace'-line:
"/
"/ map bindValue:#BackSpace to:#Delete.
"/
"/ my personal preferences - comment it, if you do not like them
"/ bind function and other keys as:
"/
"/ F1 - help
"/ F2 - completion
"/ F3 - comment-it
"/ F4 - uncomment-it
"/ F5 - paste shell output
"/ F8 - again
"/ F9 - undent by 4
"/ F10 - indent by 4
"/ Control-R - Compose key
"/ Break - UserInterrupt
"/
"/ convenient functions on the keyboard
"/
map bindValue:#Help to:#F1.
map bindValue:#Again to:#F8.
map bindValue:#UserInterrupt to:#Break.
map bindValue:#UserInterrupt to:#CtrlBreak.
"/ map bindValue:#PrintIt to:#Print. "/ called PrintScreen on most keyboards
"/ map bindValue:#InspectIt to:#Execute. "/ called SysReq on most keyboards
map bindValue:#SaveAs to:#CmdS.
"/ xxxF5 -> macro ReplaceSelectionByUnixCommandsOutput (unix command output paste)
"/ CtrlTab -> macro ToggleTabs (toggle 4/8 tabs)
"/ F10 -> macro IndentBy4 (indent by 4)
"/ F9 -> macro UndentBy4 (undent by 4)
"/ F12 -> macro IndentBy1 (indent by 1)
"/ F11 -> macro UndentBy1 (undent by 1)
"/ F2 -> completion
"/ F3 -> commentSelection
"/ F4 -> uncommentSelection
"/ map bindValue:#ReplaceSelectionByUnixCommandsOutput to:#F5.
"/ map bindValue:#CmdF97 to:#F7.
"/ map bindValue:#CmdF96 to:#F6.
map bindValue:#IndentBy4 to:#F10.
map bindValue:#UndentBy4 to:#F9.
map bindValue:#IndentBy1 to:#F12.
map bindValue:#UndentBy1 to:#F11.
map bindValue:#ConvertSelectionToLowercaseOrUppercaseOrUppercaseFirst to:#F6.
map bindValue:#ConvertSelectionToUppercase to:#CtrlF6.
map bindValue:#CommentSelection to:#F3.
map bindValue:#UncommentSelection to:#F4.
map bindValue:#ParenthizeSelection to:#'Cmd('.
map bindValue:#UnparenthizeSelection to:#'Cmd)'.
"/ map bindValue:#LearnKeyboardMacro to:#CmdL.
"/ map bindValue:#ExecuteKeyboardMacro to:#CmdM.
map bindValue:#LearnKeyboardMacro to:#CtrlF2.
map bindValue:#ExecuteKeyboardMacro to:#CmdF2.
map bindValue:#CodeCompletion to:#F2.
map bindValue:#CodeCompletion to:#'Ctrl '.
"/ map bindValue:#PasteBlockEvaluationsOutput to:#CmdV.
"/
"/ since some of my machines have german keyboards ;-)
"/ and I like to be able to edit my files on all machines,
"/ I need a translation in both ways.
"/ you'd normally not define things in both directions.
"/
"/ actually, these things belong into the servers modmap or
"/ into a display specific d_<displayName>.rc ...
"/
"/ german national characters on a US keyboard:
"/ comment this, if you have a german keyboard.
"/
"/map bindValue:(Character value:16rFC) to:#'Cmd['. "/ u dieresis
"/map bindValue:(Character value:16rE4) to:#'Cmd'''. "/ a dieresis
"/map bindValue:(Character value:16rF6) to:#'Cmd;'. "/ o dieresis
"/map bindValue:(Character value:16rDC) to:#'Cmd{'. "/ U dieresis
"/map bindValue:(Character value:16rC4) to:#'Cmd"'. "/ A dieresis
"/map bindValue:(Character value:16rD6) to:#'Cmd:'. "/ O dieresis
"/map bindValue:(Character value:16rDF) to:#'Cmd-'. "/ s-sharp
"/
"/ US characters on national keyboards:
"/ (on many national keyboards, the x-server does NOT correctly
"/ xlate characters .... on others, it does and you may remove/comment
"/ the following.)
"/
map bindValue:$[ to:#'Alt['.
map bindValue:$] to:#'Alt]'.
map bindValue:$| to:#'Alt|'.
map bindValue:${ to:#'Alt{'.
map bindValue:$} to:#'Alt}'.
map bindValue:$\ to:#'Alt\'.
map bindValue:$~ to:#'Alt~'.
map bindValue:$@ to:#'Alt@'.
map bindValue:$[ to:#'Cmd['.
map bindValue:$] to:#'Cmd]'.
map bindValue:$| to:#'Cmd|'.
map bindValue:${ to:#'Cmd{'.
map bindValue:$} to:#'Cmd}'.
map bindValue:$\ to:#'Cmd\'.
map bindValue:$~ to:#'Cmd~'.
map bindValue:$@ to:#'Cmd@'.
map bindValue:$# to:#'Cmd#'.
map bindValue:#UserInterrupt to:#'Cmd.' . "/ for squeak compatibility
!