Просмотр исходного кода

Change vim to use the dirvish file browser

No more modified netrw buffer issues.
Weiyi Lou 9 лет назад
Родитель
Сommit
ca915d3268
2 измененных файлов с 18 добавлено и 11 удалено
  1. 4 3
      vim/plugins.vim
  2. 14 8
      vim/settings/filebrowser.vim

+ 4 - 3
vim/plugins.vim

@@ -56,7 +56,7 @@ Plug 'vim-scripts/argtextobj.vim'
 Plug 'ctrlpvim/ctrlp.vim'
 Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
 Plug 'junegunn/fzf.vim'
-Plug 'tpope/vim-vinegar'
+Plug 'justinmk/vim-dirvish'
 " }}}
 
 " Code Browser {{{
@@ -88,12 +88,13 @@ Plug 'vimperator/vimperator.vim'
 " }}}
 
 " Discarded {{{
+"Plug 'Yggdroot/indentLine' - performance issues in larger files.
 "Plug 'deris/vim-shot-f' - interferes with macro
 "Plug 'haya14busa/incsearch.vim' - interferes with macros
+"Plug 'kshenoy/vim-signature' - nice, but mostly unused.
 "Plug 'scrooloose/nerdtree' - moved away from drawer-style browser to netrw.
 "Plug 'terryma/vim-expand-region' - cool, but often slower than text objects.
-"Plug 'kshenoy/vim-signature' - nice, but mostly unused.
-"Plug 'Yggdroot/indentLine' - performance issues in larger files.
+"Plug 'tpope/vim-vinegar' - moved from netrw to dirvish.
 "
 "Plug 'MarcWeber/vim-addon-mw-utils' -\
 "Plug 'ervandew/supertab' ------------|

+ 14 - 8
vim/settings/filebrowser.vim

@@ -1,15 +1,21 @@
-" Netrw - Vim's built-in file browser.
+" Dirvish file browser.
 
-" Open files and toggle folders with 'o' like in QuickFix.
-autocmd FileType netrw map <silent> <buffer> o <CR>
+" Use relative paths if there is no `conceal` ability.
+let g:dirvish_relative_paths = (v:version <= 703 ? 1 : 0)
 
-" Errors should not open new splits. Use normal error handling, `:messages`.
-let g:netrw_use_errorwindow = 0
+augroup dirvishCustomisation
+  autocmd!
 
-" Use tree-style browsing by default
-" 0 = normal, 1 = details, 2 = ls, 3 = tree
-let g:netrw_liststyle = 3
+  " Allow fugitive.vim commands in dirvish buffers.
+  autocmd FileType dirvish call fugitive#detect(@%)
 
+  " Use 'o' to (o)pen and 'i' to spl(i)t.
+  autocmd FileType dirvish let s:nowait = (v:version > 703 ? '<nowait>' : '')
+        \| execute 'nnoremap '.s:nowait.'<buffer><silent> o :<C-U>.call dirvish#open("edit", 0)<CR>'
+        \| execute 'nnoremap '.s:nowait.'<buffer><silent> i :<C-U>.call dirvish#open("split", 1)<CR>'
+        \| execute 'xnoremap '.s:nowait.'<buffer><silent> O :call dirvish#open("edit", 0)<CR>'
+        \| execute 'xnoremap '.s:nowait.'<buffer><silent> I :call dirvish#open("split", 1)<CR>'
+augroup END
 
 " CtrlP - Fuzzy Finder in Vimscript