diff --git a/README.cn.md b/README.cn.md index 7992bcc80..fb7a38613 100644 --- a/README.cn.md +++ b/README.cn.md @@ -6,7 +6,7 @@ [推特](https://twitter.com/SpaceVim) \| [中文官网](https://spacevim.org/cn/) -[![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/cn) +[![Gitter](https://img.shields.io/gitter/room/SpaceVim/SpaceVim?color=%2364CEAA)](https://gitter.im/SpaceVim/cn) [![build](https://github.com/SpaceVim/SpaceVim/workflows/build/badge.svg)](https://github.com/SpaceVim/SpaceVim/actions?query=workflow%3Abuild) [![Codecov coverage](https://img.shields.io/codecov/c/github/SpaceVim/SpaceVim.svg)](https://codecov.io/gh/SpaceVim/SpaceVim) [![Version](https://img.shields.io/badge/version-1.7.0--dev-8700FF.svg)](https://github.com/SpaceVim/SpaceVim/releases) diff --git a/README.md b/README.md index 1c3572f9c..508544beb 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ [Twitter](https://twitter.com/SpaceVim) \| [中文官网](https://spacevim.org/cn/) - -[![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/SpaceVim) +[![Gitter](https://img.shields.io/gitter/room/SpaceVim/SpaceVim?color=%2364CEAA)](https://gitter.im/SpaceVim/SpaceVim) [![build](https://github.com/SpaceVim/SpaceVim/workflows/build/badge.svg)](https://github.com/SpaceVim/SpaceVim/actions?query=workflow%3Abuild) [![Codecov coverage](https://img.shields.io/codecov/c/github/SpaceVim/SpaceVim.svg)](https://codecov.io/gh/SpaceVim/SpaceVim) [![Version](https://img.shields.io/badge/version-1.8.0--dev-8700FF.svg)](https://github.com/SpaceVim/SpaceVim/releases) diff --git a/autoload/SpaceVim.vim b/autoload/SpaceVim.vim index ef2458709..32ee4fe4d 100644 --- a/autoload/SpaceVim.vim +++ b/autoload/SpaceVim.vim @@ -789,13 +789,13 @@ let g:spacevim_colorscheme_default = 'desert' "" " @section filemanager, options-filemanager " @parentsection options -" The default file manager of SpaceVim. Default is 'vimfiler'. -" you can also use nerdtree or defx +" The default file manager of SpaceVim. Default is 'nerdtree'. +" you can also use defx or vimfiler "" -" The default file manager of SpaceVim. Default is 'vimfiler'. -" you can also use nerdtree or defx -let g:spacevim_filemanager = 'vimfiler' +" The default file manager of SpaceVim. Default is 'nerdtree'. +" you can also use defx or vimfiler +let g:spacevim_filemanager = 'nerdtree' "" " @section filetree_direction, options-filetree_direction " @parentsection options diff --git a/config/plugins/nerdtree.vim b/config/plugins/nerdtree.vim index d2984f467..a52acbe4b 100644 --- a/config/plugins/nerdtree.vim +++ b/config/plugins/nerdtree.vim @@ -1,4 +1,6 @@ +scriptencoding utf-8 let s:VCOP = SpaceVim#api#import('vim#compatible') +let s:FILE = SpaceVim#api#import('file') if get(g:, 'spacevim_filetree_direction', 'right') ==# 'right' let g:NERDTreeWinPos = 'rightbelow' else @@ -7,6 +9,8 @@ endif let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31) let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1) let g:NERDTreeShowHidden = get(g:, '_spacevim_filetree_show_hidden_files', 0) +let g:NERDTreeDirArrowExpandable = '▶' +let g:NERDTreeDirArrowCollapsible = '▼' augroup nerdtree_zvim autocmd! autocmd bufenter * @@ -21,6 +25,8 @@ augroup END function! s:nerdtreeinit() abort nnoremap yY :call copy_to_system_clipboard() nnoremap P :call paste_to_file_manager() + nnoremap h :call nerdtree_h() + nnoremap l :call nerdtree_l() endfunction function! s:paste_to_file_manager() abort @@ -43,3 +49,29 @@ function! s:copy_to_system_clipboard() abort call s:VCOP.systemlist(['xclip-copyfile', filename]) echo 'Yanked:' . (type(filename) == 3 ? len(filename) : 1 ) . ( isdirectory(filename) ? 'directory' : 'file' ) endfunction + +function! s:nerdtree_h() abort + " let path = g:NERDTreeFileNode.GetSelected().path.str() + " if isdirectory(path) + " let path = s:FILE.unify_path(path, ':p:h:h') + " else + " let path = s:FILE.unify_path(path, ':p:h') + " endif + " exe 'NERDTreeFind ' . path + call g:NERDTreeKeyMap.Invoke('p') + call g:NERDTreeKeyMap.Invoke('o') +endfunction + +function! s:nerdtree_l() abort + let path = g:NERDTreeFileNode.GetSelected().path.str() + if isdirectory(path) + if matchstr(getline('.'), 'S') ==# g:NERDTreeDirArrowCollapsible + normal! gj + else + call g:NERDTreeKeyMap.Invoke('o') + normal! gj + endif + else + call g:NERDTreeKeyMap.Invoke('o') + endif +endfunction diff --git a/doc/SpaceVim.cnx b/doc/SpaceVim.cnx index 3141648a1..6e2e8d947 120000 --- a/doc/SpaceVim.cnx +++ b/doc/SpaceVim.cnx @@ -1 +1,74 @@ -bundle/spacevim/doc/SpaceVim.txt \ No newline at end of file +*SpaceVim.txt* + + + /###### /## /##/## + /##__ ## | ## | #|__/ + | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### + | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ## + \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ## + /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ## + | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ## + \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/ + | ## + | ## + |__/ +wsdjeg *spacevim* *SpaceVim* + +============================================================================== +CONTENTS *SpaceVim-contents* + 1. 简介.......................................................|SpaceVim-intro| + 2. 选项.....................................................|SpaceVim-options| + 1. default_indent......................|SpaceVim-options-default_indent| + 2. relativenumber......................|SpaceVim-options-relativenumber| + 3. Configuration...........................................|SpaceVim-config| + +============================================================================== +简介 *SpaceVim-intro* + +SpaceVim 是一个社区驱动的模块化 Vim 配置,这一思想概念起源于 Spacemacs。 + +============================================================================== +选项 *SpaceVim-options* + +SpaceVim 使用 `~/.SpaceVim.d/init.toml` 作为默认的全局配置文件。所有的选项 +都可以在该文件中进行设置,同时,`~/.SpaceVim.d/` 将被加入 Vim 的运行时(&rtp)内。因此,可以在该目录下创建私有的 Vim +脚本文件。SpaceVim 也支持项目的本地配置,在项目的根目录下,`.SpaceVim.d/init.toml` +即为默认的本地配置,`./SpaceVim./` 目录同样会被加入到 Vim 的运行时(&rtp)内。 + +以下即为一个配置示例: +> + [options] + enable-guicolors = true + max-column = 120 +< + +============================================================================== +DEFAULT_INDENT *SpaceVim-options-default_indent* + +设置默认的对齐具体,默认的值为 2。 +> + default_indent = 2 +< + +============================================================================== +RELATIVENUMBER *SpaceVim-options-relativenumber* + +启用/禁用相对行号,相对行号可以用于快速上下多行移动,默认已启用。 +> + relativenumber = true +< + +============================================================================== +CONFIGURATION *SpaceVim-config* + + *g:spacevim_default_indent* +设置默认的对齐具体,默认的值为 2。 +> + let g:spacevim_default_indent = 2 +< + + *g:spacevim_relativenumber* +启用/禁用相对行号,相对行号可以用于快速上下多行移动,默认已启用。 + + +vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 060edd2db..d23a3912f 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -469,8 +469,8 @@ default command. for example: ============================================================================== FILEMANAGER *SpaceVim-options-filemanager* -The default file manager of SpaceVim. Default is 'vimfiler'. you can also use -nerdtree or defx +The default file manager of SpaceVim. Default is 'nerdtree'. you can also use +defx or vimfiler ============================================================================== FILETREE_DIRECTION *SpaceVim-options-filetree_direction* @@ -1113,8 +1113,8 @@ installed. < *g:spacevim_filemanager* -The default file manager of SpaceVim. Default is 'vimfiler'. you can also use -nerdtree or defx +The default file manager of SpaceVim. Default is 'nerdtree'. you can also use +defx or vimfiler *g:spacevim_filetree_direction* Config the direction of file tree. Default is 'right'. you can also set to diff --git a/docs/cn/index.md b/docs/cn/index.md index da4e14c07..f60ffdd6a 100644 --- a/docs/cn/index.md +++ b/docs/cn/index.md @@ -4,7 +4,7 @@ description: "SpaceVim 是一个社区驱动的模块化的 Vim IDE,以模块 lang: zh --- -[![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/cn) +[![Gitter](https://img.shields.io/gitter/room/SpaceVim/SpaceVim?color=%2364CEAA)](https://gitter.im/SpaceVim/cn) [![build](https://github.com/SpaceVim/SpaceVim/workflows/build/badge.svg)](https://github.com/SpaceVim/SpaceVim/actions?query=workflow%3Abuild) [![Codecov coverage](https://img.shields.io/codecov/c/github/SpaceVim/SpaceVim.svg)](https://codecov.io/gh/SpaceVim/SpaceVim) [![Version](https://img.shields.io/badge/version-1.8.0--dev-8700FF.svg)](https://github.com/SpaceVim/SpaceVim/releases) diff --git a/docs/documentation.md b/docs/documentation.md index 3d3c79900..ba0586dea 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -832,8 +832,8 @@ To change the filemanager plugin: ```toml [options] # file manager plugins supported in SpaceVim: - # - vimfiler (default) - # - nerdtree + # - nerdtree (default) + # - vimfiler # - defx filemanager = "defx" ``` diff --git a/docs/index.md b/docs/index.md index 7b55f5e19..c65c30fae 100644 --- a/docs/index.md +++ b/docs/index.md @@ -3,7 +3,7 @@ title: "Home" description: "SpaceVim is a community-driven vim distribution that seeks to provide layer feature." --- -[![Gitter](https://badges.gitter.im/SpaceVim/SpaceVim.svg)](https://gitter.im/SpaceVim/SpaceVim) +[![Gitter](https://img.shields.io/gitter/room/SpaceVim/SpaceVim?color=%2364CEAA)](https://gitter.im/SpaceVim/SpaceVim) [![build](https://github.com/SpaceVim/SpaceVim/workflows/build/badge.svg)](https://github.com/SpaceVim/SpaceVim/actions?query=workflow%3Abuild) [![Codecov coverage](https://img.shields.io/codecov/c/github/SpaceVim/SpaceVim.svg)](https://codecov.io/gh/SpaceVim/SpaceVim) [![Version](https://img.shields.io/badge/version-1.8.0--dev-8700FF.svg)](https://github.com/SpaceVim/SpaceVim/releases)