0

I would like to open nvim with defx by default instead of Nerdtree. Have no idea how to change that behaviour

I am using defx and can open it through mapping with sf custom mapping command, but for that i should be already in nvim so it takes me two steps.

vim 
sf

Sf lives in maps.vim

" Description: Keymaps
" defx
nnoremap <silent>sf :<C-u>Defx -listed -resume
      \ -columns=indent:mark:icon:icons:filename:git:size
      \ -buffer-name=tab`tabpagenr()`
      \ `expand('%:p:h')` -search=`expand('%:p')`<CR>

Can i open defx with

nvim .

I can disable nerdtree from opening in nvim/init.vim

 " Disable netrw
 let g:loaded_netrwPlugin       = 1

but even with it I should do sf to open defx

romainl
  • 186,200
  • 21
  • 280
  • 313
Victor Orlyk
  • 1,454
  • 2
  • 15
  • 27
  • can you pls show your `sf` mapping? I don't use this plugin, so I want to see the command to trigger it. – Kent Dec 03 '21 at 21:24
  • nnoremap sf :Defx -listed -resume \ -columns=indent:mark:icon:icons:filename:git:size \ -buffer-name=tab`tabpagenr()` \ `expand('%:p:h')` -search=`expand('%:p')` – Victor Orlyk Dec 04 '21 at 06:04

1 Answers1

0

so the answer from creator @Shougo was https://gitter.im/Shougo/defx.nvim?at=61abfda5b5ba9e5a11ef079e

autocmd BufEnter,VimEnter,BufNew,BufWinEnter,BufRead,BufCreate
          \ * if isdirectory(expand('<amatch>'))
          \   | call s:browse_check(expand('<amatch>')) | endif

    function! s:browse_check(path) abort
      if bufnr('%') != expand('<abuf>')
        return
      endif

      " Disable netrw.
      augroup FileExplorer
        autocmd!
      augroup END

      execute 'Defx' a:path
    endfunction
Victor Orlyk
  • 1,454
  • 2
  • 15
  • 27