From 23249ad375701fdaa0d9dc05cee4f8cfbffc41bf Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Fri, 9 Jun 2017 21:08:16 +0800 Subject: [PATCH] Fix enter dir --- autoload/SpaceVim.vim | 1 + config/main.vim | 4 +++- docs/documentation.md | 14 ++++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) 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/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/docs/documentation.md b/docs/documentation.md index 64e363627..7bf4a25f8 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -63,7 +63,7 @@ title: "Documentation" * [Vim and SpaceVim files](#vim-and-spacevim-files) * [File tree](#file-tree) * [File tree navigation](#file-tree-navigation) - * [Plugin: VimFiler](#plugin-vimfiler) + * [Open file with file tree.](#open-file-with-file-tree) * [Auto-saving](#auto-saving) * [Searching](#searching) * [Editing](#editing) @@ -807,7 +807,12 @@ Key Binding | Description #### 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. +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: @@ -817,7 +822,6 @@ VCS integration is supported, there will be a colum status, this feature maybe m Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): -###### Plugin: VimFiler Key Binding | Description -----------| ----------- @@ -826,7 +830,7 @@ Key Binding | Description `h` or `RET` | go to parent node and collapse expanded directory `` or `j` | select next file or directory `` or `k` | select previous file or directory -`l` | open selected file +`l` | open selected file or expand directory `Ctrl`+`j` | Un-map `Ctrl`+`l` | Un-map `E` | Un-map @@ -840,7 +844,9 @@ Key Binding | Description `V` | Clear all marks `Ctrl`+`r` | Redraw +##### Open file with file tree. +By default a file is opened in the last active window, ### Auto-saving