Skip to content

Commit d08fece

Browse files
authored
Merge pull request #195 from lambdalisue/file-scheme-root-node
Add an option to show absolute path of "file" scheme root node
2 parents f68f28a + fcb94c1 commit d08fece

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

autoload/fern/scheme/file.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let s:Config = vital#fern#import('Config')
2+
3+
call s:Config.config(expand('<sfile>:p'), {
4+
\ 'show_absolute_path_on_root_label': 0,
5+
\})

autoload/fern/scheme/file/provider.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ function! s:provider_get_root(uri) abort
3131
if s:is_windows && path ==# ''
3232
return s:windows_drive_root
3333
endif
34-
return s:node(path)
34+
let root = s:node(path)
35+
if g:fern#scheme#file#show_absolute_path_on_root_label
36+
let root.label = fnamemodify(root._path, ':~')
37+
endif
38+
return root
3539
endfunction
3640

3741
function! s:provider_get_parent(node, ...) abort

doc/fern.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,11 @@ VARIABLE *fern-variable*
429429
Note that users must restart Vim to apply changes.
430430
Default: "*"
431431

432+
*g:fern#scheme#file#show_absolute_path_on_root_label*
433+
A |Boolean| to show an absolute path of the root node of "file" scheme
434+
as a label of the node.
435+
Default: 0
436+
432437
-----------------------------------------------------------------------------
433438
COMMAND *fern-command*
434439

0 commit comments

Comments
 (0)