From 68e123447a5e786aa4ca904ff39b6ef1733d7fdd Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 19 Sep 2021 17:32:31 +0800 Subject: [PATCH] Update `core` layer (#4467) --- autoload/SpaceVim.vim | 4 ++-- autoload/SpaceVim/layers/core.vim | 25 +++++++++++++++++++++++++ config/plugins/nerdtree.vim | 7 ++++--- config/plugins/vimfiler.vim | 4 ++-- doc/SpaceVim.txt | 4 ++-- docs/layers/core.md | 12 +++++++----- 6 files changed, 42 insertions(+), 14 deletions(-) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index eca170c33..04594621e 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -403,11 +403,11 @@ let g:spacevim_enable_ycm = 0 " @section sidebar_width, options-sidebar_width " @parentsection options " Set the width of the SpaceVim sidebar. Default is 30. -" This value will be used by tagbar and vimfiler. +" This value will be used by tagbar and filetree. "" " Set the width of the SpaceVim sidebar. Default is 30. -" This value will be used by tagbar and vimfiler. +" This value will be used by tagbar and filetree. let g:spacevim_sidebar_width = 30 "" diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 0846ae1aa..af537b6bc 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -5,6 +5,8 @@ " URL: https://spacevim.org " License: GPLv3 "============================================================================= +scriptencoding utf-8 + if exists('s:string_hi') finish @@ -13,6 +15,10 @@ endif let s:enable_smooth_scrolling = 1 +" disabel netrw +let g:loaded_netrwPlugin = 1 + + let s:SYS = SpaceVim#api#import('system') let s:FILE = SpaceVim#api#import('file') let s:MESSAGE = SpaceVim#api#import('vim#message') @@ -935,18 +941,37 @@ endfunction let g:_spacevim_filetree_show_hidden_files = 0 +let g:_spacevim_filetree_opened_icon = '▼' +let g:_spacevim_filetree_closed_icon = '▶' function! SpaceVim#layers#core#set_variable(var) abort let g:_spacevim_filetree_show_hidden_files = get(a:var, \ 'filetree_show_hidden', \ g:_spacevim_filetree_show_hidden_files) + let g:_spacevim_filetree_opened_icon = get(a:var, + \ 'filetree_opened_icon', + \ g:_spacevim_filetree_opened_icon) + let g:_spacevim_filetree_closed_icon = get(a:var, + \ 'filetree_closed_icon', + \ g:_spacevim_filetree_closed_icon) let s:enable_smooth_scrolling = get(a:var, \ 'enable_smooth_scrolling', \ s:enable_smooth_scrolling) endfunction +function! SpaceVim#layers#core#get_options() abort + + return [ + \ 'filetree_closed_icon', + \ 'filetree_opened_icon', + \ 'filetree_show_hidden', + \ 'enable_smooth_scrolling' + \ ] + +endfunction + function! SpaceVim#layers#core#health() abort call SpaceVim#layers#core#plugins() call SpaceVim#layers#core#config() diff --git a/config/plugins/nerdtree.vim b/config/plugins/nerdtree.vim index a52acbe4b..f1845d1da 100644 --- a/config/plugins/nerdtree.vim +++ b/config/plugins/nerdtree.vim @@ -6,11 +6,12 @@ if get(g:, 'spacevim_filetree_direction', 'right') ==# 'right' else let g:NERDTreeWinPos = 'left' endif -let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31) +let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize', get(g:, 'spacevim_sidebar_width', 35)) let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1) let g:NERDTreeShowHidden = get(g:, '_spacevim_filetree_show_hidden_files', 0) -let g:NERDTreeDirArrowExpandable = '▶' -let g:NERDTreeDirArrowCollapsible = '▼' +let g:NERDTreeDirArrowExpandable = get(g:, 'NERDTreeDirArrowExpandable', get(g:, '_spacevim_filetree_closed_icon', '')) +let g:NERDTreeDirArrowCollapsible = get(g:, 'NERDTreeDirArrowCollapsible', get(g:, '_spacevim_filetree_opened_icon', '')) +let g:NERDTreeMinimalUI=1 augroup nerdtree_zvim autocmd! autocmd bufenter * diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index ce500d652..65c491351 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', g:_spacevim_filetree_opened_icon) +let g:vimfiler_tree_closed_icon = get(g:, 'vimfiler_tree_closed_icon', g:_spacevim_filetree_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 735e2bd78..dbd0a6957 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -648,7 +648,7 @@ option to: SIDEBAR_WIDTH *SpaceVim-options-sidebar_width* Set the width of the SpaceVim sidebar. Default is 30. This value will be used -by tagbar and vimfiler. +by tagbar and filetree. ============================================================================== SNIPPET_ENGINE *SpaceVim-options-snippet_engine* @@ -939,7 +939,7 @@ Enable/Disable YouCompleteMe. Default is 0. *g:spacevim_sidebar_width* Set the width of the SpaceVim sidebar. Default is 30. This value will be used -by tagbar and vimfiler. +by tagbar and filetree. *g:spacevim_snippet_engine* Set the snippet engine of SpaceVim, default is neosnippet. to enable diff --git a/docs/layers/core.md b/docs/layers/core.md index fd52d3878..54677399b 100644 --- a/docs/layers/core.md +++ b/docs/layers/core.md @@ -16,18 +16,19 @@ description: "SpaceVim core layer provides many default key bindings and feature ## Intro -This is the core layer of SpaceVim, and it is loaded by default. +The `core` layer of SpaceVim. This layer is enabled by default, and it provides filetree, +comment key bindings etc. ## Features ### FileTree -The filetree plugin is included in core layer, by default `vimfiler` is used as filetree manager. -To use nerdtree or defx, please add following snippet into your configuration file. +The filetree is included in core layer, by default `nerdtree` is used as filetree manager. +To use defx, please add following snippet into your configuration file. ```toml [options] - filemanager = "nerdtree" + filemanager = "defx" ``` ## Configuration @@ -40,5 +41,6 @@ To use nerdtree or defx, please add following snippet into your configuration fi name = 'core' filetree_show_hidden = true enable_smooth_scrolling = true + filetree_opened_icon = '' + filetree_closed_icon = '' ``` -