forked from tuhdo/tuhdo.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helm-intro.html
2951 lines (2463 loc) · 99.2 KB
/
helm-intro.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
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>A Package in a league of its own: <code>Helm</code></title>
<!-- 2015-07-20 Mon 00:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="Org-mode" />
<meta name="author" content="Tu Do" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center; }
.todo { font-family: monospace; color: red; }
.done { color: green; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.right { margin-left: auto; margin-right: 0px; text-align: right; }
.left { margin-left: 0px; margin-right: auto; text-align: left; }
.center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
pre.src-sh:before { content: 'sh'; }
pre.src-bash:before { content: 'sh'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-R:before { content: 'R'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-java:before { content: 'Java'; }
pre.src-sql:before { content: 'SQL'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.right { text-align: center; }
th.left { text-align: center; }
th.center { text-align: center; }
td.right { text-align: right; }
td.left { text-align: left; }
td.center { text-align: center; }
dt { font-weight: bold; }
.footpara:nth-child(2) { display: inline; }
.footpara { display: block; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
/*]]>*/-->
</style>
<link rel="stylesheet" href="./static/worg.css">
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="preamble" class="status">
<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project=9874755;
var sc_invisible=1;
var sc_security="c2028bb7";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" + scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="hit counter"
href="http://statcounter.com/free-hit-counter/" target="_blank"><img
class="statcounter" src="http://c.statcounter.com/9874755/0/c2028bb7/1/"
alt="hit counter"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->
<h2><a href="index.html">Back to Table of Contents</a></h2>
</div>
<div id="content">
<h1 class="title">A Package in a league of its own: <code>Helm</code></h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">Usage:</a></li>
<li><a href="#sec-2">Why is Helm powerful?</a></li>
<li><a href="#sec-3">Operate on text at point:</a></li>
<li><a href="#sec-4">Autoresize</a></li>
<li><a href="#sec-5">Command: <code>helm-M-x</code></a></li>
<li><a href="#sec-6">Command: <code>helm-show-kill-ring</code></a></li>
<li><a href="#sec-7">Command: <code>helm-mini</code></a></li>
<li><a href="#sec-8">Command: <code>helm-find-files</code></a></li>
<li><a href="#sec-9">Command: <code>helm-ff-do-grep</code>, live grep in Helm</a></li>
<li><a href="#sec-10">Command: <code>helm-semantic-or-imenu</code></a></li>
<li><a href="#sec-11">Command: <code>helm-man-woman</code></a></li>
<li><a href="#sec-12">Command: <code>helm-find</code></a></li>
<li><a href="#sec-13">Command: <code>helm-locate</code></a></li>
<li><a href="#sec-14">Command: <code>helm-occur</code></a></li>
<li><a href="#sec-15">Command: <code>helm-apropos</code></a></li>
<li><a href="#sec-16">Command: <code>helm-info-*</code></a></li>
<li><a href="#sec-17">Command: <code>helm-lisp-completion-at-point</code></a></li>
<li><a href="#sec-18">Command: <code>helm-resume</code></a></li>
<li><a href="#sec-19">Command: <code>helm-all-mark-rings</code></a></li>
<li><a href="#sec-20">Command: <code>helm-regexp</code></a></li>
<li><a href="#sec-21">Command: <code>helm-register</code></a></li>
<li><a href="#sec-22">Command: <code>helm-top</code></a></li>
<li><a href="#sec-23">Command: <code>helm-surfraw</code></a></li>
<li><a href="#sec-24">Command: <code>helm-google-suggest</code></a></li>
<li><a href="#sec-25">Command: <code>helm-color</code></a></li>
<li><a href="#sec-26">Command: <code>helm-eval-expression-with-eldoc</code></a></li>
<li><a href="#sec-27">Command: <code>helm-calcul-expression</code></a></li>
<li><a href="#sec-28">Command: <code>helm-eshell-history</code></a></li>
<li><a href="#sec-29">Command: <code>helm-comint-input-ring</code></a></li>
<li><a href="#sec-30">Command: <code>helm-mini-buffer-history</code></a></li>
<li><a href="#sec-31">Package: <code>helm-projectile</code></a></li>
<li><a href="#sec-32">Package: <code>helm-descbinds</code></a></li>
<li><a href="#sec-33">Summary of Keybindings</a></li>
</ul>
</div>
</div>
<p>
<span class="underline">Author</span>:
</p>
<ul class="org-ul">
<li>Tamas Patrovic (original author), from 2007. At this time, Helm was
named <code>Anything</code>.
</li>
<li>rubikitch <code>[email protected]</code>, from 2008-2011. Helm was still
named <code>Anything</code>
</li>
<li><a href="https://github.com/thierryvolpiatto">Thierry Volpiatto</a> (current maintainer).
<code>[email protected]</code>, from 2011-present. <code>Anything</code> was
renamed to <code>Helm</code> during this period.
</li>
</ul>
<p>
<span class="underline">Homepage</span>: <a href="https://github.com/emacs-helm/helm">Github</a>
</p>
<p>
<span class="underline">Features</span>:
</p>
<p>
<code>Helm</code> is incremental completion and selection narrowing framework for
Emacs. It will help steer you in the right direction when you're
looking for stuff in Emacs (like buffers, files, etc).
</p>
<p>
Helm is a fork of <code>anything.el</code> originally written by Tamas Patrovic and
can be considered to be its successor. <code>Helm</code> sets out to clean up the
legacy code in <code>anything.el</code> and provide a cleaner, leaner and more
modular tool, that's not tied in the trap of backward compatibility.
</p>
<p>
<span class="underline">Installation</span>:
</p>
<p>
You can use <a href="https://github.com/bbatsov/prelude">Emacs Prelude</a> or <a href="https://github.com/syl20bnr/spacemacs">Spacemacs</a> that is already setup properly. You can
skip all configuration code in this guide. But note that by default, <a href="https://github.com/bbatsov/prelude">Emacs
Prelude</a> does not enable Helm. Please follow <a href="https://github.com/bbatsov/prelude#helm">the instructions</a> to enable Helm.
<a href="https://github.com/syl20bnr/spacemacs">Spacemacs</a> enables Helm by default.
</p>
<p>
If you are a Spacemacs user, you don't have to do anything. If you have
your own Emacs configuration, <code>M-x list-packages</code> and select <b>helm</b>
package, then install it. After finish installing, add this
configuration to activate the package:
</p>
<p>
Minimal config:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span><span style="color: #DD6F48;">require</span> '<span style="color: #BBAA97;">helm-config</span><span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span>helm-mode <span style="color: #BBAA97;">1</span><span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
Extended config:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span><span style="color: #DD6F48;">require</span> '<span style="color: #BBAA97;">helm</span><span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span><span style="color: #DD6F48;">require</span> '<span style="color: #BBAA97;">helm-config</span><span style="color: #5C7E81;">)</span>
<span style="color: #7C6F64;">;; </span><span style="color: #7C6F64;">The default "C-x c" is quite close to "C-x C-c", which quits Emacs.</span>
<span style="color: #7C6F64;">;; </span><span style="color: #7C6F64;">Changed to "C-c h". Note: We must set "C-c h" globally, because we</span>
<span style="color: #7C6F64;">;; </span><span style="color: #7C6F64;">cannot change `</span><span style="color: #7C6F64;">helm-command-prefix-key</span><span style="color: #7C6F64;">' once `</span><span style="color: #7C6F64;">helm-config</span><span style="color: #7C6F64;">' is loaded.</span>
<span style="color: #5C7E81;">(</span>global-set-key <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-c h"</span><span style="color: #837486;">)</span> 'helm-command-prefix<span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span>global-unset-key <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-x c"</span><span style="color: #837486;">)</span><span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span>define-key helm-map <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"<tab>"</span><span style="color: #837486;">)</span> 'helm-execute-persistent-action<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">rebind tab to run persistent action</span>
<span style="color: #5C7E81;">(</span>define-key helm-map <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-i"</span><span style="color: #837486;">)</span> 'helm-execute-persistent-action<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">make TAB works in terminal</span>
<span style="color: #5C7E81;">(</span>define-key helm-map <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-z"</span><span style="color: #837486;">)</span> 'helm-select-action<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">list actions using C-z</span>
<span style="color: #5C7E81;">(</span><span style="color: #DD6F48;">when</span> <span style="color: #837486;">(</span>executable-find <span style="color: #528B8B;">"curl"</span><span style="color: #837486;">)</span>
<span style="color: #837486;">(</span>setq helm-google-suggest-use-curl-p t<span style="color: #837486;">)</span><span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span>setq helm-split-window-in-side-p t <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">open helm buffer inside current window, not occupy whole other window</span>
helm-move-to-line-cycle-in-source t <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">move to end or beginning of source when reaching top or bottom of source.</span>
helm-ff-search-library-in-sexp t <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">search for library in `</span><span style="color: #7C6F64;">require</span><span style="color: #7C6F64;">' and `</span><span style="color: #7C6F64;">declare-function</span><span style="color: #7C6F64;">' sexp.</span>
helm-scroll-amount <span style="color: #BBAA97;">8</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">scroll 8 lines other window using M-<next>/M-<prior></span>
helm-ff-file-name-history-use-recentf t<span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span>helm-mode <span style="color: #BBAA97;">1</span><span style="color: #5C7E81;">)</span>
</pre>
</div>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><a id="ID-07fe976f-bf1e-4c16-afb3-b108059921b1" name="ID-07fe976f-bf1e-4c16-afb3-b108059921b1"></a>Usage:</h2>
<div class="outline-text-2" id="text-1">
<p>
After using Helm, you are going to have a big change in the way you
use Emacs. After getting used to the Helm way, you don't want to leave
it. However, if you don't like Helm, you can still use Ido, which is
introduted in later section. Let's learn how to use helm by play with
it.
</p>
<p>
Completion with Helm is very different with the usual Emacs
completion:
</p>
<ul class="org-ul">
<li>You type something.
</li>
<li>Instead of <b>TAB</b> to expand the common part until you find your
candidates, in Helm, you type a parts of the candidate you want to
search, separated by spaces. In Helm, these strings are called
<b>patterns</b>. Patterns can also be regexps.
</li>
<li>Helm will try to search and sort according to highest match, from
top to bottom. The best match is at the top, so you can press <b>RET</b>
and select it.
</li>
<li>You can navigate the buffer with <b>C-n</b> and <b>C-p</b> or <b><up></b> and
<b><down></b> to move up/down, <b>C-v</b> and <b>M-v</b> to move to next/previous
pages, and <b>M-<</b> and <b>M-></b> to move to top and bottom of the Helm
buffer.
</li>
<li>You can mark candidates with <b>C-SPC</b>; this is useful when you need
to perform an action on many candidates of your choice. <b>M-a</b> to
select all.
</li>
<li>You can insert marked candidates into current buffer with <b>C-c
C-i</b>. This is useful when you narrow to a list of candidates,
i.e. files, then you want to save such candidates.
</li>
<li>If you find the current horizontal Helm window is small, you can
always switch it to vertical window with <b>C-t</b>. Running <b>C-t</b> again
returns the Helm window back to horizontal and so on.
</li>
</ul>
<p>
You can practice the above commands with <b>C-x b</b>, whicn runs
<code>helm-mini</code>. If you mark more than one buffers, <b>RET</b> opens the
selected buffers.
</p>
<p>
<b><span class="underline">IMPORTANT</span></b>: <i>Please remember that, when you use Helm, you never <b>TAB</b></i>
<i>to complete prefixes like vanilla or other packages like Ido and its</i>
<i>related packages. In Helm, when you type something, candidates get</i>
<i>updated <b>automatically</b>. In vanilla Emacs, you have to <b>TAB</b> to get a/</i>
<i>list of candidate. This is a great feature from Helm, not a miss of</i>
<i>feature. You have to forget the mentally of <b>TABBING</b> to get</i>
<i>candidates. If you want quick completion of search patterns in Helm</i>
<i>prompt, you always have <code>hippie-expand</code> to replace the <b>TAB</b></i>
<i>behaviour, as introduced at the beginning of this section. This is</i>
<i>the biggest confusion for new people switching to Helm. When you are</i>
<i>used to Helm, you will love it.</i>
</p>
<p>
When you execute a Helm command, you enter a Helm session. A Helm
session is a dedicated state to working with Helm features; while in a
Helm session, a dedicated Helm buffer is always opened. When you quit
a Helm session, a Helm buffer is closed. In Helm, you basically need
to remember the 3 commands:
</p>
<ul class="org-ul">
<li>Access to action menu with <b>TAB</b>. An action is a command to run on
marked candidates (one or more) and quit current Helm session; an
action menu is a text-based menu that lists actions you can
take. For example, <code>Find File</code> (open file), <code>Find File in Dired</code>,
<code>Grep File</code>…
</li>
<li><b>C-z</b> executes <b>helm-execute-persistent-action</b>; a persistent action
is an action that you use in a Helm session without quitting the
session.
</li>
<li>In some Helm session, such as <code>helm-find-files</code> or <code>helm-mini</code>, you
can select more than one candidates and execute actions on them,
such as <code>grep</code> or <code>open</code>.
</li>
</ul>
<p>
However, for convenience, let's <b>TAB</b> with <b>C-z</b> in the above
settings, so we can use <b>TAB</b> more comfortably, because you actually
use <b>helm-execute-persistent-action</b> more than
<b>helm-select-action</b> by adding the code snippet below:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>define-key helm-map <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"<tab>"</span><span style="color: #837486;">)</span> 'helm-execute-persistent-action<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">rebind tab to do persistent action</span>
<span style="color: #5C7E81;">(</span>define-key helm-map <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-i"</span><span style="color: #837486;">)</span> 'helm-execute-persistent-action<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">make TAB works in terminal</span>
<span style="color: #5C7E81;">(</span>define-key helm-map <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-z"</span><span style="color: #837486;">)</span> 'helm-select-action<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">; </span><span style="color: #7C6F64;">list actions using C-z</span>
</pre>
</div>
<p>
In a Helm session, if you need help, use <b>C-c ?</b>, or refer to this
manual again. The commands in the key bindings above are good enough
to help you using Helm productively.
</p>
</div>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><a id="ID-260dfe60-eb43-4d20-b1c4-b51af5133a32" name="ID-260dfe60-eb43-4d20-b1c4-b51af5133a32"></a>Why is Helm powerful?</h2>
<div class="outline-text-2" id="text-2">
<ul class="org-ul">
<li><i><span class="underline">Simple and Consistent interface</span></i>: Every Helm session starts with
a same simple interface: a prompt for entering search patterns and
a Helm buffer for displying results as a user types. Because of the
consistency and simple interface, new people use Helm with ease.
</li>
<li><i><span class="underline">Interactivity</span></i>: By nature, Helm is very interactive: as a user
types, results get updated immediately in the Helm buffer. Because
of this feature, Helm provides a unique interactive verion of many
commmands that do not exist outside of Helm. For example,
<code>helm-ff-run-grep</code>, update grep results as you type.
</li>
<li><i><span class="underline">Focus on finding what you want first, decide to do with it
later</span></i>: With Helm, you don't have to think about what you are going
to do with a candidate once you found it. For example, you need
decide whether you should open a file in the current window or in
other window <b>before</b> opening a file, then find the file and open
it. In contrast, Helm helps you focus on what you want to find; once
you found your desired object (such as a file or directory), then
decide what to do with it <b>later</b>, like open the file in other
window or open the file as root. This has an advantage that you
don't have to cancel your executing key binding when you decide that
the action you are taking is not appropriate anymore. For example,
you are executed <b>C-x C-f</b> to open a file, but have a second thought
that open the file in another window is better. Than you press <b>C-g</b>
to cancel the command and re-execute the <b>C-x 4 C-f</b> version and
have to start your navigating session all over again!
</li>
<li><i><span class="underline">Matching mechanism</span></i>: This is a powerful feature in Helm that I
haven't seen in other packages: out of order matching, <b>with regular
expression</b>. That's right, you can enter every search pattern as
regexp!. A really powerful concept: it enhances explanatory power
for many things. One of use cases is exploring a new project: using
Helm, you can "learn" the project structure interactively. For
example, suppose I'm completely new to the linux kernel source tree,
and I wonder whether a file <code>main.c</code> exists for <code>x86</code>
architecture. I know that they must have <code>x86</code> directory somewhere,
and the file could contain <code>main.c</code> in it, i.e. It can be <code>main.c</code>
or <code>x86-main.c</code>. These are the only information I know, so I must
confirm whether it is true or not, so I tried it in Helm Projectile
(a package that makes use of Helm framework and it does not come with
stock Helm. You can read more about it <a href="http://tuhdo.github.io/helm-projectile.html">in my Helm Projectile guide</a>):
<div class="figure">
<p><a href="static/helm_projectile.gif"><img src="static/helm_projectile.gif" alt="helm_projectile.gif" /></a>
</p>
</div>
<p>
First, I enter <code>main.c</code>, and I got lots of candidates. Then, I only
want the <code>main.c</code> inside x86 directory, so I type <code>x86</code>. The whole
pattern is <code>main.c x86</code> and Helm returns the correct candidate:
<code>arch/x86/boot/main.c</code>.
</p>
<p>
It does exist. I also wonder where <code>i5100_edac.c</code> exists, because
Intel has a datasheet for it a long time, so it must be
implemented. As demonstrated in the above screencast, there was only
one <code>i5100_eda.c</code>. Using other so-called "fuzzy-matching" mechanism,
you are still required to know things in advanced and this severely
limit the explanatory power. For example, to get to the file
<code>driver/edac/i5100_edac.c</code>, you have to know the path to fuzzy
match like this: <code>dedi51</code>; <b>d</b> for matching <code>driver</code>, <b>ed</b> for matching
<code>edac</code> because other directories also start with "e"; <b>i51</b> for
matching <code>i5100_edac.c</code> because serveral files also start with "i5",
or contains "1" and "0" or "edac" in it. "i51" is the only unique
prefix. Using Helm, you can immediately enter the unique pattern of
a candidate and ignore the common prefix to get a candidate. For
example, in the screencast above, I got <code>driver/edac/i5100_edac.c</code>
immediately just by typing "<b>i51</b>" and the file was narrowed down.
</p>
<p>
It's also not all that useful when using with a large source tree,
since the source tree contains a large amount of files, and many of
these files have same prefix.
</p>
<p>
Starting from Helm 1.6.5, Helm includes fuzzy matching for many
commands and a way for package writer to activate fuzzy matching.
</p>
</li>
<li><i>Performance</i>: Helm can work with over 30000 candidates or more no
problem.
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-3" class="outline-2">
<h2 id="sec-3"><a id="ID-8de25a41-da8b-42b5-b152-e62ef75d2bfd" name="ID-8de25a41-da8b-42b5-b152-e62ef75d2bfd"></a>Operate on text at point:</h2>
<div class="outline-text-2" id="text-3">
<p>
If you are already in a Helm session, you can still get input from the
current editing buffer by the following key bindings:
</p>
<ul class="org-ul">
<li><b>C-w</b> yanks word at point, starting from point to the end of the
word, into the Helm prompt (the minibuffer).
</li>
<li><b>M-n</b> yanks symbol at point
</li>
</ul>
<p>
If <code>helm-mode</code> is activated, help commands also automatically
recognize symbols at point if such symbols exist in Emacs, and use
Helm interface for interactive selecting. For example:
</p>
<ul class="org-ul">
<li><b>C-h f</b>, which runs <code>describe-function</code>, automatically takes the
symbol at point as default for searching function.
</li>
<li><b>C-h v</b>, which runs <code>describe-variable</code>, automatically takes the
symbol at point as default for searching variable.
</li>
<li><b>C-h w</b>, which runs <code>where-is</code>, automatically takes the
symbol at point as default for showing key binding for a command.
</li>
<li>… and so on… (<b>C-h C-h</b> to view all commands)
</li>
</ul>
<p>
All of those commands automatically make use Helm.
</p>
</div>
</div>
<div id="outline-container-sec-4" class="outline-2">
<h2 id="sec-4">Autoresize</h2>
<div class="outline-text-2" id="text-4">
<p>
Helm can resize its buffer automatically to fit with the number of
candidates by enabling <code>helm-autoresize-mode</code>:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>helm-autoresize-mode t<span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
You can customize the minimum and maximum height that Helm can resize
with these two variable:
</p>
<ul class="org-ul">
<li><code>helm-autoresize-max-height</code>
</li>
<li><code>helm-autoresize-min-height</code>
</li>
</ul>
<p>
By default, <code>helm-autoresize-max-height</code> is set to 40, which Helm
candidate buffer has the maximum height of 40% of current frame
height. Similarly, <code>helm-autoresize-min-height</code> specifies the minimum
height that Helm candidate buffer cannot be smaller.
</p>
<p>
If you don't want the Helm window to be resized, but a smaller Helm
window, you can set <code>helm-autoresize-max-height</code> equal to
<code>helm-autoresize-min-height</code>.
</p>
<p>
If you use <a href="https://github.com/roman/golden-ratio.el">golden-ratio</a>, you have to disable its interference with Helm window
(Note: If you are using Spacemacs, you don't have to add this configuration):
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span><span style="color: #DD6F48;">defun</span> <span style="color: #A89984;">pl/helm-alive-p</span> <span style="color: #837486;">()</span>
<span style="color: #837486;">(</span><span style="color: #DD6F48;">if</span> <span style="color: #9C6F68;">(</span>boundp 'helm-alive-p<span style="color: #9C6F68;">)</span>
<span style="color: #9C6F68;">(</span>symbol-value 'helm-alive-p<span style="color: #9C6F68;">)</span><span style="color: #837486;">)</span><span style="color: #5C7E81;">)</span>
<span style="color: #5C7E81;">(</span>add-to-list 'golden-ratio-inhibit-functions 'pl/helm-alive-p<span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
In DEMO 1, when <code>helm-autoresize-max-height</code> is not equal to
<code>helm-autoresize-min-height</code> (begins when <code>START DEMO</code> appears in
minibuffer):
</p>
<div class="figure">
<p><a href="static/part3/helm-autoresize-mode.gif"><img src="static/part3/helm-autoresize-mode.gif" alt="helm-autoresize-mode.gif" /></a>
</p>
</div>
<p>
In DEMO 2, when <code>helm-autoresize-max-height</code> is equal to
<code>helm-autoresize-min-height</code> (begins when <code>START DEMO</code> appears in
minibuffer):
</p>
<div class="figure">
<p><a href="static/part3/helm-autoresize-fix.gif"><img src="static/part3/helm-autoresize-fix.gif" alt="helm-autoresize-fix.gif" /></a>
</p>
</div>
</div>
</div>
<div id="outline-container-sec-5" class="outline-2">
<h2 id="sec-5"><a id="ID-500a1c68-ab43-40a5-97c3-5d556a9f748d" name="ID-500a1c68-ab43-40a5-97c3-5d556a9f748d"></a>Command: <code>helm-M-x</code></h2>
<div class="outline-text-2" id="text-5">
<p>
<span class="underline">Key binding</span>:
</p>
<p>
No key binding. We should give it one:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>global-set-key <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"M-x"</span><span style="color: #837486;">)</span> 'helm-M-x<span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
<span class="underline">Description</span>:
</p>
<p>
<code>M-x</code> and see the difference. You will see a buffer that lists
commands in Emacs. Some of you may not like it because it seems
overkill at first. However, even if you really don't like, please bear
with me until the end.
</p>
<p>
Now, type <code>li pa</code>; that's right <code>li</code> , a space and <code>pa</code>. You will see,
<code>list-packages</code> is at the top. Surprise! Let's try another input. Now,
type <code>pa ^li</code>, and you will receive <code>list-package</code> as the first
entry.
</p>
<p>
<code>helm-M-x</code> is also better then the default <code>M-x</code>, because it provides
key bindings right next to the commands, and <b>TAB</b> provides you the
built-in documentation of that command in another buffer.
</p>
<p>
Starting from 1.6.5, <code>helm-M-x</code> can fuzzy match candidates, but not
enabled by default. To enable fuzzy matching, add the following
setting:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>setq helm-M-x-fuzzy-match t<span style="color: #5C7E81;">)</span> <span style="color: #7C6F64;">;; </span><span style="color: #7C6F64;">optional fuzzy matching for helm-M-x</span>
</pre>
</div>
<p>
<b>NOTE</b>: You have to bind <code>helm-M-x</code> to <b>M-x</b> manually. Otherwise, you
still get Helm completion, but using the vanilla <b>M-x</b> that does not
provides the above features like showing key bindings and <b>TAB</b> to
open built-in documentation. Another important thing is, you have to
pass prefix argument <b>AFTER</b> you run <code>helm-M-x</code>, because your prefix
argument will be displayed in the modeline when in <code>helm-M-x</code>
buffer. Passing prefix argument <b>BEFORE</b> <code>helm-M-x</code> <b>has no effect</b>.
</p>
<p>
<span class="underline">Demo</span>:
</p>
<div class="figure">
<p><a href="static/part3/helm-m-x.gif"><img src="static/part3/helm-m-x.gif" alt="helm-m-x.gif" /></a>
</p>
</div>
</div>
</div>
<div id="outline-container-sec-6" class="outline-2">
<h2 id="sec-6"><a id="ID-77b4d145-c280-4ed4-98a7-d645fe1d18bf" name="ID-77b4d145-c280-4ed4-98a7-d645fe1d18bf"></a>Command: <code>helm-show-kill-ring</code></h2>
<div class="outline-text-2" id="text-6">
<p>
<span class="underline">Key binding</span>:
</p>
<p>
No key binding. We should give it one:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>global-set-key <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"M-y"</span><span style="color: #837486;">)</span> 'helm-show-kill-ring<span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
<span class="underline">Description</span>:
</p>
<p>
Do you remember that <code>C-y</code> <a href="http://tuhdo.github.io/emacs-tutor.html#sec-7-15">cycle the kill ring</a>? However, working with
default kill ring is painful because you have a burden to remember an
invisible thing, that is the kill ring, at which position you kill
what. To view the kill ring, you have to <b>C-h v</b> and type <code>kill-ring</code>
to see content of the kill ring, and it is not pretty.
</p>
<p>
<code>helm-show-kill-ring</code> solves this problem: Helm shows the kill ring in
a readable format and allows you to narrow down by entering
sub-strings of candidates. You are freed from the cognitive burden of
the default <b>M-y</b>.
</p>
<p>
If you follow my Helm configuration, <code>M-y</code> binds to
<code>helm-show-kill-ring</code>. Try it and see! Much easier than the default.
</p>
<p>
<span class="underline">Demo</span>:
</p>
<p>
<code>helm-kill-ring</code> in action (the demo starts when you see START in the
minibuffer):
</p>
<div class="figure">
<p><a href="static/part3/helm-kill-ring.gif"><img src="static/part3/helm-kill-ring.gif" alt="helm-kill-ring.gif" /></a>
</p>
</div>
</div>
</div>
<div id="outline-container-sec-7" class="outline-2">
<h2 id="sec-7"><a id="ID-0386c827-7f5d-4056-bf4d-8d0fc01fc1ab" name="ID-0386c827-7f5d-4056-bf4d-8d0fc01fc1ab"></a>Command: <code>helm-mini</code></h2>
<div class="outline-text-2" id="text-7">
<p>
<span class="underline">Key binding</span>:
</p>
<p>
No key binding. We should give it one:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>global-set-key <span style="color: #837486;">(</span>kbd <span style="color: #528B8B;">"C-x b"</span><span style="color: #837486;">)</span> 'helm-mini<span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
To enable fuzzy matching, add the following settings:
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"><span style="color: #5C7E81;">(</span>setq helm-buffers-fuzzy-matching t
helm-recentf-fuzzy-match t<span style="color: #5C7E81;">)</span>
</pre>
</div>
<p>
<code>helm-mini</code> comprises of multiple sources:
</p>
<ul class="org-ul">
<li>Current opening buffers, under the header <code>Buffers</code>.
</li>
<li>Recently opened files, under the header <code>Recentf</code>.
</li>
<li>Allow you to create a new buffer by pressing <b>RET</b>, under the header
<code>Create Buffer</code>.
</li>
</ul>
<p>
You can move back and forth between the groups by using <b><left></b> and
<b><right></b> arrow keys. Or you can just scroll down/up with <b>C-v</b> and
<b>M-v</b>.
</p>
<p>
You can filter out buffers by major mode using the pattern
<code>*<major-mode></code>. For example, <code>*dired</code> narrows to only Dired
buffers. You can also filter out buffers that belong to a major mode
by adding <code>!</code> to the pattern. For example, <code>*!dired</code> select all buffers
that are not in Dired mode.
</p>
<p>
You can also select buffers in a specific directory by using the pattern
<code>/directory</code>. For example, <code>/.emacs.d/</code> narrows to buffers that are
only inside <code>.emacs.d</code>. Add <code>!</code> before the pattern for reverse
version. For example, <code>!/.emacs.d/</code> narrows to buffers not in
<code>.emacs.d</code>.
</p>
<p>
You can even use <code>helm-mini</code> to narrow to buffers that contains a
regexp in their contents, by appending <code>@</code> before the search
pattern. For example, you can select buffers that only contain the
string "test": <code>@test</code>. If you want to see the locations of the string
in the buffers, mark all the buffer with <b>M-a</b> and <b>C-s</b> while in
<code>helm-mini</code> session, to switch to <code>helm-moccur</code>. You can mark buffers
to search by <b>C-SPC</b>. When you switch to <code>helm-moccur</code>, matches that
are in selected buffers are displayed. You can also perform <code>occur</code>
only on the current buffer with prefix argument: <b>C-u C-s</b>; this is
useful when you already marked buffers but don't want to unmark just
to view only in a buffer. However, in general, you won't need <b>C-u
C-s</b>.
</p>
<p>
Meaning of colors and prefixes for buffers:
</p>
<ul class="org-ul">
<li>Remote buffers are prefixed with '@'.
</li>
<li>Red => Buffer have its file modified on disk by an external
process.
</li>
<li>Indianred2 => Buffer exists but its file have been deleted.
</li>
<li>Orange => Buffer is modified and its file not saved to disk.
</li>
<li>Italic => A non-file buffer.
</li>
</ul>
<p>
Some Emacs themes change the colors. You should check the
corresponding colour in your color themes.
</p>
<p>
Example:
</p>
<ul class="org-ul">
<li>If I enter in pattern prompt: <code>*lisp ^helm @moc</code>, Helm will narrow
down the list by selecting only buffers that are in lisp mode, start
by helm and match "moc" in their contents.
</li>
<li>If I want to specify more than one major-mode, separate them with
<code>,</code>, e.g <code>*!lisp,!sh,!fun</code> will list all buffers but the ones in
lisp-mode, sh-mode and fundamental-mode.
</li>
<li>If I enter in pattern prompt: <code>*lisp ^helm moc</code>. Notice there is no
<code>@</code> this time helm will look for lisp mode buffers starting by
"helm" and have "moc" in their name.
</li>
<li>If I enter in pattern prompt: <code>*!lisp !helm</code> Helm will narrow down
to buffers that are not in "lisp" mode and that do not match "helm".
</li>
<li>If I enter in pattern prompt: <code>/helm/ w3</code> Helm will narrow down
buffers that are in any "helm" sub-directory and matching w3.
<p>
<code>helm-mini</code> is like an interactive version of <code>ibuffer</code>.
</p>
</li>
</ul>
<p>
<span class="underline">Demo</span>:
</p>
<div class="figure">
<p><a href="static/part3/helm-mini.gif"><img src="static/part3/helm-mini.gif" alt="helm-mini.gif" /></a>
</p>
</div>
<p>
The demo starts when you see Eval: START in the minibuffer. Note that
the demo used <code>helm-buffers-list</code>, but it's almost the same as
<code>helm-mini</code>. The only difference is that <code>helm-buffers-list</code> uses
<code>ido-virtual-buffers</code> for listing recently used files, while
<code>helm-mini</code> uses <code>recentf</code>.
</p>
<ul class="org-ul">
<li>All the C buffers are selected using the pattern <code>*C</code>. In the demo,
I also select Tcl buffers with *Tcl and then switched back to C
buffers with <code>*C</code>.
</li>
<li>I only want to have buffers that contains only the string
<code>crash</code>. To do that, I add a space, then add the pattern
<code>@crash</code>. After the initial search pattern, I hand over the current
highlighting buffer to <code>helm-moccur</code> (<code>moccur</code> with Helm interface)
using <b>C-s</b>. Candidates can be filtered gradually by adding more
pattern, i.e. I added memory to filtered down to buffers that
contain the string "memory" among the buffers that are containing
<code>crash</code>. You can also mark multiple with <b>C-SPC</b> or mark all buffers
with <b>M-a</b> to search all listing buffers in <code>helm-mini</code>.
</li>
<li>As you can see, as you filtered out, the number of candidates
decreases, as displayed in the modeline. At the end, there were 12
buffers remained as the result of filtering, down from the total 253
buffers.
</li>
</ul>
<p>
The demo above is part of <a href="https://github.com/emacs-helm/helm#advanced-usage">Helm's homepage</a> now.
</p>
<p>
<span class="underline">Similar Commands</span>:
</p>
<ul class="org-ul">
<li><code>helm-multi-files</code>: this command lists buffers and recent files and
files in current directory. However, when no match is found,
<code>helm-mini</code> asks if you want to create a new buffer by highlighting
the only entry that look like this:
<div class="figure">
<p><a href="static/helm-new-file-buffer.gif"><img src="static/helm-new-file-buffer.gif" alt="helm-new-file-buffer.gif" /></a>
</p>
</div>
<p>
while <code>helm-multi-files</code> shows a blank buffer. However, you can
start a <code>helm-locate</code> session to search the whole file system for
the desired file by pressing <b>C-c p</b>. By default, <code>helm-for-files</code>
binds to <code><prefix> f</code> (current prefix is <b>C-c h</b>).
</p>
</li>
<li><code>helm-buffer-list</code>: similar to <code>helm-mini</code>, but instead of listing
recent files from <code>recentf</code>, it uses <code>ido-virtual-buffers</code>, which is
a list of recently visited files managed by <code>ido</code>. The virtual
buffers do not contain path in it. Depends on preference, you can
use this command in place of <code>helm-mini</code>. To enable fuzzy matching
<code>ido-virtual-buffers</code>, if you set <code>helm-buffers-fuzzy-matching</code> to
<code>t</code> already, you also get fuzzy matching for <code>ido-virtual-buffers</code>.
</li>
</ul>
</div>
</div>
<div id="outline-container-sec-8" class="outline-2">
<h2 id="sec-8"><a id="ID-b71abd6c-cb29-4b64-a55f-29bd75937c11" name="ID-b71abd6c-cb29-4b64-a55f-29bd75937c11"></a>Command: <code>helm-find-files</code></h2>
<div class="outline-text-2" id="text-8">
<p>
<span class="underline">Key binding</span>:
</p>