forked from emacs-helm/helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelm-help.el
1628 lines (1165 loc) · 60.1 KB
/
helm-help.el
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
;;; helm-help.el --- Help messages for Helm. -*- lexical-binding: t -*-
;; Copyright (C) 2012 ~ 2018 Thierry Volpiatto <thierry.volpiatto@gmail.com>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(require 'helm)
(defvar helm-org-headings--nofilename)
(declare-function helm-source-org-headings-for-files "helm-org.el")
(defgroup helm-help nil
"Embedded help for `helm'."
:group 'helm)
(defface helm-helper
'((t :inherit helm-header))
"Face for Helm help string in minibuffer."
:group 'helm-help)
(defcustom helm-documentation-file "~/.emacs.d/helm-doc.org"
"The file where to save Helm documentation."
:group 'helm-help
:type 'string)
(defvar helm-help--string-list '(helm-help-message
helm-buffer-help-message
helm-ff-help-message
helm-read-file-name-help-message
helm-generic-file-help-message
helm-grep-help-message
helm-pdfgrep-help-message
helm-etags-help-message
helm-ucs-help-message
helm-bookmark-help-message
helm-esh-help-message
helm-buffers-ido-virtual-help-message
helm-moccur-help-message
helm-top-help-message
helm-el-package-help-message
helm-M-x-help-message
helm-imenu-help-message
helm-colors-help-message
helm-semantic-help-message
helm-kmacro-help-message))
(defvar helm-documentation-buffer-name "*helm documentation*")
;;;###autoload
(defun helm-documentation ()
"Preconfigured Helm for Helm documentation.
With a prefix arg refresh the documentation.
Find here the documentation of all documented sources."
(interactive)
(require 'helm-org)
(with-current-buffer (get-buffer-create helm-documentation-buffer-name)
(let ((inhibit-read-only t))
(erase-buffer)
(cl-loop for elm in helm-help--string-list
for str = (helm-interpret-value elm)
do (insert (substitute-command-keys str) "\n\n"))
(org-mode))
(setq buffer-read-only t)
(view-mode))
(let ((helm-org-headings--nofilename t))
(helm :sources (helm-source-org-headings-for-files
(list (get-buffer helm-documentation-buffer-name)))
:candidate-number-limit 99999
:buffer "*helm doc*")))
;;; Local help messages.
;;; `helm-buffer-list' help
;;
;;
(defvar helm-buffer-help-message
"* Helm Buffer
** Tips
*** Completion
**** Major-mode
You can enter a partial major-mode name (e.g. lisp, sh) to narrow down buffers.
To specify the major-mode, prefix it with \"*\" e.g. \"*lisp\".
If you want to match all buffers but the ones with a specific major-mode
\(negation), prefix the major-mode with \"!\" e.g. \"*!lisp\".
If you want to specify more than one major-mode, separate them with \",\",
e.g. \"*!lisp,!sh,!fun\" lists all buffers but the ones in lisp-mode, sh-mode
and fundamental-mode.
Then enter a space followed by a pattern to narrow down to buffers matching this
pattern.
**** Search inside buffers
If you enter a space and a pattern prefixed by \"@\", Helm searches for text
matching this pattern \*inside* the buffer (i.e. not in the name of the buffer).
If you enter a pattern prefixed with an escaped \"@\", Helm searches for a
buffer matching \"@pattern\" but does not search inside.
**** Search by directory name
If you prefix the pattern with \"/\", Helm matches over the directory names
of the buffers.
This feature can be used to narrow down the search to one directory while
subsequent strings entered after a space match over the buffer name only.
Note that negation is not supported for matching on buffer filename.
Starting from Helm v1.6.8, you can specify more than one directory.
**** Fuzzy matching
`helm-buffers-fuzzy-matching' turns on fuzzy matching on buffer names, but not
on directory names or major modes. A pattern starting with \"^\" disables fuzzy
matching and matches by exact regexp.
**** Examples
With the following pattern
\"*lisp ^helm @moc\"
Helm narrows down the list by selecting only the buffers that are in lisp mode,
start with \"helm\" and which content matches \"moc\".
Without the \"@\"
\"*lisp ^helm moc\"
Helm looks for lisp mode buffers starting with \"helm\" and containing \"moc\"
in their name.
With this other pattern
\"*!lisp !helm\"
Helm narrows down to buffers that are not in \"lisp\" mode and that do not match
\"helm\".
With this last pattern
/helm/ w3
Helm narrows down to buffers that are in any \"helm\" subdirectory and
matching \"w3\".
*** Creating buffers
When creating a new buffer, use `\\[universal-argument]' to choose a mode from a
list. This list is customizable, see `helm-buffers-favorite-modes'.
*** Killing buffers
You can kill buffers either one by one or all the marked buffers at once.
One kill-buffer command leaves Helm while the other is persistent. Run the
persistent kill-buffer command either with the regular
`helm-execute-persistent-action' called with a prefix argument (`\\[universal-argument] \\<helm-map>\\[helm-execute-persistent-action]')
or with its specific command `helm-buffer-run-kill-persistent'. See the
bindings below.
*** Switching to buffers
To switch to a buffer, press RET, to switch to a buffer in another window, select this buffer
and press \\<helm-buffer-map>\\[helm-buffer-switch-other-window], when called with a prefix arg
the buffer will be displayed vertically in other window.
If you mark more than one buffer, the marked buffers will be displayed in different windows.
*** Meaning of colors and prefixes for buffers
Remote buffers are prefixed with '@'.
Red => Buffer's file was modified on disk by an external process.
Indianred2 => Buffer exists but its file has been deleted.
Orange => Buffer is modified and not saved to disk.
Italic => A non-file buffer.
Yellow => Tramp archive buffer.
** Commands
\\<helm-buffer-map>
\\[helm-buffer-run-zgrep]\t\tGrep Buffer(s) works as zgrep too (`\\[universal-argument]' to grep all buffers but non-file buffers).
\\[helm-buffers-run-multi-occur]\t\tMulti-Occur buffer or marked buffers (`\\[universal-argument]' to toggle force-searching current-buffer).
\\[helm-buffer-switch-other-window]\t\tSwitch to other window.
\\[helm-buffer-switch-other-frame]\t\tSwitch to other frame.
\\[helm-buffers-run-browse-project]\t\tBrowse project from buffer.
\\[helm-buffer-run-query-replace-regexp]\t\tQuery-replace-regexp in marked buffers.
\\[helm-buffer-run-query-replace]\t\tQuery-replace in marked buffers.
\\[helm-buffer-run-ediff]\t\tEdiff current buffer with candidate. With two marked buffers, ediff those buffers.
\\[helm-buffer-run-ediff-merge]\t\tEdiff-merge current buffer with candidate. With two marked buffers, ediff-merge those buffers.
\\[helm-buffer-diff-persistent]\t\tToggle Diff-buffer with saved file without leaving Helm.
\\[helm-buffer-revert-persistent]\t\tRevert buffer without leaving Helm.
\\[helm-buffer-save-persistent]\t\tSave buffer without leaving Helm.
\\[helm-buffer-run-kill-buffers]\t\tDelete marked buffers and leave Helm.
\\[helm-buffer-run-kill-persistent]\t\tDelete buffer without leaving Helm.
\\[helm-buffer-run-rename-buffer]\t\tRename buffer.
\\[helm-toggle-all-marks]\t\tToggle all marks.
\\[helm-mark-all]\t\tMark all.
\\[helm-toggle-buffers-details]\t\tToggle details.
\\[helm-buffers-toggle-show-hidden-buffers]\t\tShow hidden buffers.
\\[helm-buffers-mark-similar-buffers]\t\tMark all buffers of the same type (color) as current buffer.")
;;; Find files help (`helm-find-files')
;;
;;
(defvar helm-ff-help-message
"* Helm Find Files
** Tips
*** Navigation summary
For a better experience you can enable auto completion by setting
`helm-ff-auto-update-initial-value' to non-nil in your init file. It is not
enabled by default to not confuse new users.
**** Use `\\<helm-find-files-map>\\[helm-execute-persistent-action]' (persistent action) on a directory to go down one level
On a symlinked directory a prefix argument expands to its true name.
**** Use `\\<helm-find-files-map>\\[helm-find-files-up-one-level]' on a directory to go up one level
**** Use `\\<helm-find-files-map>\\[helm-find-files-down-last-level]' to walk back the resulting tree of all the `\\<helm-map>\\[helm-execute-persistent-action]' you did
The tree is reinitialized each time you browse a new tree with
`\\<helm-map>\\[helm-execute-persistent-action]' or by entering some pattern in the prompt.
**** `RET' behavior
It behaves differently depending on `helm-selection' (current candidate in helm-buffer):
- candidate basename is \".\" => Open it in dired.
- candidate is a directory => Expand it.
- candidate is a file => Open it.
- marked candidates (1+) => Open them with default action.
Note that when copying, renaming, etc. from `helm-find-files' the
destination file is selected with `helm-read-file-name'.
To avoid confusion when using `read-file-name' or `read-directory-name', `RET'
follows its standard Emacs behaviour, i.e. it exits the minibuffer as soon as
you press `RET'. If you want the same behavior as in `helm-find-files', bind
`helm-ff-RET' to the `helm-read-file-map':
(define-key helm-read-file-map (kbd \"RET\") 'helm-ff-RET)
*** Find file at point
Helm uses `ffap' partially or completely to find file at point depending on the
value of `helm-ff-guess-ffap-filenames': if non-nil, support is complete
\(annoying), if nil, support is partial.
**** Find file at line number
When text at point is in the form of
~/elisp/helm/helm.el:1234
Helm finds this file at the indicated line number, here 1234.
**** Find URL at point
When a URL is found at point, Helm expands to that URL only.
Pressing `RET' opens that URL using `browse-url-browser-function'.
**** Find e-mail address at point
When an e-mail address is found at point, Helm expands to this e-mail address
prefixed with \"mailto:\". Pressing `RET' opens a message buffer with that
e-mail address.
*** Quick pattern expansion
**** Enter `~/' at end of pattern to quickly reach home directory
**** Enter `/' at end of pattern to quickly reach the file system root
**** Enter `./' at end of pattern to quickly reach `default-directory'
\(As per its value at the beginning of the session.)
If you already are in the `default-directory' this will move the cursor to the top.
**** Enter `../' at end of pattern will reach upper directory, moving cursor to the top
This is different from using `\\<helm-find-files-map>\\[helm-find-files-up-one-level]' in that it moves
the cursor to the top instead of remaining on the previous subdir name.
**** Enter `..name/' at end of pattern to start a recursive search
It searches directories matching \"name\" under the current directory, see the
\"Recursive completion on subdirectories\" section below for more details.
**** Any environment variable (e.g. `$HOME') at end of pattern gets expanded
**** Any valid filename yanked after pattern gets expanded
**** Special case: URL at point
The quick expansions do not take effect after end a URL, you must kill the
pattern first (`\\[helm-delete-minibuffer-contents]').
*** Helm-find-files supports fuzzy matching
It starts from the third character of the pattern.
For instance \"fob\" or \"fbr\" will complete \"foobar\" but \"fb\" needs a
third character in order to complete it.
*** Use `\\[universal-argument] \\[helm-execute-persistent-action]' or `\\[helm-follow-action-forward]' to display an image
*** `\\[helm-execute-persistent-action]' on a filename expands to that filename in the Helm buffer
Second hit displays the buffer filename.
Third hit kills the buffer filename.
Note: `\\[universal-argument] \\[helm-execute-persistent-action]' displays the buffer directly.
*** Browse images directories with `helm-follow-mode' and navigate up/down
You can also use `helm-follow-action-forward' and `helm-follow-action-backward' with
`\\[helm-follow-action-forward]' and `\\[helm-follow-action-backward]' respectively.
*** Toggle auto-completion with `\\[helm-ff-run-toggle-auto-update]'
It is useful when trying to create a new file or directory and you don't want
Helm to complete what you are writing.
Note: On a terminal, the default binding `C-<backspace>' may not work.
In this case use `C-c <backspace>'.
*** You can create a new directory and a new file at the same time
Simply write the path in the prompt and press `RET', e.g.
\"~/new/newnew/newnewnew/my_newfile.txt\".
*** To create a new directory, append a \"/\" to the new name and press `RET'
*** To create a new file, enter a filename not ending with \"/\"
*** Recursive search from Helm-find-files
**** You can use Helm-browse-project (see binding below)
- With no prefix argument:
If the current directory is under version control with either git or hg and
helm-ls-git and/or helm-ls-hg are installed, it lists all the files under
version control. Otherwise it falls back to Helm-find-files. See
https://github.com/emacs-helm/helm-ls-git and
https://github.com/emacs-helm/helm-ls-hg.
- With one prefix argument:
List all the files under this directory and other subdirectories
\(recursion) and this list of files will be cached.
- With two prefix arguments:
Same but the cache is refreshed.
**** You can start a recursive search with \"locate\" or \"find\"
See \"Note\" in the [[Recusive completion on subdirectories][section on subdirectories]].
Using \"locate\", you can enable the local database with a prefix argument. If the
local database doesn't already exists, you will be prompted for its creation.
If it exists and you want to refresh it, give it two prefix args.
When using locate the helm-buffer remains empty until you type something.
Regardless Helm uses the basename of the pattern entered in the helm-find-files
session by default. Hitting `\\[next-history-element]' should just kick in the
locate search with this pattern. If you want Helm to automatically do this, add
`helm-source-locate' to `helm-sources-using-default-as-input'.
**** Recursive completion on subdirectories
Starting from the directory you are currently browsing, it is possible to have
completion of all directories underneath. Say you are at \"/home/you/foo/\" and
you want to go to \"/home/you/foo/bar/baz/somewhere/else\", simply type
\"/home/you/foo/..else\" and hit `\\[helm-execute-persistent-action]' or enter
the final \"/\". Helm will then list all possible directories under \"foo\"
matching \"else\".
Entering two spaces before \"else\" instead of two dots also works.
Note: Completion on subdirectories uses \"locate\" as backend, you can configure
the command with `helm-locate-recursive-dirs-command'. Because this completion
uses an index, the directory tree displayed may be out-of-date and not reflect
the latest change until you update the index (using \"updatedb\" for \"locate\").
If for some reason you cannot use an index, the \"find\" command from
\"findutils\" can be used instead. It will be slower though. You need to pass
the basedir as first argument of \"find\" and the subdir as the value for
'-(i)regex' or '-(i)name' with the two format specs that are mandatory in
`helm-locate-recursive-dirs-command'.
Examples:
- \"find %s -type d -name '*%s*'\"
- \"find %s -type d -regex .*%s.*$\"
*** Insert filename at point or complete filename at point
On insertion (not on completion, i.e. there is nothing at point):
- `\\[helm-ff-run-complete-fn-at-point]': insert absolute file name.
- `\\[universal-argument] \\[helm-ff-run-complete-fn-at-point]': insert abbreviated file name.
- `\\[universal-argument] \\[universal-argument] \\[helm-ff-run-complete-fn-at-point]': insert relative file name.
On completion:
- Target starts with \"~/\": insert abbreviate file name.
- target starts with \"/\" or \"[a-z]:/\": insert full path.
- Otherwise: insert relative file name.
*** Use the wildcard to select multiple files
Use of wilcard is supported to run an action over a set of files.
Example: You can copy all the files with \".el\" extension by using \"*.el\" and
then run copy action.
Similarly, \"**.el\" (note the two stars) will recursively select all \".el\"
files under the current directory.
Note that when recursively copying files, you may have files with same name
dispatched across different subdirectories, so when copying them in the same
directory they will get overwritten. To avoid this Helm has a special action
called \"backup files\" that has the same behavior as the command line \"cp -f
--backup=numbered\": it allows you to copy many files with the same name from
different subdirectories into one directory. Files with same name are renamed
as follows: \"foo.txt.~1~\". Like with the --force option of cp, it is possible
to backup files in current directory.
This command is available only when `dired-async-mode' is active.
When using an action that involves an external backend (e.g. grep), using \"**\"
is not recommended (even thought it works fine) because it will be slower to
select all the files. You are better off leaving the backend to do it, it will
be faster. However, if you know you have not many files it is reasonable to use
this, also using not recursive wilcard (e.g. \"*.el\") is perfectly fine for
this.
The \"**\" feature is active by default in the option `helm-file-globstar'. It
is different from the Bash \"shopt globstar\" feature in that to list files with
a named extension recursively you would write \"**.el\" whereas in Bash it would
be \"**/*.el\". Directory selection with \"**/\" like Bash \"shopt globstar\"
option is not supported yet.
*** Query replace regexp on filenames
Replace different parts of a file basename with something else.
When calling this action you will be prompted twice as with
`query-replace', first for the matching expression of the text to
replace and second for the replacement text. Several facilities,
however, are provided to make the two prompts more powerfull.
**** Syntax of the first prompt
In addition to simple regexps, these shortcuts are available:
- Basename without extension => \"%.\"
- Only extension => \".%\"
- Substring => \"%:<from>:<to>\"
- Whole basename => \"%\"
**** Syntax of the second prompt
In addition to a simple string to use as replacement, here is what you can use:
- A placeholder refering to what you have selected in the first prompt: \"\\@\".
After this placeholder you can use a search-and-replace syntax à-la sed:
\"\\@/<regexp>/<replacement>/
You can select a substring from the string represented by the placeholder:
\"\\@:<from>:<to>\"
- A special character representing a number which is incremented: \"\\#\".
- Shortcuts for `upcase', `downcase' and `capitalize'
are available as`%u', `%d' and `%c' respectively.
**** Examples
***** Recursively rename all files with \".JPG\" extension to \".jpg\"
Use the `helm-file-globstar' feature described in [[Using wildcard to select multiple files][recursive globbing]]
by entering \"**.JPG\" at the end of the Helm-find-files pattern, then hit
\\<helm-map>\\[helm-ff-query-replace-on-filenames]: First \"JPG\", then \"jpg\"
and hit `RET'.
Alternatively you can enter \".%\" at the first prompt, then \"jpg\" and hit
`RET'. Note that when using this instead of using \"JPG\" at the first prompt,
all extensions will be renamed to \"jpg\" even if the extension of one of the
files is, say, \"png\". If you want to keep the original extension you can use
\"%d\" at the second prompt (downcase).
***** Batch-rename files from number 001 to 00x
Use \"\\#\" inside the second prompt.
Example 1: To rename the files
foo.jpg
bar.jpg
baz.jpg
to
foo-001.jpg
foo-002.jpg
foo-003.jpg
use \"%.\" as matching regexp and \"foo-\\#\" as replacement string.
Example 2: To rename the files
foo.jpg
bar.jpg
baz.jpg
to
foo-001.jpg
bar-002.jpg
baz-003.jpg
use as matching regexp \"%.\" and as replacement string \"\\@-\\#\".
***** Replace a substring
Use \"%:<from>:<to>\".
Example: To rename files
foo.jpg
bar.jpg
baz.jpg
to
fOo.jpg
bAr.jpg
bAz.jpg
use as matching regexp \"%:1:2\" and as replacement string \"%u\" (upcase).
Note that you \*cannot* use \"%.\" and \".%\" along with substring replacement.
***** Modify the string from the placeholder (\\@)
- By substring, i.e. only using the substring of the placeholder: \"\\@:<from>:<to>\".
The length of placeholder is used for <to> when unspecified.
Example 1: \"\\@:0:2\" replaces from the beginning to the second char of the placeholder.
Example 2: \\@:2: replaces from the second char of the placeholder to the end.
- By search-and-replace: \"\\@/<regexp>/<replacement>/\".
Incremental replacement is also handled in <replacement>.
Example 3: \"\\@/foo/bar/\" replaces \"foo\" by \"bar\" in the placeholder.
Example 4: \"\\@/foo/-\\#/\" replaces \"foo\" in the placeholder by 001, 002, etc.
***** Clash in replacements (avoid overwriting files)
When performing any of these replacement operations you may end up with same
names as replacement. In such cases Helm numbers the file that would otherwise
overwritten. For instance, should you remove the \"-m<n>\" part from the files
\"emacs-m1.txt\", \"emacs-m2.txt\" and \"emacs-m3.txt\" you would end up with
three files named \"emacs.txt\", the second renaming overwriting first file, and
the third renaming overwriting second file and so on. Instead Helm will
automatically rename the second and third files as \"emacs(1).txt\" and
\"emacs(2).txt\" respectively.
***** Query-replace on filenames vs. serial-rename action
Unlike the [[Serial renaming][serial rename]] actions, the files renamed with
the query-replace action stay in their initial directory and are not moved to
the current directory. As such, using \"\\#\" to serial-rename files only makes
sense for files inside the same directory. It even keeps renaming files
with an incremental number in the next directories.
*** Serial-rename
You can use the serial-rename actions to rename, copy or symlink marked files to
a specific directory or in the current directory with all the files numbered
incrementally.
- Serial-rename by renaming:
Rename all marked files with incremental numbering to a specific directory.
- Serial-rename by copying:
Copy all marked files with incremental numbering to a specific directory.
- Serial-rename by symlinking:
Symlink all marked files with incremental numbering to a specific directory.
*** Edit marked files in a dired buffer
You can open a dired buffer containing only marked files with `\\<helm-find-files-map>\\[helm-ff-run-marked-files-in-dired]'.
With a prefix argument you can open this same dired buffer in wdired mode for
editing. Note that wildcards are supported as well, so you can use e.g.
\"*.txt\" to select all \".txt\" files in the current directory or \"**.txt\" to
select all files recursively from the current directory.
See [[Use the wildcard to select multiple files]] section above.
*** Defining default target directory for copying, renaming, etc
You can customize `helm-dwim-target' to behave differently depending on the
windows open in the current frame. Default is to provide completion on all
directories associated to each window.
*** Copying and renaming asynchronously
If you have the async library installed (if you got Helm from MELPA you do), you
can use it for copying/renaming files by enabling `dired-async-mode'.
Note that even when async is enabled, running a copy/rename action with a prefix
argument will execute action synchronously. Moreover it will follow the first
file of the marked files in its destination directory.
When `dired-async-mode' is enabled, an additional action named \"Backup files\"
will be available. (Such command is not natively available in Emacs).
See [[Use the wildcard to select multiple files]] for details.
*** Bookmark the `helm-find-files' session
You can bookmark the `helm-find-files' session with `\\[helm-ff-bookmark-set]'.
You can later retrieve these bookmarks by calling `helm-filtered-bookmarks'
or, from the current `helm-find-files' session, by hitting `\\[helm-find-files-toggle-to-bookmark]'.
*** Grep files from `helm-find-files'
You can grep individual files from `helm-find-files' by using
\`\\<helm-find-files-map>\\[helm-ff-run-grep]'. This same command can also
recursively grep files from the current directory when called with a prefix
argument. In this case you will be prompted for the file extensions to use
\(grep backend) or the types of files to use (ack-grep backend). See the
`helm-grep-default-command' documentation to set this up. For compressed files
or archives, use zgrep with \`\\<helm-find-files-map>\\[helm-ff-run-zgrep]'.
Otherwise you can use recursive commands like \`\\<helm-find-files-map>\\[helm-ff-run-grep-ag]' or `\\<helm-find-files-map>\\[helm-ff-run-git-grep]'
that are much faster than using `\\<helm-find-files-map>\\[helm-ff-run-grep]' with a prefix argument.
See `helm-grep-ag-command' and `helm-grep-git-grep-command' to set this up.
You can also use \"id-utils\"' GID with \`\\<helm-find-files-map>\\[helm-ff-run-gid]'
by creating an ID index file with the \"mkid\" shell command.
All those grep commands use the symbol at point as the default pattern.
Note that default is different from input (nothing is added to the prompt until
you hit `\\[next-history-element]').
**** Grepping on remote files
On remote files grep is not well supported by TRAMP unless you suspend updates before
entering the pattern and re-enable it once your pattern is ready.
To toggle suspend-update, use `\\<helm-map>\\[helm-toggle-suspend-update]'.
*** Setting up aliases in Eshell allows you to set up powerful customized commands
Adding Eshell aliases to your `eshell-aliases-file' or using the
`alias' command from Eshell allows you to create personalized
commands not available in `helm-find-files' actions and use them
from `\\<helm-find-files-map>\\[helm-ff-run-eshell-command-on-file]'.
Example: You want a command to uncompress some \"*.tar.gz\" files from `helm-find-files':
1) Create an Eshell alias named, say, \"untargz\" with the command
\"alias untargz tar zxvf $*\".
2) Now from `helm-find-files' select the \"*.tar.gz\" file (you can also
mark files if needed) and hit `\\<helm-find-files-map>\\[helm-ff-run-eshell-command-on-file]'.
Note: When using marked files with this, the meaning of the prefix argument is
quite subtle. Say you have \"foo\", \"bar\" and \"baz\" marked; when you run
the alias command `example' on these files with no prefix argument it will run
`example' sequentially on each file:
$ example foo
$ example bar
$ example baz
With a prefix argument however it will apply `example' on all files at once:
$ example foo bar baz
Of course the alias command should support this.
*** Using TRAMP with `helm-find-files' to read remote directories
`helm-find-files' works fine with TRAMP despite some limitations.
- By default filenames are not highlighted when working on remote directories,
this is controled by `helm-ff-tramp-not-fancy' variable. If you change this,
expect Helm to be very slow unless your connection is super fast.
- Grepping files is not very well supported when used incrementally.
See [[Grepping on remote files]].
- Locate does not work on remote directories.
**** A TRAMP syntax crash course
Please refer to TRAMP's documentation for more details.
- Connect to host 192.168.0.4 as user \"foo\":
/scp:192.168.0.4@foo:
- Connect to host 192.168.0.4 as user \"foo\" on port 2222:
/scp:192.168.0.4@foo#2222:
- Connect to host 192.168.0.4 as root using multihops syntax:
/ssh:192.168.0.4@foo|sudo:192.168.0.4:
Note: You can also use `tramp-default-proxies-alist' when connecting often to
the same hosts.
As a rule of thumb, prefer the scp method unless using multihops (which only
works with the ssh method), especially when copying large files.
You need to hit `C-j' once on top of a directory on the first connection
to complete the pattern in the minibuffer.
**** Completing host
As soon as you enter the first \":\" after method e.g =/scp:\= you will
have some completion about previously used hosts or from your =~/.ssh/config\=
file, hitting `\\[helm-execute-persistent-action]' or `right' on a candidate will insert this host in minibuffer
without addind the ending \":\".
As soon the last \":\" is entered TRAMP will kick in and you should see the list
of candidates soon after.
When connection fails, be sure to delete your TRAMP connection with M-x
`helm-delete-tramp-connection' before retrying.
**** Editing local files as root
Use the sudo method:
\"/sudo:host:\" or simply \"/sudo::\".
*** Attach files to a mail buffer (message-mode)
If you are in a `message-mode' or `mail-mode' buffer, that action will appear
in action menu, otherwise it is available at any time with \\<helm-find-files-map>\\[helm-ff-run-mail-attach-files].
It behaves as follows:
- If you are in a (mail or message) buffer, files are attached there.
- If you are not in a mail buffer but one or more mail buffers exist, you are
prompted to attach files to one of these mail buffers.
- If you are not in a mail buffer and no mail buffer exists,
a new mail buffer is created with the attached files in it.
*** Open files in separate windows
When [[Marked candidates][marking]] multiple files or using [[Use the wildcard to select multiple files][wildcard]], helm allow opening all
this files in separate windows using an horizontal layout or a
vertical layout if you used a prefix arg, when no more windows can be
displayed in frame, next files are opened in background without being
displayed. When using \\<helm-find-files-map>\\[helm-ff-run-switch-other-window] the current
buffer is kept and files are displayed next to it with same behavior as above.
When using two prefix args, files are opened in background without beeing displayed.
*** Expand archives as directories in a avfs directory
If you have mounted your filesystem with mountavfs,
you can expand archives in the \"~/.avfs\" directory with \\<helm-map>\\[helm-execute-persistent-action].
*** Tramp archive support (emacs-27+ only)
If your emacs have library tramp-archive.el, you can browse the
content of archives with emacs and BTW helm-find-files. However this beeing
experimental and not very fast, helm doesn't provide an automatic
expansion and detection of archives, you will have to add the final /
manually and may have to force update (\\<helm-map>\\[helm-refresh])
or remove and add again the final / until tramp finish decompressing archive.
*** Touch files
In the completion buffer, you can choose the default which is the current-time, it is
the first candidate or the timestamp of one of the selected files.
If you need to use something else, use \\<helm-map>\\[next-history-element] and edit
the date in minibuffer.
It is also a way to quickly create a new file without opening a buffer, saving it
and killing it.
To touch more than one new file, separate you filenames with a comma (\",\").
If one wants to create (touch) a new file with comma inside the name use a prefix arg,
this will prevent splitting the name and create multiple files.
** Commands
\\<helm-find-files-map>
\\[helm-ff-run-locate]\t\tRun `locate' (`\\[universal-argument]' to specify locate database, `M-n' to insert basename of candidate).
\\[helm-ff-run-browse-project]\t\tBrowse project (`\\[universal-argument]' to recurse, `\\[universal-argument] \\[universal-argument]' to recurse and refresh database).
\\[helm-ff-run-find-sh-command]\t\tRun `find' shell command from this directory.
\\[helm-ff-run-grep]\t\tRun Grep (`\\[universal-argument]' to recurse).
\\[helm-ff-run-pdfgrep]\t\tRun Pdfgrep on marked files.
\\[helm-ff-run-zgrep]\t\tRun zgrep (`\\[universal-argument]' to recurse).
\\[helm-ff-run-grep-ag]\t\tRun AG grep on current directory.
\\[helm-ff-run-git-grep]\t\tRun git-grep on current directory.
\\[helm-ff-run-gid]\t\tRun gid (id-utils).
\\[helm-ff-run-etags]\t\tRun Etags (`\\[universal-argument]' to use thing-at-point, `\\[universal-argument] \\[universal-argument]' to reload cache).
\\[helm-ff-run-rename-file]\t\tRename Files (`\\[universal-argument]' to follow).
\\[helm-ff-run-query-replace-fnames-on-marked]\t\tQuery replace on marked files.
\\[helm-ff-run-copy-file]\t\tCopy Files (`\\[universal-argument]' to follow).
\\[helm-ff-run-byte-compile-file]\t\tByte Compile Files (`\\[universal-argument]' to load).
\\[helm-ff-run-load-file]\t\tLoad Files.
\\[helm-ff-run-symlink-file]\t\tSymlink Files.
\\[helm-ff-run-hardlink-file]\t\tHardlink files.
\\[helm-ff-run-delete-file]\t\tDelete Files.
\\[helm-ff-run-touch-files]\t\tTouch files.
\\[helm-ff-run-kill-buffer-persistent]\t\tKill buffer candidate without leaving Helm.
\\[helm-ff-persistent-delete]\t\tDelete file without leaving Helm.
\\[helm-ff-run-switch-to-eshell]\t\tSwitch to Eshell.
\\[helm-ff-run-eshell-command-on-file]\t\tEshell command on file (`\\[universal-argument]' to apply on marked files, otherwise treat them sequentially).
\\[helm-ff-run-ediff-file]\t\tEdiff file.
\\[helm-ff-run-ediff-merge-file]\t\tEdiff merge file.
\\[helm-ff-run-complete-fn-at-point]\t\tComplete file name at point.
\\[helm-ff-run-switch-other-window]\t\tSwitch to other window.
\\[helm-ff-run-switch-other-frame]\t\tSwitch to other frame.
\\[helm-ff-run-open-file-externally]\t\tOpen file with external program (`\\[universal-argument]' to choose).
\\[helm-ff-run-open-file-with-default-tool]\t\tOpen file externally with default tool.
\\[helm-ff-rotate-left-persistent]\t\tRotate image left.
\\[helm-ff-rotate-right-persistent]\t\tRotate image right.
\\[helm-find-files-up-one-level]\t\tGo to parent directory.
\\[helm-find-files-history]\t\tSwitch to the visited-directory history.
\\[helm-ff-file-name-history]\t\tSwitch to file name history.
\\[helm-ff-properties-persistent]\t\tShow file properties in a tooltip.
\\[helm-mark-all]\t\tMark all visible candidates.
\\[helm-ff-run-toggle-auto-update]\t\tToggle auto-expansion of directories.
\\[helm-unmark-all]\t\tUnmark all candidates, visible and invisible ones.
\\[helm-ff-run-gnus-attach-files]\t\tGnus' attach files to message buffer.
\\[helm-ff-run-print-file]\t\tPrint file, (`\\[universal-argument]' to refresh printer list).
\\[helm-enlarge-window]\t\tEnlarge Helm window.
\\[helm-narrow-window]\t\tNarrow Helm window.
\\[helm-ff-run-toggle-basename]\t\tToggle basename/fullpath.
\\[helm-ff-run-find-file-as-root]\t\tFind file as root.
\\[helm-ff-run-find-alternate-file]\t\tFind alternate file.
\\[helm-ff-run-insert-org-link]\t\tInsert org link.")
;;; Help for `helm-read-file-name'
;;
;;
(defun helm-read-file-name-help-message ()
(let ((name (if helm-alive-p
(assoc-default 'name (helm-get-current-source))
"generic")))
(format
"* Helm `%s' read file name completion
This is `%s' read file name completion that have been \"helmized\"
because you have enabled [[Helm mode][helm-mode]]'.
Don't confuse this with `helm-find-files' which is a native helm command,
see [[Helm functions vs helmized emacs functions]].
** Tips
*** Navigation
**** Enter `~/' at end of pattern to quickly reach home directory
**** Enter `/' at end of pattern to quickly reach the file system root
**** Enter `./' at end of pattern to quickly reach `default-directory'
\(As per its value at the beginning of the session.)
If you already are in the `default-directory' this will move the cursor to the top.
**** Enter `../' at end of pattern will reach upper directory, moving cursor on top
This is different from using `\\[helm-find-files-up-one-level]' in that it moves
the cursor to the top instead of remaining on the previous subdir name.
**** You can complete with partial basename
It starts from the third character of the pattern.
For instance \"fob\" or \"fbr\" will complete \"foobar\" but \"fb\" needs a
third character in order to complete it.
*** Persistent actions
By default `helm-read-file-name' uses the persistent actions of `helm-find-files'.
**** Use `\\[universal-argument] \\<helm-map>\\[helm-execute-persistent-action]' to display an image
**** `\\<helm-map>\\[helm-execute-persistent-action]' on a filename will expand to this filename in Helm-buffer
Second hit displays the buffer filename.
Third hit kills the buffer filename.
Note: `\\[universal-argument] \\<helm-map>\\[helm-execute-persistent-action]' displays the buffer directly.
**** Browse images directories with `helm-follow-mode' and navigate up/down
*** Delete characters backward
When you want to delete characters backward, e.g. to create a new file or directory,
auto-update may come in the way when it keeps updating to an existent directory.
In that case, type `C-<backspace>' and then `<backspace>'.
This should not be needed when copying/renaming files because autoupdate is disabled
by default in that case.
Note: On a terminal, the default binding `C-<backspace>' may not work.
In this case use `C-c <backspace>'.
*** Create new directories and files
**** You can create a new directory and a new file at the same time
Simply write the path in prompt and press `RET', e.g.
\"~/new/newnew/newnewnew/my_newfile.txt\".
**** To create a new directory, append a \"/\" at to the new name and press `RET'
**** To create a new file, enter a filename not ending with \"/\"
File and directory creation works only with some commands (e.g. `find-file')
and it will not work with others where it is not intended to return a file or
a directory \(e.g `list-directory').
*** Exiting minibuffer with empty string
You can exit minibuffer with empty string with \\<helm-read-file--map>\\[helm-cr-empty-string].
It is useful when some commands are prompting continuously until you enter an empty prompt.
** Commands
\\<helm-read-file-map>
\\[helm-find-files-up-one-level]\t\tGo to parent directory.
\\[helm-ff-run-toggle-auto-update]\t\tToggle auto-expansion of directories.
\\[helm-ff-run-toggle-basename]\t\tToggle basename.
\\[helm-ff-file-name-history]\t\tFile name history.
C/\\[helm-cr-empty-string]\t\tReturn empty string unless `must-match' is non-nil.
\\[helm-next-source]\t\tGo to next source.
\\[helm-previous-source]\t\tGo to previous source."
name name)))
;;; Generic file help - Used by locate.
;;
;;
(defvar helm-generic-file-help-message
"* Helm Generic files
** Tips
*** Locate
You can append to the search pattern any of the locate command line options,
e.g. -b, -e, -n <number>, etc. See the locate(1) man page for more details.
Some other sources (at the moment \"recentf\" and \"file in current directory\")
support the -b flag for compatibility with locate when they are used with it.
When you enable fuzzy matching on locate with `helm-locate-fuzzy-match', the
search will be performed on basename only for efficiency (so don't add \"-b\" at
prompt). As soon as you separate the patterns with spaces, fuzzy matching will
be disabled and search will be done on the full filename. Note that in
multi-match, fuzzy is completely disabled, which means that each pattern is a
match regexp (i.e. \"helm\" will match \"helm\" but \"hlm\" will \*not* match
\"helm\").
*** Browse project
When the current directory is not under version control, don't forget to refresh
the cache when files have been added/removed in the directory.
*** Find command
Recursively search files using the \"find\" shell command.
Candidates are all filenames that match all given globbing patterns. This
respects the options `helm-case-fold-search' and
`helm-findutils-search-full-path'.