@@ -14,7 +14,8 @@ set-variable $mode-line "%s%r%u%k %b %l:%c - %h:%m (%e) %f"
14
14
set-variable $cursor-blink 250
15
15
set-variable $file-ignore "~ ./ .8 .o .a .exe"
16
16
set-variable $kept-version 10
17
- set-variable $tab-width 4
17
+ set-variable $indent-width 4
18
+ set-variable $tab-width 8
18
19
19
20
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20
21
;
@@ -24,12 +25,62 @@ set-variable $tab-width 4
24
25
25
26
add-file-hook ".go" fhook-go
26
27
28
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29
+ ;
30
+ ; Line handling
31
+ ;
32
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33
+
34
+ -1 global-mode "lf"
35
+
27
36
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28
37
;
29
38
; Helper Methods
30
39
;
31
40
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
32
41
42
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
43
+ ;
44
+ ; Complete what the two above lines have in common from the current cursor
45
+ ; position.
46
+ ;
47
+
48
+ define-macro complete-similar
49
+ ; #l0 is the starting column
50
+ ; #l1 is 2 lines back
51
+ ; #l2 is 1 line back
52
+ ; #l3 is the current length (mid string is taken from #l0 to #l3)
53
+ ; #l4 is the maximum length we should attempt (shorter len of #l1 and #l2)
54
+
55
+ set-variable #l0 $window-acol
56
+
57
+ 2 backward-line
58
+ set-variable #l1 @wl
59
+ forward-line
60
+ set-variable #l2 @wl
61
+ forward-line
62
+
63
+ set-variable #l4 &len #l1
64
+ !if &less &len #l2 #l4
65
+ set-variable #l4 &len #l2
66
+ !endif
67
+
68
+ set-variable #l3 1
69
+
70
+ !while &and &less &add #l0 &inc #l3 1 #l4 &sequal &mid #l1 #l0 #l3 &mid #l2 #l0 #l3
71
+ ; Loop while line 1 and line 2 strings are the same bound by #l0 and #l3
72
+ ; Each iteration #l3 is incremented by 1
73
+ !done
74
+
75
+ ; If we have reached the end of the string, do not deincrement by one which is
76
+ ; typically the failing condition from the above loop
77
+ !if ¬ &equal &add #l0 #l3 #l4
78
+ set-variable #l3 &sub #l3 1
79
+ !endif
80
+
81
+ insert-string &mid #l1 #l0 #l3
82
+ !emacro
83
+
33
84
; Align all subsequent lines containing #l0 to column #l1
34
85
define-macro align-char
35
86
set-variable .TheChar #p0
@@ -157,13 +208,13 @@ define-macro spotless
157
208
; go to column 1
158
209
define-macro smart-home
159
210
set-variable #l0 $window-acol
160
-
211
+
161
212
beginning-of-line
162
-
213
+
163
214
!while &sin @wc " \t"
164
215
!force forward-char
165
216
!done
166
-
217
+
167
218
!if &equal $window-acol #l0
168
219
beginning-of-line
169
220
!end
@@ -172,9 +223,9 @@ define-macro smart-home
172
223
; Delete from the current position to the character give via the user prompt
173
224
define-macro forward-delete-to
174
225
ml-write "Delete to: "
175
-
226
+
176
227
set-variable #l0 @cgk
177
-
228
+
178
229
!if &seq #l0 "C-g"
179
230
ml-write "Cancelled"
180
231
!else
@@ -187,14 +238,14 @@ define-macro forward-delete-to
187
238
; Delete from the current position to the character given via the user prompt
188
239
define-macro backward-delete-to
189
240
ml-write "Backward delete to: "
190
-
241
+
191
242
set-variable #l0 @cgk
192
-
243
+
193
244
!if &seq #l0 "C-g"
194
245
ml-write "Cancelled"
195
246
!else
196
247
backward-char
197
-
248
+
198
249
!while ¬ &seq @wc #l0
199
250
forward-delete-char
200
251
backward-char
@@ -281,3 +332,4 @@ global-bind-key next-buffer "A-right"
281
332
global-bind-key smart-home "home"
282
333
global-bind-key forward-delete-to "esc delete"
283
334
global-bind-key backward-delete-to "esc backspace"
335
+ global-bind-key complete-similar "esc space"
0 commit comments