1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 07:00:05 +08:00

Merge branch 'file_tree' into dev

This commit is contained in:
wsdjeg 2017-06-09 22:49:43 +08:00
commit 3cf2dad981
5 changed files with 68 additions and 30 deletions

View File

@ -529,6 +529,7 @@ endfunction
function! SpaceVim#welcome() abort function! SpaceVim#welcome() abort
exe 'cd ' . g:_spacevim_enter_dir
if exists('g:_spacevim_checking_flag') && g:_spacevim_checking_flag if exists('g:_spacevim_checking_flag') && g:_spacevim_checking_flag
return return
endif endif

View File

@ -187,7 +187,7 @@ endfunction
function! zvim#util#OpenVimfiler() abort function! zvim#util#OpenVimfiler() abort
if bufnr('vimfiler') == -1 if bufnr('vimfiler') == -1
VimFiler silent VimFiler
if exists(':AirlineRefresh') if exists(':AirlineRefresh')
AirlineRefresh AirlineRefresh
endif endif
@ -198,7 +198,7 @@ function! zvim#util#OpenVimfiler() abort
endif endif
wincmd p wincmd p
else else
VimFiler silent VimFiler
doautocmd WinEnter doautocmd WinEnter
if exists(':AirlineRefresh') if exists(':AirlineRefresh')
AirlineRefresh AirlineRefresh

View File

@ -12,6 +12,8 @@ function! s:parser_argv() abort
else else
return [1, getcwd()] return [1, getcwd()]
endif endif
elseif argv(0) ==# '.'
return [1, getcwd()]
elseif isdirectory(expand(argv(0))) elseif isdirectory(expand(argv(0)))
return [1, expand(argv(0)) ] return [1, expand(argv(0)) ]
else else
@ -20,7 +22,7 @@ function! s:parser_argv() abort
endfunction endfunction
let s:status = s:parser_argv() let s:status = s:parser_argv()
if s:status[0] if s:status[0]
exe 'cd ' . s:status[1] let g:_spacevim_enter_dir = s:status[1]
augroup SPwelcom augroup SPwelcom
au! au!
autocmd VimEnter * call SpaceVim#welcome() autocmd VimEnter * call SpaceVim#welcome()

View File

@ -79,14 +79,16 @@ function! s:vimfilerinit()
nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit') nnoremap <silent><buffer><expr> sg vimfiler#do_action('vsplit')
nnoremap <silent><buffer><expr> sv vimfiler#do_action('split') nnoremap <silent><buffer><expr> sv vimfiler#do_action('split')
nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch') nnoremap <silent><buffer><expr> st vimfiler#do_action('tabswitch')
nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated) nmap <buffer> gx <Plug>(vimfiler_execute_vimfiler_associated)
nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line) nmap <buffer> ' <Plug>(vimfiler_toggle_mark_current_line)
nmap <buffer> v <Plug>(vimfiler_quick_look) nmap <buffer> v <Plug>(vimfiler_quick_look)
nmap <buffer> p <Plug>(vimfiler_preview_file) nmap <buffer> p <Plug>(vimfiler_preview_file)
nmap <buffer> V <Plug>(vimfiler_clear_mark_all_lines) nmap <buffer> V <Plug>(vimfiler_clear_mark_all_lines)
nmap <buffer> i <Plug>(vimfiler_switch_to_history_directory) nmap <buffer> i <Plug>(vimfiler_switch_to_history_directory)
nmap <buffer> <Tab> <Plug>(vimfiler_switch_to_other_window) nmap <buffer> <Tab> <Plug>(vimfiler_switch_to_other_window)
nmap <buffer> <C-r> <Plug>(vimfiler_redraw_screen) nmap <buffer> <C-r> <Plug>(vimfiler_redraw_screen)
nmap <buffer> <Left> <Plug>(vimfiler_smart_h)
nmap <buffer> <Right> <Plug>(vimfiler_smart_l)
endf endf
" vim:set et sw=2: " vim:set et sw=2:

View File

@ -61,6 +61,9 @@ title: "Documentation"
* [Special Buffers](#special-buffers) * [Special Buffers](#special-buffers)
* [Files manipulations key bindings](#files-manipulations-key-bindings) * [Files manipulations key bindings](#files-manipulations-key-bindings)
* [Vim and SpaceVim files](#vim-and-spacevim-files) * [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) * [Auto-saving](#auto-saving)
* [Searching](#searching) * [Searching](#searching)
* [Editing](#editing) * [Editing](#editing)
@ -97,7 +100,6 @@ title: "Documentation"
* [Window Management](#window-management) * [Window Management](#window-management)
* [Native functions](#native-functions) * [Native functions](#native-functions)
* [Plugin: Unite](#plugin-unite) * [Plugin: Unite](#plugin-unite)
* [Plugin: VimFiler](#plugin-vimfiler)
* [Plugin: neocomplete](#plugin-neocomplete) * [Plugin: neocomplete](#plugin-neocomplete)
* [Plugin: NERD Commenter](#plugin-nerd-commenter) * [Plugin: NERD Commenter](#plugin-nerd-commenter)
* [Plugin: Goyo and Limelight](#plugin-goyo-and-limelight) * [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 v` | display and copy SpaceVim version
`SPC f v d` | open SpaceVim custom configuration file `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
-----------| -----------
`<F3>` or `SPC f t` | Toggle file explorer
| **Within _VimFiler_ buffers** | |
`<Left>` or `h` | go to parent node and collapse expanded directory
`<Down>` or `j` | select next file or directory
`<Up>` or `k` | select previous file or directory
`<Right>` 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 ### Auto-saving
@ -1212,24 +1263,6 @@ Key | Mode | Action
`<leader>`+`ugf` | Normal | Opens Unite file with word at cursor `<leader>`+`ugf` | Normal | Opens Unite file with word at cursor
`<leader>`+`ugt` | Normal/visual | Opens Unite tag with word at cursor `<leader>`+`ugt` | Normal/visual | Opens Unite tag with word at cursor
##### Plugin: VimFiler
Key | Mode | Action
----- |:----:| ------------------
`<F3>` | 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 ##### Plugin: neocomplete