forked from zgpio/tree.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.txt
595 lines (444 loc) · 14.6 KB
/
tree.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
*tree.txt* Neovim file explorer powered by C++.
Version: 0.1.0
Author: zgp <[email protected]>
License: MIT license
Type |gO| to see the table of contents.
==============================================================================
INTRODUCTION *tree-introduction*
*tree* is the neovim file explorer powered by C++.
==============================================================================
INSTALL *tree-install*
Note: tree requires Neovim 0.5+.
1. Extract the files and put them in your Neovim config directory
(usually `$XDG_CONFIG_HOME/nvim/`).
==============================================================================
INTERFACE *tree-interface*
------------------------------------------------------------------------------
COMMANDS *tree-commands*
:Tree [{options}] {paths} *:Tree*
Creates a new Tree buffer.
------------------------------------------------------------------------------
FUNCTIONS *tree-functions*
tree#action({action}[, {args}]) *tree#action()*
Fire {action} action with {args} asynchronously.
See |tree-actions|.
{args} behavior depends on {action}.
Note: It is only used to define mappings.
Note: You cannot fire the next action until the previous
action is finished.
*tree.call_action()*
tree.call_action({action}[, {args}])
Fire {action} action with {args}. See |tree-actions|.
{args} behavior depends on {action}.
*tree.call_async_action()*
tree.call_async_action({action}[, {args}])
Fire {action} action with {args} asynchronously.
See |tree-actions|.
{args} behavior depends on {action}.
Note: You cannot fire the next action until the previous
action is finished.
*tree.custom_column()*
tree.custom_column({column-name}, {option-name}, {value})
tree.custom_column({column-name}, {dict})
Set {column-name} column specialized variable {variable-name}
to {value}. You may specify multiple sources with the
separator "," in {column-name}. >
tree.custom_column('icon', {
directory_icon='▸',
opened_icon='▾',
root_icon=' ',
})
tree.custom_column('filename', {
min_width=40,
max_width=40,
})
tree.custom_column('mark', {
readonly_icon='✗',
selected_icon='✓',
})
<
*tree.custom_option()*
tree.custom_option({buffer-name}, {option-name}, {value})
tree.custom_option({buffer-name}, {dict})
Set {option-name} option to {value} in {buffer-name}
buffer.
If {buffer-name} is "_", the options are used for all buffers.
If {dict} is available, the key is {option-name} and the value
is {value}.
Note: The all options are in |tree-options|. However, "-" is
substituted to "_", and "-" prefix is removed. >
tree.custom_option('_', {
columns='mark:indent:icon:filename:type:size:time',
})
<
*tree.custom_source()*
tree.custom_source({source-name}, {var-name}, {value})
tree.custom_source({source-name}, {dict})
Set {source-name} source specialized variable {variable-name}
to {value}. You may specify multiple sources with the
separator "," in {source-name}.
Note: Not yet implemented.
>
function! Root(path) abort
return fnamemodify(a:path, ':t')
endfunction
call v:lua.tree.custom_source('file', {
\ 'root': 'Root',
\})
<
tree.get_candidate() *tree.get_candidate()*
Returns the current cursor candidate as |Dictionary|.
tree.is_directory() *tree.is_directory()*
Returns true if the current cursor candidate is directory.
Example: >
nnoremap <silent><buffer><expr> <CR>
\ v:lua.tree.is_directory() ?
\ tree#action('open') : tree#action('multi', ['drop', 'quit'])
tree.is_opened_tree() *tree.is_opened_tree()*
Returns true if the current cursor candidate is opened
directory tree.
------------------------------------------------------------------------------
KEY MAPPINGS *tree-key-mappings*
Tree does not provide any of default key mappings.
You need to define original key mappings by |tree#action()|.
------------------------------------------------------------------------------
ACTIONS *tree-actions*
add_session *tree-action-add_session*
Add the current directory in current sessions and save to
|tree-option-session-file|.
Note: You must set to |tree-option-session-file| save current
sessions.
Note: Not yet implemented.
Current session feature saves below states.
* current path
* opened tree state
Action args:
0. session directory path
call *tree-action-call*
Call the function.
You can get the files path as "a:context.targets".
Action args:
0. function name
Note: It must be string. You cannot use |funcref| or
|lambda|.
Example: >
function! Test(context) abort
echomsg string(a:context.targets)
endfunction
nnoremap <silent><buffer><expr> f
\ tree#action('call', 'Test')
" or you can use SID hack
function! s:Test(context) abort
echomsg string(a:context.targets)
endfunction
function! s:SID_PREFIX() abort
return matchstr(expand('<sfile>'),
\ '<SNR>\d\+_\zeSID_PREFIX$')
endfunction
let g:sid = s:SID_PREFIX()
nnoremap <silent><buffer><expr> f
\ tree#action('call', g:sid.'Test')
cd *tree-action-cd*
Change the current directory.
Note: If the action args is empty, it means the home
directory.
Action args:
0. new current directory path
change_vim_cwd *change_vim_cwd*
Change current working directory to the current directory.
clear_select_all *tree-action-clear_select_all*
Clear the all candidates select.
close_tree *tree-action-close_tree*
Close the directory tree.
copy *tree-action-copy*
Copy the selected files to tree clipboard.
drop *tree-action-drop*
Open the file like |:drop| command.
Action args:
0. open command(The default is |:edit|)
execute_command *tree-action-execute_command*
Execute the command.
Action args:
0. command(The default is your input)
execute_system *tree-action-execute_system*
Execute the file by system associated command.
move *tree-action-move*
Move the selected files to tree clipboard.
multi *tree-action-multi*
Multiple actions.
Action args:
0. action 1
1. action 2
...
Example: >
" auto quit like behavior
nnoremap <silent><buffer><expr> <CR>
\ tree#action('multi', ['drop', 'quit'])
nnoremap <silent><buffer><expr> s
\ tree#action('multi', [['drop', 'split'], 'quit'])
new_file *tree-action-new_file*
Create a new file or directory.
If the input ends with "/", it means new directory.
*tree-action-new_multiple_files*
new_multiple_files
Create new files and directories if provided.
If the input ends with "/", it means new directory.
open *tree-action-open*
Open the file.
Action args:
0. open command(The default is |:edit|)
open_directory *tree-action-open_directory*
Open the directory.
Action args:
0. open file path(The default is the selected
directory)
open_or_close_tree *tree-action-open_or_close_tree*
Open the directory tree if the directory is not opened.
Close the directory tree if the directory is opened.
open_tree *tree-action-open_tree*
Open the directory tree.
open_tree_recursive *tree-action-open_tree_recursive*
Open the directory tree recursively.
Action args:
0. max recursive leavel(The default is "20")
paste *tree-action-paste*
Fire the clipboard action in the current directory.
Note: It is used after |tree-action-copy| or |tree-action-move|.
print *tree-action-print*
Print the filename.
quit *tree-action-quit*
Quit the buffer.
redraw *tree-action-redraw*
Redraw the buffer.
repeat *tree-action-repeat*
Redraw the previous action.
rename *tree-action-rename*
Rename the file/directory under cursor or from selected list.
Note: If you select multiple files, it will be buffer-rename
mode.
remove *tree-action-remove*
Delete the file/directory under cursor or from selected list
completely.
Note: You cannot undo the action.
Action args:
0. If it is "true", suppress the confirmation.
remove_trash *tree-action-remove_trash*
Delete the file/directory under cursor or from selected list
to trashbox.
Action args:
0. If it is "true", suppress the confirmation.
search *tree-action-search*
Search the path.
Action args:
0. search the path
toggle_columns *tree-action-toggle_columns*
Toggle the current columns.
Action args:
0. ":" separated tree columns.
toggle_sort *tree-action-toggle_sort*
Toggle the sort method.
Action args:
0. sort method.
toggle_ignored_files *tree-action-toggle_ignored_files*
Toggle the enable state of ignored files.
toggle_select *tree-action-toggle_select*
Toggle the cursor candidate select.
toggle_select_all *tree-action-toggle_select_all*
Toggle the all candidates select.
toggle_select_visual
*tree-action-toggle_select_visual*
Toggle the visual mode selected candidates select.
yank_path *tree-action-yank_path*
Yank the all candidates path.
------------------------------------------------------------------------------
OPTIONS *tree-options*
*tree-option-no-*
-no-{option-name}
Disable {option-name} flag.
Note: If you use both {option-name} and -no-{option-name} in
the same denite buffer, it is undefined.
*tree-option-auto-cd*
-auto-cd
Change the working directory while navigating with tree.
Default: false
*tree-option-auto-recursive-level*
-auto-recursive-level={level}
The level to expand tree automatically.
Default: 0
*tree-option-buffer-name*
-buffer-name={buffer-name}
Specify tree buffer name.
Default: "default"
*tree-option-columns*
-columns={…:indent:…:icon:filename:…}
Specify tree columns.
Default: "mark:indent:icon:filename:type"
*tree-option-direction*
-direction={direction}
Specify the window direction as {direction} if
|tree-option-split| is set.
You can use "topleft" or "botright".
Default: ""
*tree-option-ignored-files*
-ignored-files={pattern}
Specify the ignored files pattern.
The pattern is comma separated.
Default: ".*"
*tree-option-listed*
-listed
Enable 'buflisted' option in tree buffer.
Default: false
*tree-option-new*
-new
Create new tree buffer.
Resume existing tree buffer by default.
Default: false
*tree-option-profile*
-profile
Enable profile feature.
Note: It is for debugging.
Default: false
*tree-option-root-marker*
-root-marker={marker}
Root marker.
Default: "[in]: "
*tree-option-search*
-search={path}
Search the {path}.
Note: It must be full path.
Default: ""
*tree-option-session-file*
-session-file={path}
Session file {path}.
Note: It must be full path.
Default: ""
*tree-option-show-ignored-files*
-show-ignored-files
Show ignored files by default.
Default: false
*tree-options-sort*
-sort={method}
Sort method.
If the method is upper case, the order will be reversed.
"extension": file extension sort
"filename": file name sort
"size": file size sort
"time": file modified time sort
Default: "filename"
*tree-option-split*
-split={direction}
Specify the split direction.
"vertical": Split buffer vertically
"horizontal": Split buffer horizontally
"no": No split
"tab": Create the new tab
"floating": Use neovim floating window feature
Default: "no"
*tree-option-toggle*
-toggle
Close tree buffer window if this tree window exists.
Default: false
*tree-option-wincol*
-wincol={window-column}
Set the column position of the Tree window if
|tree-option-split| is "floating".
Default: &columns / 4
*tree-option-winheight*
-winheight={window-height}
Set the height of the window if |tree-option-split| is
"horizontal".
Default: 30
*tree-option-winrelative*
-winrelative={direction}
Specify the relative position in floating window.
|nvim_open_win|
Default: "editor"
*tree-option-winrow*
-winrow={window-row}
Set the row position of the Tree window if
|tree-option-split| is "floating".
Default: &lines / 3
*tree-option-winwidth*
-winwidth={window-width}
Set the width of the window if |tree-option-split| is
"vertical".
Default: 90
------------------------------------------------------------------------------
COLUMNS *tree-columns*
*tree-column-filename*
filename File name.
variables:
min_width the minimum width of a tree buffer
(default: 40)
max_width the maximum width of a tree buffer
(default: 100)
root_marker_highlight
the root marker highlight
(default: "Constant")
*tree-column-icon*
icon Basic icon.
variables:
directory_icon the closed directory icon
(default: "+")
opened_icon the opened directory icon
(default: "-")
root_icon the root directory icon
(default: " ")
*tree-column-indent*
indent Tree indentation.
Note: It depends on |tree-column-filename|.
variables:
indent the indent marker.
(default: " ")
*tree-column-mark*
mark File selected mark.
variables:
length the column length
(default: 1)
readonly_icon the readonly file icon
(default: "X")
selected_icon the selected file icon
(default: "*")
*tree-column-size*
size File size.
*tree-column-time*
time File modified time.
variables:
format the time format
(default: "%y.%m.%d %H:%M")
*tree-column-type*
type File type.
variables:
types the types definition
(default: complicated)
EXTERNAL COLUMNS *tree-external-columns*
------------------------------------------------------------------------------
SOURCES *tree-sources*
file File
variables:
root root function name
Note: It must be string. You cannot use
|funcref| or |lambda|.
(default is v:null)
==============================================================================
EXAMPLES *tree-examples*
>
...
<
==============================================================================
FREQUENTLY ASKED QUESTIONS (FAQ) *tree-faq*
Q: How to explore the folder where the current file is?
A: >
Tree `expand('%:p:h')` -search=`expand('%:p')`
Q: How to open tree window like explorer?
A: >
Tree -split=vertical -winwidth=50 -direction=topleft
Q: How to open file use drop?
A: >
nnoremap <silent><buffer><expr> <CR> tree#action('drop')
==============================================================================
COMPATIBILITY *tree-compatibility*
2019-03-10
* ...
==============================================================================
vim:tw=78:ts=8:ft=help:norl:noet:fen:noet: