author | Claus Gittinger <cg@exept.de> |
Wed, 07 Jul 1999 16:10:29 +0200 | |
changeset 370 | 9aeb341c2dac |
parent 356 | 4275f251cb37 |
child 374 | ed55af1bd548 |
permissions | -rw-r--r-- |
41 | 1 |
"* |
2 |
* $Header$ |
|
3 |
* |
|
209 | 4 |
* ST/X startup configuration file: |
5 |
* |
|
41 | 6 |
* sample keyboard.rc - file |
7 |
* |
|
8 |
* this file defines some keyboard macros and adds mappings for |
|
54 | 9 |
* common function keys. These definitions used to be in 'private.rc', |
41 | 10 |
* but have been extracted into this separate file to allow easier |
11 |
* sharing of rc files (users having different private files, but want |
|
54 | 12 |
* to use the same keyboard mappings / keyboard macros) |
41 | 13 |
* |
54 | 14 |
* a copy of this file can reside in $home/.smalltalk/keyboard.rc or |
15 |
* in the current directory. |
|
16 |
* |
|
17 |
* these are my personal preferrences which may not be |
|
18 |
* correct for your environment |
|
41 | 19 |
*" |
20 |
||
86 | 21 |
|macros| |
41 | 22 |
|
23 |
"/ |
|
24 |
"/ define some keyboard macros as virtual function-keys: |
|
25 |
"/ Cmd-F99: paste the output of a selected unix command .. |
|
26 |
"/ Cmd-F98: toggle between 4 and 8 col tab setting |
|
27 |
"/ Cmd-F96: pipe text through spelling checker and collect its output |
|
28 |
"/ Cmd-F97: get next entry from spell-list, search and highlight it |
|
370
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
29 |
"/ Cmd-F95: indents selection-line by 4 |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
30 |
"/ Cmd-F94: undents selection-line by 4 |
41 | 31 |
"/ |
86 | 32 |
|
41 | 33 |
macros := Smalltalk at:#FunctionKeySequences. |
34 |
macros isNil ifTrue:[ |
|
35 |
macros := IdentityDictionary new. |
|
36 |
Smalltalk at:#FunctionKeySequences put:macros. |
|
37 |
]. |
|
38 |
||
86 | 39 |
"/ |
40 |
"/ macro to replace a text selection by unix commands output |
|
41 |
"/ |
|
42 |
||
41 | 43 |
macros at:#F99 put:' |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
44 |
"replace selection by |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
45 |
corresponding |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
46 |
unix commands output" |
41 | 47 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
48 |
|sel| |
41 | 49 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
50 |
sel := self selection. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
51 |
sel notNil ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
52 |
self replace: |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
53 |
(PipeStream readingFrom:(sel asString)) |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
54 |
contents asString |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
55 |
]'. |
41 | 56 |
|
86 | 57 |
"/ |
41 | 58 |
"/ macro to toggle tabs |
86 | 59 |
"/ |
41 | 60 |
macros at:#F98 put:' |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
61 |
"toggle between 4-col |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
62 |
and 8-col tabs" |
41 | 63 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
64 |
(tabPositions == self class tab4Positions) |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
65 |
ifTrue:[self setTab8] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
66 |
ifFalse:[self setTab4]'. |
41 | 67 |
|
86 | 68 |
"/ |
41 | 69 |
"/ macro to get next spelling error, and select it |
86 | 70 |
"/ |
41 | 71 |
macros at:#F97 put:' |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
72 |
|errs thisErr sl sc| |
41 | 73 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
74 |
thisErr := Smalltalk at:#''_thisError''. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
75 |
thisErr isNil ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
76 |
errs := Smalltalk at:#''_spellOutput''. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
77 |
(errs notNil and:[errs notEmpty]) ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
78 |
thisErr := errs removeFirst. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
79 |
errs isEmpty ifTrue:[Smalltalk removeKey:''_spellOut''] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
80 |
]. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
81 |
Smalltalk at:#''_lastErrLine'' put:1. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
82 |
Smalltalk at:#''_lastErrCol'' put:1. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
83 |
]. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
84 |
thisErr notNil ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
85 |
sl := Smalltalk at:#''_lastErrLine''. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
86 |
sc := Smalltalk at:#''_lastErrCol''. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
87 |
self searchForwardFor:thisErr |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
88 |
startingAtLine:sl col:sc |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
89 |
ifFound:[:fl :fc | self selectWordAtLine:fl col:fc. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
90 |
Smalltalk at:#''_lastErrLine'' put:fl. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
91 |
Smalltalk at:#''_lastErrCol'' put:fc+1] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
92 |
ifAbsent:[self device beep] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
93 |
]'. |
41 | 94 |
|
86 | 95 |
"/ |
41 | 96 |
"/ macro to send contents to spell; remember spelling errors |
97 |
"/ does not work on all systems (some do not have spell ...) |
|
86 | 98 |
"/ |
41 | 99 |
macros at:#F96 put:' |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
100 |
|p f s| |
41 | 101 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
102 |
f := Filename newTemporary. s := f writeStream. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
103 |
s nextPutAll:self contents asString. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
104 |
s close. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
105 |
p := PipeStream readingFrom:''spell '' , f pathName. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
106 |
Smalltalk at:#''_spellOutput'' put:p contents asString asCollectionOfLines. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
107 |
p close. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
108 |
self information:''F7 positions on the next spelling error''. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
109 |
'. |
41 | 110 |
|
86 | 111 |
"/ |
41 | 112 |
"/ macro to indent by 4 |
86 | 113 |
"/ |
41 | 114 |
macros at:#F95 put:' |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
115 |
"indent selected line-range |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
116 |
by 4 spaces (i.e. to the right)" |
41 | 117 |
|
370
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
118 |
|line1 line2| |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
119 |
|
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
120 |
line1 := self selectionStartLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
121 |
line2 := self selectionEndLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
122 |
line1 isNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
123 |
line1 := self perform:#cursorLine ifNotUnderstood:nil. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
124 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
125 |
line2 := line1+1 |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
126 |
] |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
127 |
]. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
128 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
129 |
line1 to:line2-1 do:[:lineNr | |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
130 |
|line| |
41 | 131 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
132 |
line := self listAt:lineNr. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
133 |
line notNil ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
134 |
line notEmpty ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
135 |
line := '' '' , line. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
136 |
self withoutRedrawAt:lineNr put:line. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
137 |
self invalidateLine:lineNr. |
41 | 138 |
] |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
139 |
] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
140 |
]. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
141 |
] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
142 |
'. |
86 | 143 |
|
144 |
"/ |
|
41 | 145 |
"/ macro to undent by 4 |
86 | 146 |
"/ |
41 | 147 |
macros at:#F94 put:' |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
148 |
"undent selected line-range |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
149 |
by 4 spaces (i.e. to the left)" |
41 | 150 |
|
370
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
151 |
|line1 line2| |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
152 |
|
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
153 |
line1 := self selectionStartLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
154 |
line2 := self selectionEndLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
155 |
line1 isNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
156 |
line1 := self perform:#cursorLine ifNotUnderstood:nil. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
157 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
158 |
line2 := line1+1 |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
159 |
] |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
160 |
]. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
161 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
162 |
line1 to:line2-1 do:[:lineNr | |
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
163 |
|line| |
41 | 164 |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
165 |
line := self listAt:lineNr. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
166 |
line notNil ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
167 |
line notEmpty ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
168 |
(line startsWith:'' '') ifTrue:[ |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
169 |
line := line copyFrom:5. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
170 |
self withoutRedrawAt:lineNr put:line. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
171 |
self invalidateLine:lineNr. |
41 | 172 |
] |
173 |
] |
|
288
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
174 |
] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
175 |
]. |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
176 |
] |
ffd914a69270
better indent/undent behavior (delayed redraw)
Claus Gittinger <cg@exept.de>
parents:
255
diff
changeset
|
177 |
'. |
292 | 178 |
"/ |
179 |
"/ macro to indent by 1 |
|
180 |
"/ |
|
181 |
macros at:#F93 put:' |
|
182 |
"indent selected line-range |
|
183 |
by 1 space (i.e. to the right)" |
|
184 |
||
370
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
185 |
|line1 line2| |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
186 |
|
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
187 |
line1 := self selectionStartLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
188 |
line2 := self selectionEndLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
189 |
line1 isNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
190 |
line1 := self perform:#cursorLine ifNotUnderstood:nil. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
191 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
192 |
line2 := line1+1 |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
193 |
] |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
194 |
]. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
195 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
196 |
line1 to:line2-1 do:[:lineNr | |
292 | 197 |
|line| |
198 |
||
199 |
line := self listAt:lineNr. |
|
200 |
line notNil ifTrue:[ |
|
201 |
line notEmpty ifTrue:[ |
|
202 |
line := '' '' , line. |
|
203 |
self withoutRedrawAt:lineNr put:line. |
|
204 |
self invalidateLine:lineNr. |
|
205 |
] |
|
206 |
] |
|
207 |
]. |
|
208 |
] |
|
209 |
'. |
|
210 |
||
211 |
"/ |
|
212 |
"/ macro to undent by 1 |
|
213 |
"/ |
|
214 |
macros at:#F92 put:' |
|
215 |
"undent selected line-range |
|
216 |
by 1 space (i.e. to the left)" |
|
217 |
||
370
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
218 |
|line1 line2| |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
219 |
|
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
220 |
line1 := self selectionStartLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
221 |
line2 := self selectionEndLine. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
222 |
line1 isNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
223 |
line1 := self perform:#cursorLine ifNotUnderstood:nil. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
224 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
225 |
line2 := line1+1 |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
226 |
] |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
227 |
]. |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
228 |
line1 notNil ifTrue:[ |
9aeb341c2dac
if no selection, indent/undent the cursorLine
Claus Gittinger <cg@exept.de>
parents:
356
diff
changeset
|
229 |
line1 to:line2-1 do:[:lineNr | |
292 | 230 |
|line| |
231 |
||
232 |
line := self listAt:lineNr. |
|
233 |
line notNil ifTrue:[ |
|
234 |
line notEmpty ifTrue:[ |
|
235 |
(line startsWith:'' '') ifTrue:[ |
|
236 |
line := line copyFrom:2. |
|
237 |
self withoutRedrawAt:lineNr put:line. |
|
238 |
self invalidateLine:lineNr. |
|
239 |
] |
|
240 |
] |
|
241 |
] |
|
242 |
]. |
|
243 |
] |
|
244 |
'. |
|
86 | 245 |
! |
246 |
||
92 | 247 |
"* |
248 |
* key bindings common to all display types |
|
249 |
* use event monitor, to see what the Xserver sends us; |
|
250 |
* put display-specific stuff into a d_hostName.rc file. |
|
251 |
*" |
|
86 | 252 |
|map| |
253 |
||
254 |
map := Display keyboardMap. |
|
255 |
||
252
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
256 |
(Display serverVendor startsWith:'DECWINDOWS') ifTrue:[ |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
257 |
"/ DEC has messed up the ESC key completely. |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
258 |
"/ map ALT-` onto ESC for our convenience. |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
259 |
"/ |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
260 |
"/ also, the right compose key (comes in as 'AltMulti_key' or |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
261 |
"/ 'CtrlMulti_key' depending on the keyboard) is mapped |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
262 |
"/ to 'Compose'. |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
263 |
map bindValue:#Escape to:#'Cmd`'. |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
264 |
map bindValue:#Compose to:#'AltMulti_key'. "/ the right compose key |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
265 |
|
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
266 |
map bindValue:#Return to:#'KP_Enter'. "/ the keypads return key |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
267 |
]. |
5d4a68556e45
ESC & Compose keys on DEC keyboards
Claus Gittinger <cg@exept.de>
parents:
209
diff
changeset
|
268 |
|
299 | 269 |
map bindValue:#'Alt' to:#'Super_L'. |
270 |
map bindValue:#'Alt' to:#'Hyper_R'. |
|
271 |
||
92 | 272 |
map bindValue:#UserInterrupt to:#Ctrlc. "interrupt window process" |
290 | 273 |
map bindValue:#UserAbort to:#Ctrly. "abort window process, but no debugger" |
92 | 274 |
map bindValue:#FlushInput to:#CtrlX. "flush typeahead input" |
275 |
map bindValue:#DestroyView to:#CmdCtrlX. "to destroy dead views" |
|
276 |
map bindValue:#DestroyTopView to:#CmdCtrlx. "to destroy dead views" |
|
277 |
||
278 |
map bindValue:#DoIt to:#Cmdd. "i.e. Cmd-d / Alt-d (sometimes Meta-d)" |
|
279 |
map bindValue:#InspectIt to:#Cmdi. "evaluate & inspect result" |
|
280 |
map bindValue:#PrintIt to:#Cmdp. "evaluate and paste result" |
|
281 |
||
282 |
map bindValue:#Copy to:#Cmdc. "copy selection to buffer" |
|
283 |
map bindValue:#Cut to:#Cmdx. "cut selection into buffer" |
|
284 |
map bindValue:#Paste to:#Cmdv. "paste buffer or external selection" |
|
285 |
map bindValue:#Replace to:#Cmdr. "same as paste" |
|
286 |
map bindValue:#Find to:#Cmds. "open searchbox" |
|
287 |
map bindValue:#FindNext to:#Cmdf. "search fwd for last searchpattern or selection" |
|
288 |
map bindValue:#FindPrev to:#Cmdb. "search bwd for last searchpattern or selection" |
|
289 |
map bindValue:#SelectAll to:#CmdA. "that is Alt-shift-a" |
|
290 |
map bindValue:#GotoLine to:#Cmdg. |
|
291 |
map bindValue:#SelectWord to:#Cmdw. "select word under cursor" |
|
292 |
||
293 |
map bindValue:#Accept to:#Cmda. |
|
294 |
map bindValue:#Explain to:#Cmde. |
|
295 |
map bindValue:#Explain to:#Cmdh. |
|
296 |
||
297 |
map bindValue:#DeleteLine to:#Ctrlx. |
|
298 |
||
299 |
map bindValue:#NextPage to:#Next. "typically labelled PageDown on keyboard" |
|
300 |
map bindValue:#PreviousPage to:#Prior. "typically labelled PageUp on keyboard" |
|
301 |
||
302 |
map bindValue:#PreviousPage to:#Ctrlb. "vi behavior" |
|
303 |
map bindValue:#NextPage to:#Ctrlf. "vi behavior" |
|
304 |
map bindValue:#HalfPageUp to:#Ctrlu. |
|
305 |
map bindValue:#HalfPageDown to:#Ctrld. |
|
306 |
||
307 |
map bindValue:#BeginOfText to:#Home. "some prefer to bind #BeginOfLine to #Home" |
|
308 |
map bindValue:#EndOfText to:#End. "some prefer to bind #EndOfLine to #End" |
|
309 |
map bindValue:#BeginOfLine to:#Ctrla. |
|
310 |
map bindValue:#EndOfLine to:#Ctrle. |
|
311 |
map bindValue:#NextWord to:#Ctrlw. |
|
312 |
map bindValue:#NextWord to:#CtrlCursorRight. |
|
313 |
map bindValue:#PreviousWord to:#CtrlCursorLeft. |
|
314 |
||
315 |
map bindValue:#ScrollUp to:#CtrlCursorUp. |
|
316 |
map bindValue:#ScrollDown to:#CtrlCursorDown. |
|
317 |
||
318 |
map bindValue:#SearchMatchingParent to:#Ctrlm. |
|
319 |
map bindValue:#SelectMatchingParents to:#Cmdm. |
|
320 |
||
321 |
map bindValue:#SelectToEnd to:#CtrlE. "that is ctrl-shift-e" |
|
322 |
map bindValue:#SelectFromBeginning to:#CtrlA. "that is ctrl-shift-a" |
|
323 |
map bindValue:#ExpandSelectionByLine to:#Ctrll. "try multiple Ctrl-l's ..." |
|
324 |
||
325 |
"Notice: |
|
326 |
Cmd-CursorLeft/Right and Alt-CursorLeft/Right |
|
327 |
are also used by some winmdowmanagers (fvwm) |
|
328 |
if this is the case on your system, either |
|
329 |
change the following to use different keys, |
|
330 |
or change the windowmanagers configuration file |
|
331 |
(usr/lib/X11/xxxwm/*rc). |
|
332 |
The above is the reason that the following defines Ctrl-xxx |
|
333 |
as an alternative (mwm in the INDY also uses the alt-sequences) |
|
334 |
" |
|
335 |
map bindValue:#FocusNext to:#CmdCursorRight. "experimental" |
|
336 |
map bindValue:#FocusPrevious to:#CmdCursorLeft. "experimental" |
|
337 |
map bindValue:#FocusNext to:#AltCursorRight. "experimental" |
|
338 |
map bindValue:#FocusPrevious to:#AltCursorLeft. "experimental" |
|
255 | 339 |
map bindValue:#FocusNext to:#AltCursorDown. "experimental" |
340 |
map bindValue:#FocusPrevious to:#AltCursorUp. "experimental" |
|
92 | 341 |
"/ map bindValue:#FocusNext to:#CtrlCursorRight. "experimental" |
342 |
"/ map bindValue:#FocusPrevious to:#CtrlCursorLeft. "experimental" |
|
343 |
||
344 |
map bindValue:#FocusNext to:#CtrlTab. "experimental" |
|
138 | 345 |
map bindValue:#FocusNext to:#CmdTab. "experimental" |
92 | 346 |
|
347 |
map bindValue:#Menu to:#Cmdz. |
|
348 |
||
122 | 349 |
"* |
350 |
* ISO LATIN 1 symbolic characters - map to iso8859 values |
|
351 |
* not all Xservers send those correctly. |
|
352 |
* As a fall back, dieresis mappings using Alt-key sequences are found at |
|
353 |
* the end. |
|
92 | 354 |
*" |
122 | 355 |
|
356 |
#( |
|
357 |
"/ dieresis characters |
|
358 |
||
359 |
Udiaeresis 16rDC |
|
360 |
Adiaeresis 16rC4 |
|
361 |
Odiaeresis 16rD6 |
|
362 |
udiaeresis 16rFC |
|
363 |
adiaeresis 16rE4 |
|
364 |
odiaeresis 16rF6 |
|
365 |
ydiaeresis 16rFF |
|
366 |
||
367 |
"/ grave |
|
368 |
||
369 |
Agrave 16rC0 |
|
370 |
Egrave 16rC8 |
|
371 |
Igrave 16rCC |
|
372 |
Ograve 16rCC |
|
373 |
Ugrave 16rD9 |
|
374 |
agrave 16rE0 |
|
375 |
egrave 16rE8 |
|
376 |
igrave 16rEC |
|
377 |
ograve 16rF2 |
|
378 |
ugrave 16rF9 |
|
379 |
||
380 |
"/ acute |
|
381 |
||
382 |
Aacute 16rC1 |
|
383 |
Eacute 16rC9 |
|
384 |
Iacute 16rCD |
|
385 |
Oacute 16rD3 |
|
386 |
Uacute 16rDA |
|
387 |
Yacute 16rDD |
|
388 |
aacute 16rE1 |
|
389 |
eacute 16rE9 |
|
390 |
iacute 16rED |
|
391 |
oacute 16rF3 |
|
392 |
uacute 16rFA |
|
393 |
yacute 16rFD |
|
394 |
||
395 |
"/ circumflex |
|
396 |
||
397 |
Acircumflex 16rC2 |
|
398 |
Ecircumflex 16rCA |
|
399 |
Icircumflex 16rCE |
|
400 |
Ocircumflex 16rD4 |
|
401 |
Ucircumflex 16rDB |
|
402 |
acircumflex 16rE2 |
|
403 |
ecircumflex 16rEA |
|
404 |
icircumflex 16rEE |
|
405 |
ocircumflex 16rF4 |
|
406 |
ucircumflex 16rFB |
|
407 |
||
408 |
"/ tilde |
|
409 |
||
410 |
Atilde 16rC3 |
|
411 |
Ntilde 16rD1 |
|
412 |
atilde 16rE3 |
|
413 |
ntilde 16rF1 |
|
414 |
||
415 |
"/ ring |
|
416 |
||
417 |
Aring 16rC4 |
|
418 |
aring 16rE4 |
|
419 |
||
420 |
"/ ligatures |
|
421 |
||
422 |
AE 16rC5 |
|
423 |
ae 16rE5 |
|
424 |
ssharp 16rDF |
|
425 |
||
426 |
"/ cedilla |
|
427 |
||
428 |
Ccedilla 16rC7 |
|
429 |
ccedilla 16rE7 |
|
430 |
||
431 |
"/ slashed |
|
432 |
||
433 |
Ooblique 16rD8 |
|
434 |
oslash 16rF8 |
|
435 |
||
436 |
"/ misc (if on your keyboard) |
|
437 |
||
438 |
Eth 16rD0 "/ some old servers still use this |
|
439 |
ETH 16rD0 |
|
440 |
eth 16rF0 |
|
441 |
multiply 16rD7 |
|
442 |
Thorn 16rDE "/ some old servers still use this |
|
443 |
THORN 16rDE "/ some old servers still use this |
|
444 |
division 16rF7 |
|
445 |
thorn 16rFE |
|
446 |
||
447 |
section 16rA7 |
|
448 |
degree 16rB0 |
|
449 |
twosuperior 16rB2 |
|
450 |
threesuperior 16rB3 |
|
451 |
mu 16rB5 |
|
452 |
) pairWiseDo:[:symbolic :numeric | |
|
453 |
map bindValue:(Character value:numeric) to:symbolic. |
|
454 |
]. |
|
92 | 455 |
|
456 |
"* |
|
122 | 457 |
* need more here (katakana, arabic, cyrillic, greek etc.) |
92 | 458 |
*" |
459 |
||
460 |
"* |
|
461 |
* numeric keypad - binding to normal numeric keys |
|
462 |
*" |
|
463 |
"/ map bindValue:$0 to:#'KP_Insert'. |
|
464 |
"/ map bindValue:$1 to:#'KP_End'. |
|
465 |
"/ map bindValue:$2 to:#'KP_Down'. |
|
466 |
"/ map bindValue:$3 to:#'KP_Next'. |
|
467 |
"/ map bindValue:$4 to:#'KP_Left'. |
|
468 |
"/ map bindValue:$5 to:#'KP_Begin'. |
|
469 |
"/ map bindValue:$6 to:#'KP_Right'. |
|
470 |
"/ map bindValue:$7 to:#'KP_Home'. |
|
471 |
"/ map bindValue:$8 to:#'KP_Up'. |
|
472 |
"/ map bindValue:$9 to:#'KP_Prior'. |
|
473 |
"/ map bindValue:#Retrun to:#'KP_Enter'. |
|
474 |
"/ map bindValue:#Backspace to:#'KP_Delete'. |
|
475 |
||
476 |
||
86 | 477 |
"/ remove these lines, if your keyboard has a COMPOSE-key. |
478 |
"/ None of our Xdisplays here has one - so we simulate it using CTRL-R ... |
|
479 |
"/ which on some (of our) servers comes pretranslated as Multi_key, |
|
327 | 480 |
"/ CtrlMulti_key or even Mode_switch. |
86 | 481 |
|
327 | 482 |
map bindValue:#Compose to:#'Control_R'. "/ the right compose key |
483 |
map bindValue:#Compose to:#'Multi_key'. "/ the right compose key |
|
484 |
map bindValue:#Compose to:#'CtrlMulti_key'. "/ the right compose key |
|
140 | 485 |
"/ map bindValue:#Compose to:#'Mode_switch'. |
86 | 486 |
|
487 |
||
488 |
"/ a kludge: some Xservers send #Delete for both the backspace |
|
489 |
"/ and the Delete key. In this case, we use the Backspace function |
|
490 |
"/ for both keys. If your Xserver does not do this (it should not) |
|
491 |
"/ remove or comment the following 'bindValue:#BackSpace'-line: |
|
492 |
"/ |
|
493 |
||
356 | 494 |
"/ map bindValue:#BackSpace to:#Delete. |
86 | 495 |
|
41 | 496 |
"/ |
497 |
"/ my personal preferences - comment it, if you do not like them |
|
498 |
"/ bind function and other keys as: |
|
499 |
"/ |
|
500 |
"/ F1 - again |
|
501 |
"/ F3 - comment-it |
|
502 |
"/ F4 - uncomment-it |
|
503 |
"/ F5 - paste shell output |
|
504 |
"/ F9 - undent by 4 |
|
505 |
"/ F10 - indent by 4 |
|
506 |
"/ Control-R - Compose key |
|
507 |
"/ Break - UserInterrupt |
|
508 |
||
509 |
"/ |
|
510 |
"/ convenient functions on the keyboard |
|
511 |
"/ |
|
512 |
map bindValue:#Again to:#F1. |
|
513 |
map bindValue:#UserInterrupt to:#Break. |
|
89 | 514 |
"/ map bindValue:#PrintIt to:#Print. "/ called PrintScreen on most keyboards |
515 |
"/ map bindValue:#InspectIt to:#Execute. "/ called SysReq on most keyboards |
|
41 | 516 |
|
88 | 517 |
map bindValue:#SaveAs to:#CmdS. |
518 |
||
347 | 519 |
"/ F5 -> macroF99 (unix command output paste) |
292 | 520 |
"/ CtrlTab -> macroF98 (toggle 4/8 tabs) |
521 |
"/ F10 -> macroF95 (indent by 4) |
|
522 |
"/ F9 -> macroF94 (undent by 4) |
|
523 |
"/ F12 -> macroF93 (indent by 1) |
|
524 |
"/ F11 -> macroF92 (undent by 1) |
|
525 |
"/ F3 -> commentSelection |
|
526 |
"/ F4 -> uncommentSelection |
|
41 | 527 |
|
528 |
map bindValue:#CmdF99 to:#F5. |
|
529 |
map bindValue:#CmdF98 to:#CtrlTab. |
|
530 |
"/ map bindValue:#CmdF97 to:#F7. |
|
531 |
"/ map bindValue:#CmdF96 to:#F6. |
|
532 |
map bindValue:#CmdF95 to:#F10. |
|
533 |
map bindValue:#CmdF94 to:#F9. |
|
534 |
||
292 | 535 |
map bindValue:#CmdF93 to:#F12. |
536 |
map bindValue:#CmdF92 to:#F11. |
|
537 |
||
41 | 538 |
map bindValue:#CommentSelection to:#F3. |
539 |
map bindValue:#UncommentSelection to:#F4. |
|
540 |
||
541 |
"/ |
|
542 |
"/ since some of my machines have german keyboards ;-) |
|
543 |
"/ and I like to be able to edit my files on all machines, |
|
544 |
"/ I need a translation in both ways. |
|
545 |
"/ you'd normally not define things in both directions. |
|
546 |
"/ |
|
57 | 547 |
"/ actually, these things belong into the servers modmap or |
548 |
"/ into a display specific d_<displayName>.rc ... |
|
41 | 549 |
"/ |
550 |
"/ german national characters on a US keyboard: |
|
140 | 551 |
"/ comment this, if you have a german keyboard. |
41 | 552 |
"/ |
140 | 553 |
"/map bindValue:(Character value:16rFC) to:#'Cmd['. "/ u dieresis |
554 |
"/map bindValue:(Character value:16rE4) to:#'Cmd'''. "/ a dieresis |
|
555 |
"/map bindValue:(Character value:16rF6) to:#'Cmd;'. "/ o dieresis |
|
556 |
"/map bindValue:(Character value:16rDC) to:#'Cmd{'. "/ U dieresis |
|
557 |
"/map bindValue:(Character value:16rC4) to:#'Cmd"'. "/ A dieresis |
|
558 |
"/map bindValue:(Character value:16rD6) to:#'Cmd:'. "/ O dieresis |
|
559 |
"/map bindValue:(Character value:16rDF) to:#'Cmd-'. "/ s-sharp |
|
41 | 560 |
|
561 |
"/ |
|
122 | 562 |
"/ US characters on national keyboards: |
563 |
"/ (on many national keyboards, the x-server does NOT correctly |
|
564 |
"/ xlate characters .... on others, it does and you may remove/comment |
|
565 |
"/ the following.) |
|
41 | 566 |
"/ |
567 |
map bindValue:$[ to:#'Alt['. |
|
568 |
map bindValue:$] to:#'Alt]'. |
|
569 |
map bindValue:$| to:#'Alt|'. |
|
570 |
map bindValue:${ to:#'Alt{'. |
|
57 | 571 |
map bindValue:$} to:#'Alt}'. |
122 | 572 |
map bindValue:$\ to:#'Alt\'. |
140 | 573 |
map bindValue:$~ to:#'Alt~'. |
574 |
map bindValue:$@ to:#'Alt@'. |
|
575 |
||
576 |
map bindValue:$[ to:#'Cmd['. |
|
577 |
map bindValue:$] to:#'Cmd]'. |
|
578 |
map bindValue:$| to:#'Cmd|'. |
|
579 |
map bindValue:${ to:#'Cmd{'. |
|
580 |
map bindValue:$} to:#'Cmd}'. |
|
581 |
map bindValue:$\ to:#'Cmd\'. |
|
582 |
map bindValue:$~ to:#'Cmd~'. |
|
583 |
map bindValue:$@ to:#'Cmd@'. |
|
584 |
||
122 | 585 |
|
41 | 586 |
! |