mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 20:20:05 +08:00
Add sidebar (#2016)
This commit is contained in:
parent
bf1f442a52
commit
b581ac4c77
@ -43,7 +43,13 @@ function! SpaceVim#layers#ui#config() abort
|
||||
\ ]
|
||||
let g:signify_disable_by_default = 0
|
||||
let g:signify_line_highlight = 0
|
||||
noremap <silent> <F2> :TagbarToggle<CR>
|
||||
|
||||
if s:enable_sidebar
|
||||
noremap <silent> <F2> :call SpaceVim#plugins#sidebar#toggle()<CR>
|
||||
else
|
||||
noremap <silent> <F2> :TagbarToggle<CR>
|
||||
endif
|
||||
|
||||
if !empty(g:spacevim_windows_smartclose)
|
||||
call SpaceVim#mapping#def('nnoremap <silent>', g:spacevim_windows_smartclose, ':<C-u>call zvim#util#SmartClose()<cr>',
|
||||
\ '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
|
||||
|
34
autoload/SpaceVim/plugins/sidebar.vim
Normal file
34
autoload/SpaceVim/plugins/sidebar.vim
Normal file
@ -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 <buffer><silent> q :call SpaceVim#plugins#sidebar#close()<cr>
|
||||
split
|
||||
wincmd p
|
||||
wincmd p
|
||||
VimFiler -no-split
|
||||
nnoremap <buffer><silent> q :call SpaceVim#plugins#sidebar#close()<cr>
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#sidebar#toggle() abort
|
||||
call SpaceVim#plugins#sidebar#open()
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#plugins#sidebar#close() abort
|
||||
TagbarClose
|
||||
VimFiler
|
||||
endfunction
|
@ -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 = ['▶', '▼']
|
||||
|
@ -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', '√')
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -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
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user