1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:40:03 +08:00

Change default filetree to nerdtree (#4464)

This commit is contained in:
Wang Shidong 2021-09-12 23:06:37 +08:00 committed by GitHub
parent 2bad103358
commit 39bf31c4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 121 additions and 17 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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 <silent><buffer> yY :<C-u>call <SID>copy_to_system_clipboard()<CR>
nnoremap <silent><buffer> P :<C-u>call <SID>paste_to_file_manager()<CR>
nnoremap <silent><buffer> h :<C-u>call <SID>nerdtree_h()<CR>
nnoremap <silent><buffer> l :<C-u>call <SID>nerdtree_l()<CR>
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

View File

@ -1 +1,74 @@
bundle/spacevim/doc/SpaceVim.txt
*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:

View File

@ -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

View File

@ -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)

View File

@ -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"
```

View File

@ -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)