diff --git a/.ci/update_mirror.sh b/.ci/update_mirror.sh old mode 100644 new mode 100755 diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index d1b1bb5f9..b982283a7 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -57,7 +57,7 @@ function! SpaceVim#layers#core#plugins() abort endif call add(plugins, [g:_spacevim_root_dir . 'bundle/gruvbox', {'loadconf' : 1, 'merged' : 0}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/open-browser.vim', { - \ 'merged' : 0, + \ 'merged' : 0, 'on_cmd' : ['OpenBrowser', 'OpenBrowserSearch', 'OpenBrowserSmartSearch'], \ 'loadconf' : 1, \}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/vim-grepper' , { 'on_cmd' : 'Grepper', diff --git a/bundle/git.vim/autoload/git/add.vim b/bundle/git.vim/autoload/git/add.vim index 31f7c5c20..2d6aaa8d7 100644 --- a/bundle/git.vim/autoload/git/add.vim +++ b/bundle/git.vim/autoload/git/add.vim @@ -9,36 +9,43 @@ let s:JOB = SpaceVim#api#import('job') -function! git#add#run(files) - - if len(a:files) == 1 && a:files[0] ==# '%' - let cmd = ['git', 'add', expand('%')] +function! s:replace_argvs(argvs) abort + let argvs = [] + for argv in a:argvs + if argv ==# '%' + call insert(argvs, expand('%')) else - let cmd = ['git', 'add'] + a:files + call insert(argvs, argv) endif - call git#logger#info('git-add cmd:' . string(cmd)) - call s:JOB.start(cmd, - \ { - \ 'on_exit' : function('s:on_exit'), - \ } - \ ) + endfor + return argvs +endfunction + +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 function! s:on_exit(id, data, event) abort - call git#logger#info('git-add exit data:' . string(a:data)) - if a:data ==# 0 - if exists(':GitGutter') - GitGutter - endif - echo 'done!' - else - echo 'failed!' + call git#logger#info('git-add exit data:' . string(a:data)) + if a:data ==# 0 + if exists(':GitGutter') + GitGutter endif + echo 'done!' + else + echo 'failed!' + endif 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 diff --git a/docs/_posts/2017-02-20-install-vim-or-neovim-with-python-support.md b/docs/_posts/2017-02-20-install-vim-or-neovim-with-python-support.md index ae0f63cc6..6ba54e5f5 100644 --- a/docs/_posts/2017-02-20-install-vim-or-neovim-with-python-support.md +++ b/docs/_posts/2017-02-20-install-vim-or-neovim-with-python-support.md @@ -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` diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index c846bf84c..fe81965d6 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -324,6 +324,18 @@ function! myspacevim#after() abort 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 之后执行。 如果你需要添加自定义以 `SPC` 为前缀的快捷键,你需要使用 bootstrap function, diff --git a/docs/cn/quick-start-guide.md b/docs/cn/quick-start-guide.md index f710ced65..f3553f7b2 100644 --- a/docs/cn/quick-start-guide.md +++ b/docs/cn/quick-start-guide.md @@ -4,11 +4,12 @@ description: "SpaceVim 入门教程,包括安装、初始化配置等内容" lang: zh --- - # 入门指南 -如果你从未使用过 SpaceVim,建议先阅读这篇简短的教程。这篇教程主要讲述: -如何安装 SpaceVim,SpaceVim 的入门配置以及 SpaceVim 常用学习资源。 +这是一个安装和配置 SpaceVim 的入门指南,它将指引你如何安装、配置和使用 SpaceVim。同时罗列了一系列学习 SpaceVim 的资源。 + +如果你从未了解过 SpaceVim,那么这篇内容将是你最好的开始。 +它会让你对 SpaceVim 有一个很好的了解。 @@ -24,10 +25,11 @@ lang: zh ## 安装指南 +首先,需要安装 Vim 或者 Neovim,同时启用 +python3 的支持会更好 在安装 SpaceVim 之前,你需要确保电脑上已经安装了 `Git` 和 `cURL`。这两个工具用来 下载插件以及字体。 -如果在终端中使用 Vim 或 Neovim,还需要设置终端的字体。 +如果你使用的是终端模拟器,你需要再终端配置里设置字体。 ### 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) 并运行。 - ## Docker 支持 ```sh @@ -65,13 +66,11 @@ docker run \ spacevim/spacevim nvim ``` - ## 基本配置 SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单的配置示例。 如果需要查阅更多 SpaceVim 配置相关的信息,请阅读 SpaceVim 用户文档。 - ```toml # 这是一个基础的 SpaceVim 配置示例 @@ -146,4 +145,3 @@ SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单 - [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim). Tell you how to hack SpaceVim. - [SpaceVim 入门教程](https://everettjf.gitbooks.io/spacevimtutorial/content/):everettjf 所著的 SpaceVim 入门教程。 - diff --git a/docs/documentation.md b/docs/documentation.md index fd38462b9..e90a420a7 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -330,11 +330,26 @@ with the following contents, for example: ```vim function! myspacevim#before() abort let g:neomake_c_enabled_makers = ['clang'] - nnoremap jk + " you can defined mappings in bootstrap function + " for example, use kj to exit insert mode. + inoremap kj endfunction 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 ``` diff --git a/docs/quick-start-guide.md b/docs/quick-start-guide.md index 356cd9370..f83e20aa0 100644 --- a/docs/quick-start-guide.md +++ b/docs/quick-start-guide.md @@ -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." --- # 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. + -- [Install](#install) +- [Installation](#installation) - [Linux and macOS](#linux-and-macos) - [Windows](#windows) - [Run in docker](#run-in-docker) @@ -17,18 +23,14 @@ description: "A quick start guide which will tell you how to install and configu -This is a quick start guide for SpaceVim, which will tell you how to install and configure SpaceVim. -And provides a list of resources for learning SpaceVim. +## Installation -If you haven’t seen SpaceVim at all yet, the first thing you should read is this guide. -It will give you a good idea of what SpaceVim is like. +First of all, you need to [install Vim or Neovim](../install-vim-or-neovim-with-python-support/), preferably with `+python3` support enabled. -## 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 -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. +If you are using a terminal emulator, you will need to set the font in the terminal configuration. ### 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 ``` -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: @@ -44,18 +47,18 @@ For more info about the install script, please check: 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. -```` +``` 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)). ### 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 @@ -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: -