fern.vim 622 B

12345678910111213141516171819202122232425262728
  1. " Disable netrw.
  2. let g:loaded_netrw = 1
  3. let g:loaded_netrwPlugin = 1
  4. let g:loaded_netrwSettings = 1
  5. let g:loaded_netrwFileHandlers = 1
  6. augroup my-fern-hijack
  7. autocmd!
  8. autocmd BufEnter * ++nested call s:hijack_directory()
  9. augroup END
  10. function! s:hijack_directory() abort
  11. let path = expand('%:p')
  12. if !isdirectory(path)
  13. return
  14. endif
  15. bwipeout %
  16. execute printf('Fern %s', fnameescape(path))
  17. endfunction
  18. augroup FernGroup
  19. autocmd!
  20. autocmd FileType fern call FernInit()
  21. augroup END
  22. " Custom settings and mappings.
  23. let g:fern#disable_default_mappings = 1
  24. let g:fern#disable_drawer_tabpage_isolation = 1