if exists('g:loaded_dirvish') || &cp || v:version < 700 || &cpo =~# 'C' finish endif let g:loaded_dirvish = 1 command! -bar -nargs=? -complete=dir Dirvish call dirvish#open() command! -nargs=* -complete=file -range -bang Shdo call dirvish#shdo(0 ? argv() : getline(, ), ) func! s:isdir(dir) if &l:bufhidden =~# '\vunload|delete|wipe' return 0 " In a temporary special buffer (likely from a plugin). endif return !empty(a:dir) && (isdirectory(a:dir) || \ (!empty($SYSTEMDRIVE) && isdirectory('/'.tolower($SYSTEMDRIVE[0]).a:dir))) endf augroup dirvish autocmd! " Remove netrw and NERDTree directory handlers. autocmd VimEnter * if exists('#FileExplorer') | exe 'au! FileExplorer *' | endif autocmd VimEnter * if exists('#NERDTreeHijackNetrw') | exe 'au! NERDTreeHijackNetrw *' | endif autocmd BufEnter * if !exists('b:dirvish') && isdir(expand('%:p')) \ | Dirvish \ | elseif exists('b:dirvish') && &buflisted && bufnr('$') > 1 | setlocal nobuflisted | endif autocmd FileType dirvish if exists('#fugitive') | call FugitiveDetect(@%) | endif autocmd ShellCmdPost * if exists('b:dirvish') | Dirvish | endif augroup END nnoremap (dirvish_up) :exe 'Dirvish' fnameescape(fnamemodify(@%, ':p'.(@%[-1:]=~'[\\/]'?':h':'').repeat(':h',v:count1))) nnoremap (dirvish_split_up) :splitexe 'Dirvish' fnameescape(fnamemodify(@%, ':p'.(@%[-1:]=~'[\\/]'?':h':'').repeat(':h',v:count1))) nnoremap (dirvish_vsplit_up) :vsplitexe 'Dirvish' fnameescape(fnamemodify(@%, ':p'.(@%[-1:]=~'[\\/]'?':h':'').repeat(':h',v:count1))) highlight default link DirvishSuffix SpecialKey highlight default link DirvishPathTail Directory highlight default link DirvishArg Todo if mapcheck('-', 'n') ==# '' && !hasmapto('(dirvish_up)', 'n') nmap - (dirvish_up) endif