-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
fern.txt
1416 lines (1198 loc) · 48.2 KB
/
fern.txt
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
*fern.txt* General purpose asynchronous tree explorer
Author: Alisue <lambdalisue@hashnote.net>
License: MIT license
=============================================================================
CONTENTS *fern-contents*
INTRODUCTION |fern-introduction|
FEATURES |fern-features|
PLUGINS |fern-plugins|
USAGE |fern-usage|
ACTION |fern-action|
CUSTOM |fern-custom|
COMPARATOR |fern-comparator|
RENDERER |fern-renderer|
INTERFACE |fern-interface|
VARIABLE |fern-variable|
COMMAND |fern-command|
FUNCTION |fern-function|
AUTOCMD |fern-autocmd|
HIGHLIGHT |fern-highlight|
MAPPING |fern-mapping|
GLOBAL |fern-mapping-global|
FILE |fern-mapping-file|
DICT |fern-mapping-dict|
GLOSSARY |fern-glossary|
DEVELOPMENT |fern-development|
=============================================================================
INTRODUCTION *fern-introduction*
*vim-fern* (fern) is a general purpose asynchronous tree explorer written in
pure Vim script. It provides "file" scheme in default to use it as a file
explorer.
-----------------------------------------------------------------------------
FEATURES *fern-features*
No external dependencies~
Fern is written in pure Vim script without any external libraries
(note that vim-jp/vital.vim is bundled, not external dependencies) so
users do NOT need to install anything rather than vim-fern itself.
Exception: "trash" feature in Linux.
https://github.com/lambdalisue/vital-Whisky/issues/31
Asynchronous~
Fern uses asynchronous technique to perform most of operations so Vim
would not freeze during operations. It is probably obvious in Windows
while file operations in Windows are relatively slow.
Split windows or project drawer~
Fern supports both styles; split windows (e.g. netrw) and project
drawer (e.g. NERDTree); officially.
Buffer name base~
Fern is developed based on |BufReadCmd| technique like netrw. Thus any
buffer starts from "fern://" are handled by fern and required
arguments and options are read from the buffer name. That's why fern
integrate well with |session|.
Action~
Fern provides operation as action. When user hit "?", all actions and
corresponding mapping (if exist) are shown. When user hit "a", an
action prompt will popped up and user can input an action to execute.
So users don't have to remember complex mappings to execute operation
which is not often required.
Window selector~
Fern has an internal window selector which works like
t9md/vim-choosewin. Users can quickly select which window to open a
selected node.
See |hl-FernWindowSelectIndicator| and |hl-FernWindowSelectStatusLine|
to customize the statusline when selecting a window.
https://github.com/t9md/vim-choosewin
Renamer (A.k.a exrename)~
Fern has an internal renamer which works like "exrename" in
Shougo/vimfiler. Users can edit multiple path of nodes in Vim's
buffer and ":w" to apply changes to actual nodes (file, directory,
bookmark, etc.)
https://github.com/Shougo/vimfiler
System CRUD operations ("file" scheme)~
Fern supports file system CRUD operations. Users can create, delete,
rename files/directories through fern.
System program support ("file" scheme)~
Fern supports to open a file/directory through a system default
program. So it's quite easy to open a directory with Explorer
(Windows), Finder (macOS), or whatever.
System trash-bin support ("file" scheme)~
Fern supports system trash-bin by PowerShell (Windows), osascript
(macOS), and 3rd party applications (Linux). Any files/directories
deleted by "trash" action are sent to system trash-bin rather than
actual delete.
-----------------------------------------------------------------------------
PLUGINS *fern-plugins*
Most of functionalities are provided as plugins in fern.
So visit the following URL to find fern plugins.
https://github.com/topics/fern-vim-plugin
For example, following features are provided as official plugins
- Netrw hijack (Use fern as a default file explorer)
- Nerd Fonts integration (https://www.nerdfonts.com/)
- Git integration (show status, touch index, ...)
- Bookmark feature
And lot more!
=============================================================================
USAGE *fern-usage*
Open fern at the current working directory by
>
:Fern .
<
Or a parent directory of the current buffer by
>
:Fern %:h
<
On a fern buffer, hit
"?" List mappings/actions available
"a" Open a prompt to input action to execute
-----------------------------------------------------------------------------
ACTION *fern-action*
Action is a special mapping which is defined on a fern buffer and looks like:
<Plug>(fern-action-{name})
where {name} is a name of the action.
Note that any mappings defined in user custom code (|fern-custom|) are
registered as action as well if the name of the mapping followed above rule.
*fern-action-mapping*
Fern defines the following mappings for actions:
"?" List mappings/actions available
"a" Open a prompt to input action to execute
"." Repeat previous action which has executed from a prompt
Note that |g:fern#disable_default_mappings| does not affect mappings above.
Users have to define alternative mappings to disable default mappings like:
>
" Use g? to show help instead of ?
nmap <buffer> g? <Plug>(fern-action-help)
<
*fern-action-capture*
Use "capture" to redirects an action output to a separate buffer like:
>
action: capture help
<
*fern-action-verbose*
Use "verbose" to execute an action in |verbose| mode like:
>
action: verbose expand
<
-----------------------------------------------------------------------------
CUSTOM *fern-custom*
Use |FileType| |autocmd| with "fern" like:
>
function! s:init_fern() abort
" Write custom code here
endfunction
augroup my-fern
autocmd! *
autocmd FileType fern call s:init_fern()
augroup END
<
The autocmd will be called AFTER fern buffer has initialized but BEFORE any
content had loaded.
*fern-custom-alias*
Fern provides some features as mapping alias. For example, you may found
entries like below by "?":
>
e open <Plug>(fern-action-open)
<Plug>(fern-action-open) open:edit <Plug>(fern-action-open:edit)
<
Above mean that when you hit "e", the "open" action is executed and the "open"
action execute "open:edit" action.
So if you want to use "open:split" action instead of "open:edit" when you
hit "e", add the following code:
>
" Use 'open:split' instead of 'open:edit' for 'open' action
nmap <buffer> <Plug>(fern-action-open) <Plug>(fern-action-open:split)
<
*fern-custom-wait*
Fern provide |<Plug>(fern-wait)| mapping as a helper.
For example, following execute "tcd:root" action every after "leave" action.
>
nmap <buffer> <Plug>(fern-my-leave-and-tcd)
\ <Plug>(fern-action-leave)
\ <Plug>(fern-wait)
\ <Plug>(fern-action-tcd:root)
<
Without <Plug>(fern-wait), the "tcd:root" action will be invoked before actual
"leave" while "leave" action is asynchronous.
*fern-custom-smart*
Fern provide following mapping helper functions:
|fern#smart#leaf()| Return a mapping expression determined by a
status of a current cursor node
|fern#smart#drawer()| Return a mapping expression determined by a
style of a current fern window
|fern#smart#scheme()| Return a mapping expression determined by a
scheme of a current fern tree
|fern#smart#root()| Return a mapping expression determined by a
kind of a current cursor node
For example, following execute "open" on leaf but "expand" on branch.
>
nmap <buffer><expr> <Plug>(fern-my-open-or-expand)
\ fern#smart#leaf(
\ "<Plug>(fern-action-open)",
\ "<Plug>(fern-action-expand)",
\ )
<
See https://github.com/lambdalisue/vim-fern/wiki/ for custom tips.
=============================================================================
COMPARATOR *fern-comparator*
Comparator is an object to sort nodes for making a tree.
Users can create user custom comparator to change the order of appearance of
nodes in the tree.
See |fern-develop-comparator| for more details.
=============================================================================
RENDERER *fern-renderer*
Renderer is an object to render nodes as a tree like (default renderer):
>
vim-fern
|- autoload
|+ fern
|+ vital
| vim-fern
|- doc
| fern-develop.txt
| fern.txt
| tags
|+ ftplugin
|+ plugin
|+ test
| LICENSE
| README.md
<
Users can customize above appearance by the following variables.
*g:fern#renderer#default#leading*
A |String| used as leading space unit (one indentation level.)
Default: " "
*g:fern#renderer#default#root_symbol*
A |String| used as a symbol of root node.
Default: ""
*g:fern#renderer#default#leaf_symbol*
A |String| used as a symbol of leaf node (non branch node like file).
Default: "| "
*g:fern#renderer#default#collapsed_symbol*
A |String| used as a symbol of collapsed branch node.
Default: "|+ "
*g:fern#renderer#default#expanded_symbol*
A |String| used as a symbol of expanded branch node.
Default: "|- "
See |FernHighlight| and |fern-highlight| to change pre-defeined |highlight|.
Or create user custom renderer to change the appearance completely.
See |fern-develop-renderer| for more details.
=============================================================================
INTERFACE *fern-interface*
-----------------------------------------------------------------------------
VARIABLE *fern-variable*
*g:fern_disable_startup_warnings*
Set 1 to disable startup warning messages.
Default: 0
*g:fern#profile*
Set 1 to enable fern profiling mode.
Default: 0
*g:fern#logfile*
A path |String| to log messages or |v:null| to log messages via
|echomsg|.
>
let g:fern#logfile = "~/fern.tsv"
<
Default: |v:null|
*g:fern#loglevel*
A |Number| to indicate a current loglevel. Use the following constant
variable to set loglevel.
*g:fern#DEBUG* Debug level
*g:fern#INFO* Info level
*g:fern#WARN* Warn level
*g:fern#ERROR* Error level
Default: |g:fern#ERROR|
*g:fern#opener*
A default |fern-opener| used to open a fern buffer itself in split
windows style.
Default: 'edit'
*g:fern#hide_cursor*
Set 1 to forcibly hide the cursor for the fern window (see |t_ve|).
Note that Neovim prior to 0.5.0 cannot hide the cursor thus faint
vertical bar is used instead.
*g:fern#hide_cursorline*
Set 1 to forcibly disable |cursorline| for the fern window
when focus is not on the fern window.
*g:fern#keepalt_on_edit*
Set 1 to apply |keepalt| on the "open:edit" action to keep an
|alternate-file| in a split windows style like:
>
g:fern#keepalt_on_edit = 0 1
+---------+ +---------+
:edit A | %:A | | %:A |
| #: | | #: |
+---------+ +---------+
v v
+---------+ +---------+
:Fern . | %:fern | | %:fern |
| #:A | | #:A |
+---------+ +---------+
v v
+---------+ +---------+
open:edit | %:B | | %:B |
on 'B' | #:fern | | #:A |
+---------+ +---------+
<
Default: 0
*g:fern#keepjumps_on_edit*
Set 1 to apply |keepjumps| on the "open:edit" action to keep a
|jumplist| in a split windows style like:
>
g:fern#keepjumps_on_edit = 0 1
+---------+ +---------+
| 0:A | | 0:A |
:edit A | 1: | | 1: |
| 2: | | 2: |
+---------+ +---------+
v v
+---------+ +---------+
| 0:fern | | 0:Fern |
:Fern . | 1:A | | 1:A |
| 2: | | 2: |
+---------+ +---------+
v v
+---------+ +---------+
| 0:B | | 0:B |
open:edit | 1:fern | | 1:A |
on 'B' | 2:A | | 2: |
+---------+ +---------+
<
Note that even with this option, any |jump-motions| performed in a
fern buffer updates |jumplist|. For example, if user move cursors by
"G" in above situation, |CTRL-O| in last step jumps to the fern buffer
rather than a buffer "A" because a jump for "G" has recoreded in
|jumplist|.
Default: 0
*g:fern#disable_default_mappings*
Set 1 to disable default mappings
Note that this variable does not affect mappings for actions.
See |fern-action-mapping| for more detail.
Default: 0
*g:fern#disable_viewer_spinner*
Set 1 to disable viewer spinner shown on a sign column.
Note that the default value will be 1 if CUI Vim is running on
Windows. See https://github.com/lambdalisue/vim-fern/issues/256 for
detail.
*g:fern#disable_viewer_auto_duplication*
Set 1 to disable viewer auto duplication on |WinEnter| autocmd.
The duplication is mainly occured when user execute |split| or
|vsplit| command to duplicate window.
*g:fern#disable_drawer_auto_winfixwidth*
Set 1 to disable automatically enable 'winfixwidth' to drawer on
|BufEnter| autocmd. Note that it automatically set 'nowinfixwidth' on
the autocmd when there is only one window.
Default: 0
*g:fern#disable_drawer_auto_resize*
Set 1 to disable automatically resize drawer on |BufEnter| autocmd.
Note that this feature is automatically disabled on floating windows
of Neovim to avoid unwilling resize reported as #294
https://github.com/lambdalisue/vim-fern/issues/294
Default: 0
*g:fern#disable_drawer_hover_popup*
Set 1 to disable popups shown when the name of a node extends beyond
the width of the drawer.
Note that this feature is required the |win_execute| and
popup/floatwin features.
Default: 0
*g:fern#disable_drawer_tabpage_isolation*
Set 1 to disable the drawer tabpage isolation.
If disabled, there is only one left or right drawer across the all the
windows and tabs for a given VIM instance.
Default: 0
*g:fern#disable_drawer_smart_quit*
Set 1 to disable smart quit behavior when there are only two buffer
remains (one is for the drawer styled fern window.)
The smart quit behavior is something like below (assume that #
indicate the cursor position.)
>
g:fern#disable_drawer_smart_quit = 0
:Fern . -drawer -stay +--+---------------+
|FE|# |
|RN| |
+--+---------------+
:q Quit vim
:Fern . -drawer -stay -keep +--+---------------+
|FE|# |
|RN| |
+--+---------------+
:q +------------------+
|FE|# (new buffer) |
|RN| |
+------------------+
g:fern#disable_drawer_smart_quit = 1
:Fern . -drawer -stay +--+---------------+
|FE|# |
|RN| |
+--+---------------+
:q +------------------+
|FE |
|RN |
+------------------+
<
Default: 0
*g:fern#disable_drawer_auto_restore_focus*
Set 1 to disable automatic focus restore on drawer close.
The behavior changes like: (# indicate the cursor)
>
g:fern#disable_drawer_auto_restore_focus = 0
+---------------+---------------+
| |# |
| | |
+---------------+---------------+
:Fern . -drawer -stay +----+------------+-------------+
| | |# |
| | | |
+----+------------+-------------+
:Fern . -drawer -toggle +---------------+---------------+
| |# |
| | |
+---------------+---------------+
g:fern#disable_drawer_auto_restore_focus = 1
+---------------+---------------+
| |# |
| | |
+---------------+---------------+
:Fern . -drawer -stay +----+------------+-------------+
| | |# |
| | | |
+----+------------+-------------+
:Fern . -drawer -toggle +---------------+---------------+
|# | |
| | |
+---------------+---------------+
<
Default: 0
*g:fern#default_hidden*
Set 1 to enter hidden mode (show hidden files) in default.
Default: 0
*g:fern#default_include*
A default |String| pattern used to filter nodes (include).
Default: ''
*g:fern#default_exclude*
A default |String| pattern used to filter nodes (exclude).
Default: ''
*g:fern#renderer*
A |String| name of renderer used to render tree items. Allowed value
is a key of |g:fern#renderers|.
Default: "default"
*g:fern#enable_textprop_support*
If set to 1, renderers may return lines of text with text properties.
May incur slight performance penalty. See |fern-develop-renderer|.
Default: 0
*g:fern#comparator*
A |String| name of comparator used to sort tree items. Allowed value
is a key of |g:fern#comparators|.
Default: "default"
*g:fern#drawer_width*
A |Number|, the default width of the drawer window.
Default: 30
*g:fern#drawer_keep*
A |Boolean| which indicate whether the last fern window should be keep
open or close.
Default: |v:false|
*g:fern#drawer_hover_popup_delay*
A |Number| value to specify the delay time to show the hover popup.
See |g:fern#disable_drawer_hover_popup|
Default: |0|
*g:fern#mark_symbol*
A |String| which is used as a mark symbol text.
Note that users must restart Vim to apply changes.
Default: "*"
*g:fern#scheme#file#show_absolute_path_on_root_label*
A |Boolean| to show an absolute path of the root node of "file" scheme
as a label of the node.
Default: 0
*g:fern#disable_auto_buffer_delete*
A |Number| value that specifies whether to synchronize file removes to the buffer
Default: 0
*g:fern#disable_auto_buffer_rename*
A |Number| value that specifies whether to synchronize file renames to the buffer
Default: 0
*g:fern#window_selector_use_popup*
A |Boolean| which use popup/float window to select window.
See |fern-glossary-window-selector|
Default: 0
-----------------------------------------------------------------------------
COMMAND *fern-command*
*:Fern*
:Fern {url} [-opener={opener}] [-stay] [-wait] [-reveal={reveal}]
Open a fern buffer in split windows style with the {opener}.
If -stay options is specified, the focus stays on a window where the
command has executed. If -wait option is specified, the command wait
synchronously until the fern buffer become ready.
*fern-reveal*
If {reveal} is specified, parent nodes of the node which is identified
by the {reveal} are expanded and the node will be focused.
The {reveal} must be a relative path separated by "/" from the
specfied {url}.
Note that if the {url} is for "file" scheme, an absolute path can be
specified to the {reveal}.
*fern-opener*
One of the following value is available for the {opener}:
"select" Select which window to open a buffer
"split" Open a buffer by |split|
"vsplit" Open a buffer by |vsplit|
"tabedit" Open a buffer by |tabedit|
"edit" Open a buffer by |edit| or fail when the buffer is
|modified|
"edit/split" Open a buffer by |edit| or |split| when the buffer is
|modified|
"edit/vsplit" Open a buffer by |edit| or |vsplit| when the buffer is
|modified|
"edit/tabedit" Open a buffer by |edit| or |tabedit| when the buffer
is |modified|
Additionally, any modifiers (|mods|) are allowd to be prepend (e.g.
"topleft split".)
Note that the command can be followed by a '|' and another command.
*:Fern-drawer*
:Fern {url} -drawer [-width={width}] [-keep] [-toggle] [-right]...
Open a fern buffer in project drawer style with the {width}.
If the {width} is specified, the width of the window is regulated to
the specified value. (See |g:fern#drawer_width|)
If "-keep" option is specified, the buffer won't close even if only
this window exists. (See |g:fern#drawer_keep|)
If "-toggle" option is specified, an existing fern buffer will be
closed rather than opening a new one.
If "-right" option is specified, the drawer is placed on the right
side.
See |:Fern| for other arguments and options. Note that -opener options
is ignored for project drawer style.
*:FernDo*
:FernDo {expr...} [-drawer] [-right] [-stay]
Focus a next fern viewer and execute {expr...}. It does nothing if no
next fern viewer is found.
If "-drawer" option is specified, it focus and execute only a project
drawer style fern.
If "-right" option is specified, the drawer on the right side is used.
If "-stay" option is specified, it stay focus after execution.
Note that the command can be followed by a '|' and another command.
*:FernReveal*
:FernReveal {reveal} [-wait] BUFFER LOCAL
Reveal {reveal} on a current fern viewer. Note that this command
exists only in a fern viewer buffer.
If "-wait" option is specified, the command wait synchronously until
the node specified has revealed.
Note that the command can be followed by a '|' and another command.
-----------------------------------------------------------------------------
FUNCTION *fern-function*
*fern#version()*
fern#version()
Show fern version itself.
*fern#smart#leaf()*
fern#smart#leaf({leaf}, {collapsed}[, {expanded}])
Return one of a given mapping expression determined by a "status" of a
current cursor node. If the node is leaf, the {leaf} is returned.
If the node is branch and collapsed, the {collapsed} is returned. If
the node is branch and expanded, the {expanded} or {collapsed} is
returned.
>
" Perform 'open' on leaf node and 'enter' on branch node
nmap <buffer><expr>
\ <Plug>(fern-my-open-or-enter)
\ fern#smart#leaf(
\ "<Plug>(fern-action-open)",
\ "<Plug>(fern-action-enter)",
\ )
" Perform 'open' on leaf node, 'expand' on collapsed node, and
" 'collapse' on expanded node.
nmap <buffer><expr>
\ <Plug>(fern-my-open-or-expand-or-collapse)
\ fern#smart#leaf(
\ "<Plug>(fern-action-open)",
\ "<Plug>(fern-action-expand)",
\ "<Plug>(fern-action-collapse)",
\ )
<
*fern#smart#drawer()*
fern#smart#drawer({drawer}, {explorer})
fern#smart#drawer({drawer}, {drawer-right}, {explorer})
Return one of a given mapping expression determined by the style of
a current buffer. If the current buffer is drawer, the {drawer} is
returned. Otherwise the {explorer} is returned.
>
" Perform 'expand' on drawer and 'enter' on explorer
nmap <buffer><expr>
\ <Plug>(fern-my-expand-or-enter)
\ fern#smart#drawer(
\ "<Plug>(fern-action-expand)",
\ "<Plug>(fern-action-enter)",
\ )
<
*fern#smart#scheme()*
fern#smart#scheme({default}, {schemes})
Return one of a given mapping expression determined by the scheme of
a current buffer. The {schemes} is a |Dict| which key is a name of
scheme and the value is mapping expression. If no corresponding
key-value found in {schemes}, the value of {default} is returned.
>
" Execute 'Fern bookmark:///' or back to a previous file if the
" scheme is already 'bookmark'
nmap <buffer><expr><silent>
\ <C-^>
\ fern#smart#scheme(
\ ":\<C-u>Fern bookmark:///\<CR>",
\ {
\ 'bookmark': "\<C-^>",
\ },
\ )
*fern#smart#root()*
fern#smart#root({root}, {others})
Return one of a given mapping expression determined by a kind of a
current cursor node. If the node is root, the {root} is returned.
Otherwise the {others} is returned.
>
" Perform 'leave' on root node and 'open-or-enter' on others
nmap <buffer><expr>
\ <Plug>(fern-my-leave-or-open-or-enter)
\ fern#smart#root(
\ "<Plug>(fern-action-leave)",
\ "<Plug>(fern-action-open-or-enter)",
\ )
-----------------------------------------------------------------------------
AUTOCMD *fern-autocmd*
*FernHighlight*
FernHighlight
Invoked after a fern renderer and 3rd party plugins defined highlight.
Use this autocmd to overwrite existing |highlight| like:
>
function! s:on_highlight() abort
" Use brighter highlight on root node
highlight link FernRootSymbol Title
highlight link FernRootText Title
endfunction
augroup my-fern-highlight
autocmd!
autocmd User FernHighlight call s:on_highlight()
augroup END
<
See |fern-highlight| for pre-defined |highlight|.
*FernSyntax*
FernSyntax
Invoked after a fern renderer and 3rd party plugins defined syntax.
Use this |autocmd| to overwrite existing |syntax|.
Note that if you'd like to change color/highlight, use |FernHighlight|
autocmd instead. This autocmd exists for more complex (heavy) use.
-----------------------------------------------------------------------------
HIGHLIGHT *fern-highlight*
FernSpinner *hl-FernSpinner*
A |highlight| group used as a text highlight of spinner |sign|.
FernMarkedLine *hl-FernMarkedLine*
A |highlight| group used as a line highlight of mark |sign|.
FernMarkedText *hl-FernMarkedText*
A |highlight| group used as a text highlight of mark |sign|.
FernRootSymbol *hl-FernRootSymbol*
A |highlight| group of renderer used for root node symbol.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernRootText *hl-FernRootText*
A |highlight| group of renderer used for root node text.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernLeafSymbol *hl-FernLeafSymbol*
A |highlight| group of renderer used for leaf node symbol.
See |g:fern#renderer#default#leaf_symbol|.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernLeafText *hl-FernLeafText*
A |highlight| group of renderer used for leaf node text.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernBranchSymbol *hl-FernBranchSymbol*
A |highlight| group of renderer used for branch node symbol.
See |g:fern#renderer#default#expanded_symbol| and
|g:fern#renderer#default#collapsed_symbol|.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernBranchText *hl-FernBranchText*
A |highlight| group of renderer used for branch node text.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernLeaderSymbol *hl-FernLeaderSymbol*
A |highlight| group of renderer used for the node leading symbol.
See |g:fern#renderer#default#leading|.
An actual appearance will be determined by the |fern-renderer| thus
this highlight might not be referred.
FernWindowSelectIndicator *hl-FernWindowSelectIndicator*
A |highlight| group used for an indicator when selecting a window
through "open:select" action.
FernWindowSelectStatusLine *hl-FernWindowSelectStatusLine*
A |highlight| group used for |statusline| when selecting a window
through "open:select" action.
=============================================================================
MAPPING *fern-mapping*
As described in |fern-action|, some mappings in fern are used as action.
See |fern-action| for more detail.
-----------------------------------------------------------------------------
GLOBAL *fern-mapping-global*
*<Plug>(fern-action-zoom)*
Zoom width of the drawer style fern to the ratio of the global width.
It prompt users to ask a desired ratio of the width if no |v:count| is
given. Users can use 1 to 10 for the ratio.
It only works on a drawer style fern window.
*<Plug>(fern-action-zoom:reset)*
Reset the width of the drawer style fern to its original width.
It only works on a drawer style fern window.
*<Plug>(fern-action-zoom:half)*
This is an alias of "4<Plug>(fern-action-zoom)"
*<Plug>(fern-action-zoom:full)*
This is an alias of "9<Plug>(fern-action-zoom)"
*<Plug>(fern-action-hidden:set)*
Show hidden nodes. For example hidden nodes in file:// scheme is a
file or directory starts from '.' character.
*<Plug>(fern-action-hidden:unset)*
Hide hidden nodes. For example hidden nodes in file:// scheme is a
file or directory starts from '.' character.
*<Plug>(fern-action-hidden:toggle)*
Toggle hidden nodes. For example hidden nodes in file:// scheme is a
file or directory starts from '.' character.
*<Plug>(fern-action-hidden)*
An alias to "hidden:toggle" action. Users can overwrite this mapping
to change the default behavior of "hidden" action.
*<Plug>(fern-action-include)*
*<Plug>(fern-action-include=)*
Open a prompt to enter include filter. Users can type a |pattern| to
filter nodes recursively.
You can use a "=" variant to apply values to the prompt and/or submit
a value like:
>
" Automatically apply "foo" to the prompt and submit.
nmap <buffer>
\ <Plug>(my-include)
\ <Plug>(fern-action-include=)foo<CR>
<
*<Plug>(fern-action-exclude)*
*<Plug>(fern-action-exclude=)*
Open a prompt to enter exclude filter. Users can type a |pattern| to
filter nodes recursively.
You can use a "=" variant to apply values to the prompt and/or submit
a value like:
>
" Automatically apply "foo" to the prompt and submit.
nmap <buffer>
\ <Plug>(my-exclude)
\ <Plug>(fern-action-exclude=)foo<CR>
<
*<Plug>(fern-action-mark:clear)*
Clear existing marks.
*<Plug>(fern-action-mark:set)*
Set marks on cursor node(s).
*<Plug>(fern-action-mark:unset)*
Unset marks on cursor node(s).
*<Plug>(fern-action-mark:toggle)*
Toggle marks on cursor node(s).
*<Plug>(fern-action-mark)*
An alias to "mark:toggle" action. Users can overwrite this mapping to
change the default behavior of "mark" action.
*<Plug>(fern-action-debug)*
Echo debug information of a cursor node.
*<Plug>(fern-action-reload:all)*
Reload on the root node and its children.
*<Plug>(fern-action-reload:cursor)*
Reload on a cursor node and its children.
*<Plug>(fern-action-reload)*
An alias to "reload:all" action. Users can overwrite this mapping to
change the default behavior of "reload" action like:
>
nmap <buffer>
\ <Plug>(fern-action-reload)
\ <Plug>(fern-action-reload:cursor)
<
*<Plug>(fern-action-expand:stay)*
Expand on a cursor node and stay the cursor on the node.
*<Plug>(fern-action-expand:in)*
Expand on a cursor node and get in the cursor node (move on the first
child node of the cursor node.)
*<Plug>(fern-action-expand)*
An alias to "expand:in" action. Users can overwrite this mapping to
change the default behavior of "expand" action like:
>
nmap <buffer>
\ <Plug>(fern-action-expand)
\ <Plug>(fern-action-expand:stay)
<
*<Plug>(fern-action-expand-tree:stay)*
Recursively expand the tree on a cursor node and keep the cursor on the
root node.
*<Plug>(fern-action-expand-tree:in)*
Recursively expand the tree on a cursor node and keep the cursor on the
root node (moves to the first child node after the cursor node)
*<Plug>(fern-action-expand-tree)*
An alias to "expand-tree:in" action. Users can overwrite this mapping to
change the default behavior of "expand-tree" action like:
>
nmap <buffer>
\ <Plug>(fern-action-expand-tree)
\ <Plug>(fern-action-expand-tree:stay)
<
*<Plug>(fern-action-collapse)*
Collapse on a cursor node.
*<Plug>(fern-action-reveal)*
*<Plug>(fern-action-reveal=)*
Open a prompt to reveal a node in a tree.
You can use a "=" variant to apply values to the prompt and/or submit
a value like:
>
" Automatically apply "foo" to the prompt and submit.
nmap <buffer>
\ <Plug>(my-reveal)
\ <Plug>(fern-action-reveal=)foo<CR>
<
*<Plug>(fern-action-focus:parent)*
Focus the parent of the cursor node.
*<Plug>(fern-action-enter)*
Open a new fern buffer which root node is a cursor node. In other
word, get enter the directory.
*<Plug>(fern-action-leave)*
Open a new fern buffer which root node is a parent node of the current
root node. In other word, go up directory.
*<Plug>(fern-action-open:select)*
Open a cursor node or marked nodes through "window selector"
(|fern-glossary-window-selector|.)
*<Plug>(fern-action-open:split)*
*<Plug>(fern-action-open:vsplit)*
*<Plug>(fern-action-open:tabedit)*
Open a cursor node or marked nodes with a corresponding command.
The command will be applied on an "anchor" window when invoked from a
drawer style fern (|fern-glossary-anchor|.)
*<Plug>(fern-action-open:drop)*
Open a cursor node or jump the window when it was already opend.
Note See |drop| for more details.
*<Plug>(fern-action-open:edit-or-error)*
Open a cursor node or marked nodes with |edit| command or fallback
to print an error.
Note that when 'hidden' has set or 'bufhidden' is "hide", the |edit|
command will never fails.
*<Plug>(fern-action-open:edit-or-split)*
*<Plug>(fern-action-open:edit-or-vsplit)*
*<Plug>(fern-action-open:edit-or-tabedit)*
Open a cursor node or marked nodes with |edit| command or fallback
to a corresponding command.
Note that when 'hidden' has set or 'bufhidden' is "hide", the |edit|
command will never fails.