简体   繁体   中英

nvim use defx instead of NerdTree

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM