Skip to content

Commit 72b715f

Browse files
committed
Support fern#util#expand()
1 parent e53523b commit 72b715f

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

plugin/fern_hijack.vim

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,29 @@ if exists('g:loaded_fern_hijack') || ( !has('nvim') && v:version < 801 )
33
endif
44
let g:loaded_fern_hijack = 1
55

6-
function! s:suppress_netrw() abort
7-
if exists('#FileExplorer')
8-
autocmd! FileExplorer *
9-
endif
10-
endfunction
11-
126
function! s:hijack_directory() abort
13-
let path = expand('%:p')
7+
let path = s:expand('%:p')
148
if !isdirectory(path)
159
return
1610
endif
1711
silent bwipeout %
1812
execute printf('Fern %s', fnameescape(path))
1913
endfunction
2014

15+
function! s:suppress_netrw() abort
16+
if exists('#FileExplorer')
17+
autocmd! FileExplorer *
18+
endif
19+
endfunction
20+
21+
function! s:expand(expr) abort
22+
try
23+
return fern#util#expand(a:expr)
24+
catch /^Vim\%((\a\+)\)\=:E117:/
25+
return expand(a:expr)
26+
endtry
27+
endfunction
28+
2129
augroup fern-hijack
2230
autocmd!
2331
autocmd VimEnter * call s:suppress_netrw()

0 commit comments

Comments
 (0)