1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:30:05 +08:00

Update doc (#4425)

This commit is contained in:
Wang Shidong 2021-08-27 10:25:02 +08:00 committed by GitHub
parent 420f861d25
commit d807b9bf8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 53 deletions

0
.ci/update_mirror.sh Normal file → Executable file
View File

View File

@ -57,7 +57,7 @@ function! SpaceVim#layers#core#plugins() abort
endif endif
call add(plugins, [g:_spacevim_root_dir . 'bundle/gruvbox', {'loadconf' : 1, 'merged' : 0}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/gruvbox', {'loadconf' : 1, 'merged' : 0}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/open-browser.vim', { call add(plugins, [g:_spacevim_root_dir . 'bundle/open-browser.vim', {
\ 'merged' : 0, \ 'merged' : 0, 'on_cmd' : ['OpenBrowser', 'OpenBrowserSearch', 'OpenBrowserSmartSearch'],
\ 'loadconf' : 1, \ 'loadconf' : 1,
\}]) \}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-grepper' , { 'on_cmd' : 'Grepper', call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-grepper' , { 'on_cmd' : 'Grepper',

View File

@ -9,36 +9,43 @@
let s:JOB = SpaceVim#api#import('job') let s:JOB = SpaceVim#api#import('job')
function! git#add#run(files) function! s:replace_argvs(argvs) abort
let argvs = []
if len(a:files) == 1 && a:files[0] ==# '%' for argv in a:argvs
let cmd = ['git', 'add', expand('%')] if argv ==# '%'
call insert(argvs, expand('%'))
else else
let cmd = ['git', 'add'] + a:files call insert(argvs, argv)
endif endif
call git#logger#info('git-add cmd:' . string(cmd)) endfor
call s:JOB.start(cmd, return argvs
\ { endfunction
\ 'on_exit' : function('s:on_exit'),
\ } function! git#add#run(argvs) abort
\ ) let cmd = ['git', 'add'] + s:replace_argvs(a:argvs)
call git#logger#info('git-add cmd:' . string(cmd))
call s:JOB.start(cmd,
\ {
\ 'on_exit' : function('s:on_exit'),
\ }
\ )
endfunction endfunction
function! s:on_exit(id, data, event) abort function! s:on_exit(id, data, event) abort
call git#logger#info('git-add exit data:' . string(a:data)) call git#logger#info('git-add exit data:' . string(a:data))
if a:data ==# 0 if a:data ==# 0
if exists(':GitGutter') if exists(':GitGutter')
GitGutter GitGutter
endif
echo 'done!'
else
echo 'failed!'
endif endif
echo 'done!'
else
echo 'failed!'
endif
endfunction endfunction
function! git#add#complete(ArgLead, CmdLine, CursorPos) function! git#add#complete(ArgLead, CmdLine, CursorPos) abort
return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n") return "%\n" . join(getcompletion(a:ArgLead, 'file'), "\n")
endfunction endfunction

View File

@ -7,8 +7,27 @@ commentsID: "Install neovim or vim"
--- ---
# Installation of neovim/vim with python support # Install Vim/Neovim with Python support
> [neovim installation](https://github.com/neovim/neovim/wiki/Installing-Neovim)
> [Building Vim from source](https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source) This artical will tell you how to install vim and neovim, and how to enable `+python3` support.
## Install Neovim
### Windows
On Windows, the easiest way to install Neovim is to download
[Neovim.zip](https://github.com/neovim/neovim/releases/download/nightly/nvim-win32.zip)
from neovim release page. and extract it into `C:\Neovim`. You can also add `C:\Neovim\bin` to your `PATH`.
### Linux
You can install neovim or vim with default package manager.
**Ubuntu**
`sudo apt install neovim`
**Arch Linux**
`sudo pacman -S neovim`

View File

@ -324,6 +324,18 @@ function! myspacevim#after() abort
endfunction endfunction
``` ```
在启动函数中,可以使用`:lua` 命令对 SpaceVim 进行配置,比如:
```vim
function! myspacevim#before() abort
lua << EOF
local opt = requires('spacevim.opt')
opt.enable_projects_cache = false
opt.enable_statusline_mode = true
EOF
endfunction
```
函数 `bootstrap_before` 将在读取用户配置后执行,而函数 `bootstrap_after` 将在 VimEnter autocmd 之后执行。 函数 `bootstrap_before` 将在读取用户配置后执行,而函数 `bootstrap_after` 将在 VimEnter autocmd 之后执行。
如果你需要添加自定义以 `SPC` 为前缀的快捷键,你需要使用 bootstrap function 如果你需要添加自定义以 `SPC` 为前缀的快捷键,你需要使用 bootstrap function

View File

@ -4,11 +4,12 @@ description: "SpaceVim 入门教程,包括安装、初始化配置等内容"
lang: zh lang: zh
--- ---
# 入门指南 # 入门指南
如果你从未使用过 SpaceVim建议先阅读这篇简短的教程。这篇教程主要讲述 这是一个安装和配置 SpaceVim 的入门指南,它将指引你如何安装、配置和使用 SpaceVim。同时罗列了一系列学习 SpaceVim 的资源。
如何安装 SpaceVimSpaceVim 的入门配置以及 SpaceVim 常用学习资源。
如果你从未了解过 SpaceVim那么这篇内容将是你最好的开始。
它会让你对 SpaceVim 有一个很好的了解。
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
@ -24,10 +25,11 @@ lang: zh
## 安装指南 ## 安装指南
首先,需要安装 Vim 或者 Neovim同时启用 +python3 的支持会更好
在安装 SpaceVim 之前,你需要确保电脑上已经安装了 `Git``cURL`。这两个工具用来 在安装 SpaceVim 之前,你需要确保电脑上已经安装了 `Git``cURL`。这两个工具用来
下载插件以及字体。 下载插件以及字体。
如果在终端中使用 Vim 或 Neovim还需要设置终端的字体。 如果你使用的是终端模拟器,你需要再终端配置里设置字体。
### Linux 或 macOS ### Linux 或 macOS
@ -47,7 +49,6 @@ curl -sLf https://spacevim.org/cn/install.sh | bash -s -- -h
Windows 下最快捷的安装方法是下载安装脚本 [install.cmd](https://spacevim.org/cn/install.cmd) 并运行。 Windows 下最快捷的安装方法是下载安装脚本 [install.cmd](https://spacevim.org/cn/install.cmd) 并运行。
## Docker 支持 ## Docker 支持
```sh ```sh
@ -65,13 +66,11 @@ docker run
\ spacevim/spacevim nvim \ spacevim/spacevim nvim
``` ```
## 基本配置 ## 基本配置
SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单的配置示例。 SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单的配置示例。
如果需要查阅更多 SpaceVim 配置相关的信息,请阅读 SpaceVim 用户文档。 如果需要查阅更多 SpaceVim 配置相关的信息,请阅读 SpaceVim 用户文档。
```toml ```toml
# 这是一个基础的 SpaceVim 配置示例 # 这是一个基础的 SpaceVim 配置示例
@ -146,4 +145,3 @@ SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单
- [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim). Tell you how to hack SpaceVim. - [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim). Tell you how to hack SpaceVim.
- [SpaceVim 入门教程](https://everettjf.gitbooks.io/spacevimtutorial/content/)everettjf 所著的 SpaceVim 入门教程。 - [SpaceVim 入门教程](https://everettjf.gitbooks.io/spacevimtutorial/content/)everettjf 所著的 SpaceVim 入门教程。

View File

@ -330,11 +330,26 @@ with the following contents, for example:
```vim ```vim
function! myspacevim#before() abort function! myspacevim#before() abort
let g:neomake_c_enabled_makers = ['clang'] let g:neomake_c_enabled_makers = ['clang']
nnoremap jk <Esc> " you can defined mappings in bootstrap function
" for example, use kj to exit insert mode.
inoremap kj <Esc>
endfunction endfunction
function! myspacevim#after() abort function! myspacevim#after() abort
iunmap jk " you can remove key binding in bootstrap_after function
iunmap kj
endfunction
```
Within the bootstrap function, you can also use `:lua` command. for example:
```vim
function! myspacevim#before() abort
lua << EOF
local opt = requires('spacevim.opt')
opt.enable_projects_cache = false
opt.enable_statusline_mode = true
EOF
endfunction endfunction
``` ```

View File

@ -1,13 +1,19 @@
--- ---
title: "Quick start guide" title: "Quick start guide"
description: "A quick start guide which will tell you how to install and configure SpaceVim, also provides a list of resources for learning SpaceVim." description: "A quick start guide which will tell you how to install and configure SpaceVim, also provides a list of resources for learning SpaceVim."
--- ---
# Quick start guide # Quick start guide
This is a quick start guide for SpaceVim. It will show you how to install,
configure, and use SpaceVim. It also lists a series of resources for learning SpaceVim.
If you've never heard of SpaceVim, this is the best place to start.
It will give you a good idea of what SpaceVim is like.
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
- [Install](#install) - [Installation](#installation)
- [Linux and macOS](#linux-and-macos) - [Linux and macOS](#linux-and-macos)
- [Windows](#windows) - [Windows](#windows)
- [Run in docker](#run-in-docker) - [Run in docker](#run-in-docker)
@ -17,18 +23,14 @@ description: "A quick start guide which will tell you how to install and configu
<!-- vim-markdown-toc --> <!-- vim-markdown-toc -->
This is a quick start guide for SpaceVim, which will tell you how to install and configure SpaceVim. ## Installation
And provides a list of resources for learning SpaceVim.
If you havent seen SpaceVim at all yet, the first thing you should read is this guide. First of all, you need to [install Vim or Neovim](../install-vim-or-neovim-with-python-support/), preferably with `+python3` support enabled.
It will give you a good idea of what SpaceVim is like.
## Install Also, you need to have `git` and `curl` installed in your system,
which are needed for downloading plugins and fonts.
At a minimum, SpaceVim requires `git` and `curl` to be installed. Both tools If you are using a terminal emulator, you will need to set the font in the terminal configuration.
are needed for downloading plugins and fonts.
If you are using Vim/Neovim in a terminal, you will also need to set the font of your terminal.
### Linux and macOS ### Linux and macOS
@ -36,7 +38,8 @@ If you are using Vim/Neovim in a terminal, you will also need to set the font of
curl -sLf https://spacevim.org/install.sh | bash curl -sLf https://spacevim.org/install.sh | bash
``` ```
After SpaceVim is installed, launch `vim` and SpaceVim will **automatically** install plugins. After SpaceVim is installed, launch `nvim` or `vim`,
all plugins will be downloaded **automatically**.
For more info about the install script, please check: For more info about the install script, please check:
@ -44,18 +47,18 @@ For more info about the install script, please check:
curl -sLf https://spacevim.org/install.sh | bash -s -- -h curl -sLf https://spacevim.org/install.sh | bash -s -- -h
``` ```
If you got a vimproc error like: If you got a vimproc error like this:
``` ```
[vimproc] vimproc's DLL: "~/.SpaceVim/bundle/vimproc.vim/lib/vimproc_linux64.so" is not found. [vimproc] vimproc's DLL: "~/.SpaceVim/bundle/vimproc.vim/lib/vimproc_linux64.so" is not found.
```` ```
Please read `:help vimproc` and make it, you may need to install make (from `build-essential`) Please read `:help vimproc` and make it, you may need to install make (from `build-essential`)
and a C compiler (like `gcc`) to build the dll (see issue [#435](https://github.com/SpaceVim/SpaceVim/issues/435) and [#544](https://github.com/SpaceVim/SpaceVim/issues/544)). and a C compiler (like `gcc`) to build the dll (see issue [#435](https://github.com/SpaceVim/SpaceVim/issues/435) and [#544](https://github.com/SpaceVim/SpaceVim/issues/544)).
### Windows ### Windows
The easiest way is to download [install.cmd](https://spacevim.org/install.cmd) and run it as administrator, or install SpaceVim manually. The easiest way is to download [install.cmd](../install.cmd) and run it as administrator, or install SpaceVim manually.
## Run in docker ## Run in docker
@ -128,7 +131,6 @@ This is a list of online tutorials for using SpaceVim as a general IDE and progr
A list of guides for programming language support: A list of guides for programming language support:
<ul> <ul>
{% for post in site.categories.tutorials %} {% for post in site.categories.tutorials %}
<li> <li>
@ -140,6 +142,6 @@ A list of guides for programming language support:
## Learning SpaceVim ## Learning SpaceVim
- [SpaceVim Documentation](../documentation). Also known as "The Book", - [SpaceVim Documentation](../documentation). Also known as "The Book",
The SpaceVim Documentation will introduce you to the main topics important to using SpaceVim. The SpaceVim Documentation will introduce you to the main topics important to using SpaceVim.
The book is the primary official document of SpaceVim. The book is the primary official document of SpaceVim.
- [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim). Teaches you how to hack SpaceVim. - [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim). Teaches you how to hack SpaceVim.