-
Notifications
You must be signed in to change notification settings - Fork 3
/
smart-commands.html
589 lines (436 loc) · 16.1 KB
/
smart-commands.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Smart Commands</title>
<link rel="stylesheet" type="text/less" href="./style/less/o-blog.less"/>
<link rel="stylesheet" type="text/css" href="./style/keys.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="generator" content="o-blog version 1.2-137-gea23db7"/>
<link rel="stylesheet" href="./style/keys.css" type="text/css" />
<script src="./style/js/less-1.3.0.min.js" type="text/javascript"></script>
<script src="./style/js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="./style/bootstrap/js/bootstrap-modal.js" type="text/javascript"></script>
<script src="./style/bootstrap/js/bootstrap-transition.js" type="text/javascript"></script>
<script src="./style/bootstrap/js/bootstrap-dropdown.js" type="text/javascript"></script>
<script src="./style/bootstrap/js/bootstrap-collapse.js" type="text/javascript"></script>
<script src="./style/js/prettify.js" type="text/javascript"></script>
<script src="./style/js/o-blog.linenumber.js" type="text/javascript"></script>
<script src="./style/js/o-blog-fix.js" type="text/javascript"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="./index.html">ergoemacs-mode</a>
<div class="nav-collapse collapse">
<ul>
<li><a href="./features.html"><i>icon-cog icon-white</i> Features</a>
</li>
<li><a href="#"><i>icon-book icon-white</i> Documentation</a>
<ul>
<li><a href="./key-setup.html">Included Key Themes and Keyboard Layouts</a>
</li>
<li><a href="./cua-conflict.html">Preserving Emacs Commands while maintaining familiar shortcuts</a>
</li>
<li>
</li>
<li><a href="./key-themes.html">Key Themes</a>
</li>
<li><a href="./keyboard-layouts.html">Keyboard Layouts</a>
</li>
<li><a href="./minor-modes.html">Changes to Modes</a>
</li>
<li>
</li>
<li><a href="design-basis.html">Design Basis</a>
</li>
<li>
</li>
<li><a href="./faq.html">FAQ</a>
</li>
<li>
</li>
<li><a href="./bug-report.html">Bug report</a>
</li>
</ul>
</li>
<li><a href="#"><i>icon-file icon-white</i> Tips</a>
<ul>
<li><a href="./gradual-adoption.html">Gradual Adoption</a>
</li>
<li><a href="./system-wide.html">System Wide Keys</a>
</li>
<li><a href="./customize-keys.html">Customizing your keys</a>
</li>
<li>
</li>
<li><a href="./aliases.html">Making Commands Easier to Type</a>
</li>
<li><a href="./smart-commands.html">Smart Commands</a>
</li>
</ul>
</li>
<li><a href="./testimonials.html"><i>icon-comments-alt icon-white</i> Testimonials</a>
</li>
<li><a href="./changelog.html"><i>icon-pencil icon-white</i> Changelog</a>
</li>
<li><a href="./roadmap.html"><i>icon-tasks icon-white</i> Roadmap</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="subnav subnav-fixed visible-desktop">
<div class="container">
<ul class="breadcrumb">
<li><a href="./index.html">Home</a> <span class="divider">/</span></li>
<li>Smart Commands</li>
</ul>
</div>
</div>
<div id="page" class="container">
<article>
<div class="article-content">
<div id="outline-container-1" class="outline-3">
<h3 id="sec-1">Beginning of Line</h3>
<div class="outline-text-3" id="text-1">
<p>
Often you wish to move to the beginning of some part of a line. For
example:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
(ergoemacs-mode 1)) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.|</span>
</pre>
<p>
With the cursor <code>|</code> at the end of the line, you might want to go to
the beginning of the comment:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
(ergoemacs-mode 1)) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">|This turns ergoemacs-mode on.</span>
</pre>
<p>
That way you can delete and change the commment (With QWERTY 【Alt+g】).
</p>
<p>
You may even want to go to the end of the code line:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
(ergoemacs-mode 1))| <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.</span>
</pre>
<p>
That way you can delete the comment entirely (With QWERTY 【Alt+g】).
</p>
<p>
Often you may want to go back to the first non-whitespace character
of the line like:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
|(ergoemacs-mode 1)) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.</span>
</pre>
<p>
Or even the fist actual first character of the line:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
| (ergoemacs-mode 1)) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.</span>
</pre>
<p>
Once there it is not too useful to go to the beginning of the line
again. So, you may wish to:
</p><ul>
<li>Goto the last text block (separated by 2 new lines; default, <a href="http://ergoemacs.org/emacs/emacs_key_combo.html">why?</a>)
</li>
<li>Issue a page-up command
</li>
<li>Goto the beginning of the buffer
</li>
</ul>
<p>
All of these can be accomplished by the smart ergoemacs-mode
<code>beginning-of-line</code> function, which is bound to 【Alt+h】.
</p>
<p>
If you don't want ergoemacs-mode to ignore comments when going to the
beginning or end of the line you can change this behavior by:
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-end-of-comment-line nil)
</pre>
<p>
You may want to only go to the beginning of line, instead of the
beginning of the indentation (the first non whitespace character).
This can be changed by
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-back-to-indentation nil)
</pre>
<p>
You can change the command that is issued at the beginning of the
line by using one of the following commands.
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-beginning-or-end-of-line-and-what 'block) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Beginning</span>
<span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">of text block</span>
(setq ergoemacs-beginning-or-end-of-line-and-what 'page) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Page Up</span>
(setq ergoemacs-beginning-or-end-of-line-and-what 'buffer) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Beginning</span>
<span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">of Buffer</span>
</pre>
<p>
You may worry about smart mode-specific commands such as org-mode's
beginning or end of line. Don't worry ergoemacs-mode will respect
it, and do the right thing. This is because ergoemacs-mode actually
replaces the <code>move-beginning-line</code> with whatever the mode defines
<code>move-beginning-line</code> to be.
</p>
<p>
For example set:
</p>
<pre class="src src-emacs-lisp">(setq org-special-ctrl-a/e t)
</pre>
<p>
And then go to an <code>org-mode</code> headline:
</p>
<pre class="src src-org"><span style="font-weight: bold;">* </span><span style="font-weight: bold;">TODO</span><span style="font-weight: bold;"> Install ergoemacs-mode |</span>
</pre>
<p>
By pressing the beginning of line command, you would go to:
</p>
<pre class="src src-org"><span style="font-weight: bold;">* </span><span style="font-weight: bold;">TODO</span><span style="font-weight: bold;"> |Install ergoemacs-mode </span>
</pre>
<p>
As hoped/expected.
</p>
</div>
</div>
<div id="outline-container-2" class="outline-3">
<h3 id="sec-2">End of line</h3>
<div class="outline-text-3" id="text-2">
<p>
The end of line command for ergoemacs is just as smart as beginning
of line. For example if your cursor is <code>|</code>, and you are at:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
| (ergoemacs-mode 1)) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.</span>
</pre>
<p>
may wish to go to the end of the code block:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
(ergoemacs-mode 1))| <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.</span>
</pre>
<p>
or the end of the line:
</p>
<pre class="src src-emacs-lisp">(<span style="font-weight: bold;">progn</span>
(ergoemacs-mode 1)) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">This turns ergoemacs-mode on.|</span>
</pre>
<p>
The after that you can:
</p><ul>
<li>Goto the next text-block (default, <a href="http://ergoemacs.org/emacs/emacs_key_combo.html">why?</a>)
</li>
<li>Issue a PageDown command
</li>
<li>Goto the end of the buffer.
</li>
</ul>
<p>
Currently this command is bound to 【Alt+Shift+h】
</p>
<p>
You can ignore the comment feature by the following initialization code:
</p>
<p>
You can change the command that is issued at the end of the
line by using one of the following commands.
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-beginning-or-end-of-line-and-what 'block) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">End</span>
<span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">of text block</span>
(setq ergoemacs-beginning-or-end-of-line-and-what 'page) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">Page Down</span>
(setq ergoemacs-beginning-or-end-of-line-and-what 'buffer) <span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">End</span>
<span style="font-weight: bold; font-style: italic;">; </span><span style="font-weight: bold; font-style: italic;">of Buffer</span>
</pre>
<p>
Note that this command also respects mode specific changes to
end-of-line commands (like in <code>org-mode</code>).
</p>
</div>
</div>
<div id="outline-container-3" class="outline-3">
<h3 id="sec-3">Beginning or end of buffer</h3>
<div class="outline-text-3" id="text-3">
<p>This smart will:
</p><ol>
<li>Goto the beginning of the buffer
</li>
<li>If at the beginning of the buffer it will go to the end of the buffer.
</li>
</ol>
<p>
If you want to go to the beginning of the buffer only, you can turn it
of by setting <code>ergoemacs-repeatable-beginning-or-end-of-buffer</code> to
nil:
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-repeatable-beginning-or-end-of-buffer nil)
</pre>
</div>
</div>
<div id="outline-container-4" class="outline-3">
<h3 id="sec-4">Paste</h3>
<div class="outline-text-3" id="text-4">
<p>Ergoemacs can allow a paste command to cycle through the previous
items that were copied.
</p>
<p>
In this case Ctrl+v:
</p><ul>
<li>Pastes the first item
</li>
<li>Upon repeating, Ctrl+v cycles through previous items pasted.
</li>
</ul>
<p>
Note that if you move/type then this pattern repeats itself, you will
paste and then cycle through the items pasted.
</p>
<p>
If you wish to paste an item twice, you can use Ctrl+Shift+v.
</p>
<p>
When this is disabled, the Ctrl+v only pastes and
Ctrl+Shift+v cycles through the previous items pasted. This can be
disabled by
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-smart-paste nil)
</pre>
<p>
This is enabled by default because it reduces pinky usage.
</p>
<p>
When installed, ergoemacs' smart paste can also use browse-kill-ring
</p>
<p>
When calling Ctrl+Shift+v if the last command was not a paste, it
starts browsing the kill ring. The standard ergoemacs-mode keys
apply. Pressing Ctrl+v or Alt+v will cycle forward through the kill
ring. Pressing Ctrl+Shift+v or Ctrl+Alt+v will cycle backward
through the kill ring. To accept the text, press enter.
</p>
<p>
If you want the second paste to call <code>browse-kill-ring</code>, you can
enable this by:
</p>
<pre class="src src-emacs-lisp">(setq ergoemacs-smart-paste 'browse-kill-ring)
</pre>
</div>
</div>
<div id="outline-container-5" class="outline-3">
<h3 id="sec-5">Smart punctuation</h3>
<div class="outline-text-3" id="text-5">
</div>
</div>
<div id="outline-container-6" class="outline-3">
<h3 id="sec-6">Smart Capitalization</h3>
<div class="outline-text-3" id="text-6">
<p>This command is an extension of the <a href="http://ergoemacs.org/emacs/modernization_upcase-word.html">smart Letter-Case command</a>. It
also toggles camelCase words when it detects you are in a variable.
When you are outside of a word, it corrects the last mis-spelled
word.
</p>
<p>
The camel-case is determined by the major-mode's mode's settings in
<code>ergoemacs-toggle-camel-case-chars</code>. In emacs-lisp it is more common
to separate variables with <code>-</code> rather than <code>_</code>. The default setting
for <code>emacs-lisp-mode</code> allows toggling between the various variables.
For exampleVariable emacs-lisp toggles between the following:
</p>
<ul>
<li>exampleVariable
</li>
<li>ExampleVariable
</li>
<li>example-variable
</li>
<li>example<sub>variable</sub>
</li>
</ul>
<p>
In <code>R</code> it is likely that you separate variables by <code>.</code> or <code>_</code> so
exampleVariable would be toggled between
</p>
<ul>
<li>exampleVariable
</li>
<li>ExampleVariable
</li>
<li>example.variable
</li>
<li>example<sub>variable</sub>
</li>
</ul>
<p>
In some modes, like <code>org-mode</code> only the toggle letter case is
active.
</p>
<p>
Any of these can be customized by customizing the variable
<code>ergoemacs-toggle-camel-case-chars</code>.
</p>
</div>
</div>
</div>
</article>
</div>
<div id="footer">
<div class="container">
<div class="row">
<nav class="span3">
<h1>About</h1>
<p>
This page explains how ergoemacs-mode works. It was written in emacs
org-mode and exported to HTML using <a href="https://github.com/renard/o-blog">o-blog</a>.
</p>
</nav>
<nav id="links" class="span3">
<h1>Links</h1>
<ul>
<ul>
<li><a href="./index.html"><i>icon-home icon-white</i> Home</a>
</li>
</ul>
<ul>
<li><a href="./testimonials.html"><i>icon-comments-alt icon-white</i> Testimonials</a>
</li>
<li><a href="./changelog.html"><i>icon-pencil icon-white</i> Changelog</a>
</li>
<li><a href="./roadmap.html"><i>icon-tasks icon-white</i> Roadmap</a>
</li>
</ul>
</ul>
</nav>
<nav id="archives" class="span3">
<h1><a href="./archives.html">Archives</a></h1>
<ul>
</ul>
</nav>
<nav class="tags span3">
<h1><a href="./tags/index.html">Tags</a></h1>
<ul>
</ul>
</nav>
</div>
</div>
<div class="copyright" style="text-align: center;">
<p>
Documentation Copyright © 2007-2013 Matthew Fidler, Xah Lee and David
Capello. Published under the therm of the <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/fr/">Creative Commons Attribution-Noncommercial-Share Alike 2.0 France License</a>. Code
published under <a href="http://www.gnu.org/licenses/gpl-2.0.html">GPL v2</a>.
</p>
<p>Powered by <a href="https://github.com/renard/o-blog">o-blog</a>.</p>
</div>
</div>
</body>
</html>