File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,12 @@ if exists('g:loaded_fern_hijack') || ( !has('nvim') && v:version < 801 )
33endif
44let g: loaded_fern_hijack = 1
55
6- function ! s: hijack_directory () abort
7- let path = s: expand (' %:p' )
8- if ! isdirectory (path )
6+ function ! s: hijack_directory (path ) abort
7+ if ! isdirectory (a: path )
98 return
109 endif
1110 let bufnr = bufnr ()
12- execute printf (' keepjumps keepalt Fern %s' , fnameescape (path ))
11+ execute printf (' keepjumps keepalt Fern %s' , fnameescape (a: path ))
1312 execute printf (' silent! bwipeout %d' , bufnr )
1413endfunction
1514
@@ -27,8 +26,13 @@ function! s:expand(expr) abort
2726 endtry
2827endfunction
2928
29+ function ! s: initial_hijack () abort
30+ call s: hijack_directory (expand (' %:p' ))
31+ autocmd fern- hijack BufEnter * ++ nested call s: hijack_directory (s: expand (' %:p' ))
32+ endfunction
33+
3034augroup fern - hijack
3135 autocmd !
3236 autocmd VimEnter * call s: suppress_netrw ()
33- autocmd BufEnter * ++nested call s: hijack_directory ()
37+ autocmd BufEnter * ++once ++ nested call s: initial_hijack ()
3438augroup END
You can’t perform that action at this time.
0 commit comments