diff --git a/autoload/SpaceVim/layers/ui.vim b/autoload/SpaceVim/layers/ui.vim index a4b6f5505..ff05045c8 100644 --- a/autoload/SpaceVim/layers/ui.vim +++ b/autoload/SpaceVim/layers/ui.vim @@ -43,7 +43,13 @@ function! SpaceVim#layers#ui#config() abort \ ] let g:signify_disable_by_default = 0 let g:signify_line_highlight = 0 - noremap :TagbarToggle + + if s:enable_sidebar + noremap :call SpaceVim#plugins#sidebar#toggle() + else + noremap :TagbarToggle + endif + if !empty(g:spacevim_windows_smartclose) call SpaceVim#mapping#def('nnoremap ', g:spacevim_windows_smartclose, ':call zvim#util#SmartClose()', \ 'Smart close windows', @@ -292,3 +298,13 @@ function! s:toggle_background() set background=dark endif endfunction + +let s:enable_sidebar = 0 + +function! SpaceVim#layers#ui#set_variable(var) abort + + let s:enable_sidebar = get(a:var, + \ 'enable_sidebar', + \ 0) + +endfunction diff --git a/autoload/SpaceVim/plugins/sidebar.vim b/autoload/SpaceVim/plugins/sidebar.vim new file mode 100644 index 000000000..7a56ea7c9 --- /dev/null +++ b/autoload/SpaceVim/plugins/sidebar.vim @@ -0,0 +1,34 @@ +"============================================================================= +" sidebar.vim --- sidebar manager for SpaceVim +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +" init option: +" width: sidebar_width +" direction: sidebar_direction + + +function! SpaceVim#plugins#sidebar#open(...) abort + TagbarOpen + wincmd p + nnoremap q :call SpaceVim#plugins#sidebar#close() + split + wincmd p + wincmd p + VimFiler -no-split + nnoremap q :call SpaceVim#plugins#sidebar#close() +endfunction + + +function! SpaceVim#plugins#sidebar#toggle() abort + call SpaceVim#plugins#sidebar#open() +endfunction + + +function! SpaceVim#plugins#sidebar#close() abort + TagbarClose + VimFiler +endfunction diff --git a/config/plugins/tagbar.vim b/config/plugins/tagbar.vim index d88368df6..e54924d6a 100644 --- a/config/plugins/tagbar.vim +++ b/config/plugins/tagbar.vim @@ -7,3 +7,4 @@ endif let g:tagbar_sort = get(g:, 'tagbar_sort', 0) let g:tagbar_compact = get(g:, 'tagbar_compact', 1) let g:tagbar_map_showproto = get(g:, 'tagbar_map_showproto', '') +let g:tagbar_iconchars = ['▶', '▼'] diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index e2bf10db8..5ba2165ea 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -6,8 +6,8 @@ let g:vimfiler_as_default_explorer = get(g:, 'vimfiler_as_default_explorer', 1) let g:vimfiler_restore_alternate_file = get(g:, 'vimfiler_restore_alternate_file', 1) let g:vimfiler_tree_indentation = get(g:, 'vimfiler_tree_indentation', 1) let g:vimfiler_tree_leaf_icon = get(g:, 'vimfiler_tree_leaf_icon', '') -let g:vimfiler_tree_opened_icon = get(g:, 'vimfiler_tree_opened_icon', '-') -let g:vimfiler_tree_closed_icon = get(g:, 'vimfiler_tree_closed_icon', '+') +let g:vimfiler_tree_opened_icon = get(g:, 'vimfiler_tree_opened_icon', '') +let g:vimfiler_tree_closed_icon = get(g:, 'vimfiler_tree_closed_icon', '') let g:vimfiler_file_icon = get(g:, 'vimfiler_file_icon', '') let g:vimfiler_readonly_file_icon = get(g:, 'vimfiler_readonly_file_icon', '*') let g:vimfiler_marked_file_icon = get(g:, 'vimfiler_marked_file_icon', '√') diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index aade8f8f1..c7e186f8e 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -38,9 +38,10 @@ CONTENTS *SpaceVim-contents* 18. plugin_manager_processes.|SpaceVim-options-plugin_manager_processes| 19. realtime_leader_guide.......|SpaceVim-options-realtime_leader_guide| 20. relativenumber.....................|SpaceVim-options-relativenumber| - 21. sidebar_width.......................|SpaceVim-options-sidebar_width| - 22. snippet_engine.....................|SpaceVim-options-snippet_engine| - 23. windows_leader.....................|SpaceVim-options-windows_leader| + 21. retry_cnt...............................|SpaceVim-options-retry_cnt| + 22. sidebar_width.......................|SpaceVim-options-sidebar_width| + 23. snippet_engine.....................|SpaceVim-options-snippet_engine| + 24. windows_leader.....................|SpaceVim-options-windows_leader| 3. Configuration...........................................|SpaceVim-config| 4. Commands..............................................|SpaceVim-commands| 5. Functions............................................|SpaceVim-functions| @@ -277,6 +278,15 @@ Enable/Disable relativenumber, by default it is enabled. relativenumber = true < +============================================================================== +RETRY_CNT *SpaceVim-options-retry_cnt* + +Set the number of retries for SpaceVim Update when failed. Default is 3. Set +to 0 to disable this feature, or you can set to another number. +> + update_retry_cnt = 3 +< + ============================================================================== SIDEBAR_WIDTH *SpaceVim-options-sidebar_width* @@ -729,6 +739,13 @@ Enable/Disable lint on the fly feature of SpaceVim's maker. Default is 0. let g:spacevim_lint_on_the_fly = 0 < + *g:spacevim_update_retry_cnt* +Set the number of retries for SpaceVim Update when failed. Default is 3. Set +to 0 to disable this feature, or you can set to another number. +> + let g:spacevim_update_retry_cnt = 3 +< + *g:spacevim_enable_vimfiler_welcome* Enable/Disable vimfiler in the welcome windows. Default is 1. This will cause vim to start up slowly if there are too many files in the current directory. diff --git a/docs/layers/ui.md b/docs/layers/ui.md index 908d2f751..066fcd462 100644 --- a/docs/layers/ui.md +++ b/docs/layers/ui.md @@ -10,6 +10,7 @@ description: "Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and - [Description](#description) - [Install](#install) - [Plugins](#plugins) +- [Tips](#tips) @@ -42,3 +43,10 @@ SpaceVim provide default statusline and tabline plugin which are provided by `co enable = false ``` +Use sidebar to manager file tree and outline: + +```toml +[[layers]] + name = "ui" + enable_sidebar = true +```