diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index 899495f16..914ff4338 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -529,6 +529,7 @@ endfunction function! SpaceVim#welcome() abort + exe 'cd ' . g:_spacevim_enter_dir if exists('g:_spacevim_checking_flag') && g:_spacevim_checking_flag return endif diff --git a/autoload/zvim/util.vim b/autoload/zvim/util.vim index 07ee0da79..7be33f3cb 100644 --- a/autoload/zvim/util.vim +++ b/autoload/zvim/util.vim @@ -187,7 +187,7 @@ endfunction function! zvim#util#OpenVimfiler() abort if bufnr('vimfiler') == -1 - VimFiler + silent VimFiler if exists(':AirlineRefresh') AirlineRefresh endif @@ -198,7 +198,7 @@ function! zvim#util#OpenVimfiler() abort endif wincmd p else - VimFiler + silent VimFiler doautocmd WinEnter if exists(':AirlineRefresh') AirlineRefresh diff --git a/config/main.vim b/config/main.vim index 04c76cb9f..25b763aa9 100644 --- a/config/main.vim +++ b/config/main.vim @@ -12,6 +12,8 @@ function! s:parser_argv() abort else return [1, getcwd()] endif + elseif argv(0) ==# '.' + return [1, getcwd()] elseif isdirectory(expand(argv(0))) return [1, expand(argv(0)) ] else @@ -20,7 +22,7 @@ function! s:parser_argv() abort endfunction let s:status = s:parser_argv() if s:status[0] - exe 'cd ' . s:status[1] + let g:_spacevim_enter_dir = s:status[1] augroup SPwelcom au! autocmd VimEnter * call SpaceVim#welcome() diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index 24c96b057..9a8f1a680 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -79,14 +79,16 @@ function! s:vimfilerinit() nnoremap sg vimfiler#do_action('vsplit') nnoremap sv vimfiler#do_action('split') nnoremap st vimfiler#do_action('tabswitch') - nmap gx (vimfiler_execute_vimfiler_associated) - nmap ' (vimfiler_toggle_mark_current_line) - nmap v (vimfiler_quick_look) - nmap p (vimfiler_preview_file) - nmap V (vimfiler_clear_mark_all_lines) - nmap i (vimfiler_switch_to_history_directory) - nmap (vimfiler_switch_to_other_window) - nmap (vimfiler_redraw_screen) + nmap gx (vimfiler_execute_vimfiler_associated) + nmap ' (vimfiler_toggle_mark_current_line) + nmap v (vimfiler_quick_look) + nmap p (vimfiler_preview_file) + nmap V (vimfiler_clear_mark_all_lines) + nmap i (vimfiler_switch_to_history_directory) + nmap (vimfiler_switch_to_other_window) + nmap (vimfiler_redraw_screen) + nmap (vimfiler_smart_h) + nmap (vimfiler_smart_l) endf " vim:set et sw=2: diff --git a/docs/documentation.md b/docs/documentation.md index 253b529bb..519f5e7b6 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -61,6 +61,9 @@ title: "Documentation" * [Special Buffers](#special-buffers) * [Files manipulations key bindings](#files-manipulations-key-bindings) * [Vim and SpaceVim files](#vim-and-spacevim-files) + * [File tree](#file-tree) + * [File tree navigation](#file-tree-navigation) + * [Open file with file tree.](#open-file-with-file-tree) * [Auto-saving](#auto-saving) * [Searching](#searching) * [Editing](#editing) @@ -97,7 +100,6 @@ title: "Documentation" * [Window Management](#window-management) * [Native functions](#native-functions) * [Plugin: Unite](#plugin-unite) - * [Plugin: VimFiler](#plugin-vimfiler) * [Plugin: neocomplete](#plugin-neocomplete) * [Plugin: NERD Commenter](#plugin-nerd-commenter) * [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) @@ -803,6 +805,55 @@ Key Binding | Description `SPC f v v` | display and copy SpaceVim version `SPC f v d` | open SpaceVim custom configuration file +#### File tree + +SpaceVim use vimfiler as the default file tree, and the default key binding is `F3`, and SpaceVim also provide `SPC f t` and `SPC f T` to open the file tree. to change the file explore to nerdtree: + +```vim +" the default value is vimfiler +let g:spacevim_filemanager = 'nerdtree' +``` + +VCS integration is supported, there will be a colum status, this feature maybe make vimfiler slow, so it is not enabled by default. to enable this feature, add `let g:spacevim_enable_vimfiler_gitstatus = 1` to your custom config. here is any picture for this feature: + +![file-tree](https://user-images.githubusercontent.com/13142418/26881817-279225b2-4bcb-11e7-8872-7e4bd3d1c84e.png) + +##### File tree navigation + +Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): + + +Key Binding | Description +-----------| ----------- +`` or `SPC f t` | Toggle file explorer +| **Within _VimFiler_ buffers** | | +`` or `h` | go to parent node and collapse expanded directory +`` or `j` | select next file or directory +`` or `k` | select previous file or directory +`` or `l` | open selected file or expand directory +`Ctrl`+`j` | Un-map +`Ctrl`+`l` | Un-map +`E` | Un-map +`.` | toggle visible ignored files +`sv` | Split edit +`sg` | Vertical split edit +`p` | Preview +`i` | Switch to directory history +`v` | Quick look +`gx` | Execute with vimfiler associated +`'` | Toggle mark current line +`V` | Clear all marks +`Ctrl`+`r` | Redraw + +##### Open file with file tree. + +If there is only one file buffer opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. + +Key Binding | Description +-----------| ----------- +`l` or `Enter` | open file in one window +`sg` | open file in an vertically split window +`sv` | open file in an horizontally split window ### Auto-saving @@ -1212,24 +1263,6 @@ Key | Mode | Action ``+`ugf` | Normal | Opens Unite file with word at cursor ``+`ugt` | Normal/visual | Opens Unite tag with word at cursor -##### Plugin: VimFiler - -Key | Mode | Action ------ |:----:| ------------------ -`` | Normal | Toggle file explorer -| **Within _VimFiler_ buffers** ||| -`Ctrl`+`j` | Normal | Un-map -`Ctrl`+`l` | Normal | Un-map -`E` | Normal | Un-map -`sv` | Normal | Split edit -`sg` | Normal | Vertical split edit -`p` | Normal | Preview -`i` | Normal | Switch to directory history -`v` | Normal | Quick look -`gx` | Normal | Execute with vimfiler associated -`'` | Normal | Toggle mark current line -`V` | Normal | Clear all marks -`Ctrl`+`r` | Normal | Redraw ##### Plugin: neocomplete