1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-11 17:15:46 +08:00

Merge pull request from wsdjeg/readme

Update readme
This commit is contained in:
Wang Shidong 2018-04-29 20:44:25 +08:00 committed by GitHub
commit 41d7d44a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 118 additions and 147 deletions

@ -32,7 +32,6 @@ Here is a throughput graph of the repository for the last few weeks:
<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc GFM -->
- [New Features](#new-features) - [New Features](#new-features)
- [Install](#install)
- [Project layout](#project-layout) - [Project layout](#project-layout)
- [Support SpaceVim](#support-spacevim) - [Support SpaceVim](#support-spacevim)
- [Credits & Thanks](#credits--thanks) - [Credits & Thanks](#credits--thanks)
@ -124,28 +123,6 @@ create an UI for [dein.vim](https://github.com/Shougo/dein.vim/) - the best asyn
For more features, please read [SpaceVim's Blog](https://spacevim.org/blog/) For more features, please read [SpaceVim's Blog](https://spacevim.org/blog/)
### Install
At a minimum, SpaceVim requires `git` to be installed. For a better graphical experience, install [nerd-font](https://github.com/ryanoasis/nerd-fonts) and make sure your terminal supports [true colors](https://gist.github.com/XVilka/8346728).
**Linux and macOS**
```bash
curl -sLf https://spacevim.org/install.sh | bash
```
After SpaceVim is installed, launch `vim` and SpaceVim will **automatically** install plugins.
For more info about the installation script, please check:
```bash
curl -sLf https://spacevim.org/install.sh | bash -s -- -h
```
**Windows**
The easiest way is to download [install.cmd](https://spacevim.org/install.cmd) and run it as administrator, or install SpaceVim manually.
### Project layout ### Project layout
```txt ```txt

@ -43,20 +43,23 @@ endfunction
function! s:awesome_mode() abort function! s:awesome_mode() abort
let sep = SpaceVim#api#import('file').separator let sep = SpaceVim#api#import('file').separator
let f = fnamemodify(g:_spacevim_root_dir, ':h') . join(['', 'mode', 'dark_powered.vim'], sep) let f = fnamemodify(g:_spacevim_root_dir, ':h') . join(['', 'mode', 'dark_powered.toml'], sep)
let config = readfile(f, '') let config = readfile(f, '')
call s:write_to_config(config) call s:write_to_config(config)
endfunction endfunction
function! s:basic_mode() abort function! s:basic_mode() abort
let sep = SpaceVim#api#import('file').separator let sep = SpaceVim#api#import('file').separator
let f = fnamemodify(g:_spacevim_root_dir, ':h') . join(['', 'mode', 'basic.vim'], sep) let f = fnamemodify(g:_spacevim_root_dir, ':h') . join(['', 'mode', 'basic.toml'], sep)
let config = readfile(f, '') let config = readfile(f, '')
call s:write_to_config(config) call s:write_to_config(config)
endfunction endfunction
function! s:write_to_config(config) abort function! s:write_to_config(config) abort
let cf = expand('~/.SpaceVim.d/init.vim')
let global_dir = empty($SPACEVIMDIR) ? expand('~/.SpaceVim.d/') : $SPACEVIMDIR
let g:_spacevim_global_config_path = global_dir . 'init.toml'
let cf = global_dir . 'init.toml'
if filereadable(cf) if filereadable(cf)
return return
endif endif
@ -134,9 +137,10 @@ endfunction
function! s:load_glob_conf() abort function! s:load_glob_conf() abort
if filereadable(expand('~/.SpaceVim.d/init.toml')) let global_dir = empty($SPACEVIMDIR) ? expand('~/.SpaceVim.d/') : $SPACEVIMDIR
let g:_spacevim_global_config_path = '~/.SpaceVim.d/init.toml' if filereadable(global_dir . 'init.toml')
let local_conf = expand('~/.SpaceVim.d/init.toml') let g:_spacevim_global_config_path = global_dir . 'init.toml'
let local_conf = global_dir . 'init.toml'
let local_conf_cache = expand('~/.cache/SpaceVim/conf/init.json') let local_conf_cache = expand('~/.cache/SpaceVim/conf/init.json')
if getftime(local_conf) < getftime(local_conf_cache) if getftime(local_conf) < getftime(local_conf_cache)
let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), '')) let conf = s:JSON.json_decode(join(readfile(local_conf_cache, ''), ''))
@ -146,12 +150,11 @@ function! s:load_glob_conf() abort
call writefile([s:JSON.json_encode(conf)], local_conf_cache) call writefile([s:JSON.json_encode(conf)], local_conf_cache)
call SpaceVim#custom#apply(conf) call SpaceVim#custom#apply(conf)
endif endif
elseif filereadable(expand('~/.SpaceVim.d/init.vim')) exe 'set runtimepath^=' . global_dir
let g:_spacevim_global_config_path = '~/.SpaceVim.d/init.vim' elseif filereadable(global_dir . 'init.vim')
let custom_glob_conf = expand('~/.SpaceVim.d/init.vim') let g:_spacevim_global_config_path = global_dir . 'init.vim'
if isdirectory(expand('~/.SpaceVim.d/')) let custom_glob_conf = global_dir . 'init.vim'
set runtimepath^=~/.SpaceVim.d exe 'set runtimepath^=' . global_dir
endif
exe 'source ' . custom_glob_conf exe 'source ' . custom_glob_conf
else else
if has('timers') if has('timers')

@ -12,13 +12,15 @@ description: "General documentation about how to using SpaceVim, including the q
- [Screenshots](#screenshots) - [Screenshots](#screenshots)
- [Who can benefit from this?](#who-can-benefit-from-this) - [Who can benefit from this?](#who-can-benefit-from-this)
- [Update and Rollback](#update-and-rollback) - [Update and Rollback](#update-and-rollback)
- [Update SpaceVim itself](#update-spacevim-itself) - [Update SpaceVim itself](#update-spacevim-itself)
- [Update plugins](#update-plugins) - [Update plugins](#update-plugins)
- [Get SpaceVim log](#get-spacevim-log) - [Get SpaceVim log](#get-spacevim-log)
- [Configuration layers](#configuration-layers)
- [Custom Configuration](#custom-configuration) - [Custom Configuration](#custom-configuration)
- [Automatic Generation](#automatic-generation)
- [Alternative directory](#alternative-directory)
- [Vim Compatible Mode](#vim-compatible-mode)
- [Private Layers](#private-layers)
- [Concepts](#concepts) - [Concepts](#concepts)
- [Differences between vim/neovim and SpaceVim](#differences-between-vimneovim-and-spacevim)
- [Interface elements](#interface-elements) - [Interface elements](#interface-elements)
- [Colorschemes](#colorschemes) - [Colorschemes](#colorschemes)
- [Font](#font) - [Font](#font)
@ -158,7 +160,7 @@ to get more screenshots, see: [issue #415](https://github.com/SpaceVim/SpaceVim/
## Update and Rollback ## Update and Rollback
#### Update SpaceVim itself ### Update SpaceVim itself
There are several methods of updating the core files of SpaceVim. It is recommended to update the packages first; see the next section. There are several methods of updating the core files of SpaceVim. It is recommended to update the packages first; see the next section.
@ -178,39 +180,23 @@ To update manually close Vim and update the git repository:
`git -C ~/.SpaceVim pull`. `git -C ~/.SpaceVim pull`.
#### Update plugins ### Update plugins
Use `:SPUpdate` command will update all the plugins and SpaceVim itself. after `:SPUpdate`, you can assign plugins need to be updated. Use <kbd>Tab</kbd> to complete plugin names after `:SPUpdate`. Use `:SPUpdate` command will update all the plugins and SpaceVim itself. after `:SPUpdate`, you can assign plugins need to be updated. Use <kbd>Tab</kbd> to complete plugin names after `:SPUpdate`.
#### Get SpaceVim log ### Get SpaceVim log
Use `:SPDebugInfo!` command will display the log of SpaceVim. You also can use `SPC h I` to open a buffer with issue template. Use `:SPDebugInfo!` command will display the log of SpaceVim. You also can use `SPC h I` to open a buffer with issue template.
## Configuration layers
This section is an overview of layers. A more extensive introduction to writing configuration layers can be found in [SpaceVim's layers page](http://spacevim.org/layers/) (recommended reading!).
**Purpose**
Layers help collect related packages together to provide features. For example, the `lang#python` layer provides auto-completion, syntax checking, and REPL support for python files. This approach helps keep configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install. To install all the `python` features the user has just to add the `lang#python` layer to their custom configuration file.
**Structure**
In SpaceVim, a layer is a single file. In a layer, for example, `autocomplete` layer, the file is `autoload/SpaceVim/layers/autocomplete.vim`, and there are there public functions:
- `SpaceVim#layers#autocomplete#plugins()`: return a list of plugins used in this plugins.
- `SpaceVim#layers#autocomplete#config()`: layer config, such as key bindings and autocmds.
- `SpaceVim#layers#autocomplete#set_variable()`: function for setting layer options.
## Custom Configuration ## Custom Configuration
User configuration can be stored in your ~/.SpaceVim.d directory. ### Automatic Generation
**Automatic Generation**
The very first time SpaceVim starts up, it will ask you several questions and then create the `SpaceVim.d/init.toml` in your `HOME` directory. The very first time SpaceVim starts up, it will ask you several questions and then create the `SpaceVim.d/init.toml` in your `HOME` directory.
**Alternative directory** ### Alternative directory
User configuration can be stored in your `~/.SpaceVim.d` directory.
`~/.SpaceVim.d/` will be added to `&runtimepath` of vim. read <kbd>:h rtp</kbd>. `~/.SpaceVim.d/` will be added to `&runtimepath` of vim. read <kbd>:h rtp</kbd>.
@ -244,6 +230,8 @@ here is an example config file for SpaceVim:
[lang/java] [lang/java]
``` ```
This is a list of available options for SpaceVim:
Comprehensive documentation is available for each layer by <kbd>:h SpaceVim</kbd>. Comprehensive documentation is available for each layer by <kbd>:h SpaceVim</kbd>.
if you want to add custom `SPC` prefix key bindings, you can add this to SpaceVim configuration file, **be sure** the key bindings is not used in SpaceVim. if you want to add custom `SPC` prefix key bindings, you can add this to SpaceVim configuration file, **be sure** the key bindings is not used in SpaceVim.
@ -252,20 +240,9 @@ if you want to add custom `SPC` prefix key bindings, you can add this to SpaceVi
call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup') call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup')
call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1) call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1)
``` ```
### Vim Compatible Mode
## Concepts This a list of different key bindings between SpaceVim and origin vim.
**Transient-states**
SpaceVim defines a wide variety of transient states (temporary overlay maps) where it makes sense. This prevents one from doing repetitive and tedious presses on the SPC key.
When a transient state is active, a documentation is displayed in the transient state buffer. Additional information may as well be displayed in it.
Move Text Transient State:
![Move Text Transient State](https://user-images.githubusercontent.com/13142418/28489559-4fbc1930-6ef8-11e7-9d5a-716fe8dbb881.png)
## Differences between vim/neovim and SpaceVim
- The `s` key does replace cursor char, but in SpaceVim it is the `Window` key bindings specific leader key by default (which can be set on another key binding in dotfile). If you still prefer the origin function of `s`, you can use an empty string to disable this feature. - The `s` key does replace cursor char, but in SpaceVim it is the `Window` key bindings specific leader key by default (which can be set on another key binding in dotfile). If you still prefer the origin function of `s`, you can use an empty string to disable this feature.
@ -281,7 +258,39 @@ the option is `g:spacevim_windows_smartclose`, default value is `q`. If you stil
[Send a PR](http://spacevim.org/development/) to add the differences you found in this section. [Send a PR](http://spacevim.org/development/) to add the differences you found in this section.
If you still want to use this origin function, you can enable vimcompatible mode, via `let g:spacevim_vimcompatible = 1`. If you still want to use this origin function, you can enable vimcompatible mode, via `vimcompatible = 1` in `[options]` section.
### Private Layers
This section is an overview of layers. A more extensive introduction to writing configuration layers can be found in [SpaceVim's layers page](http://spacevim.org/layers/) (recommended reading!).
**Purpose**
Layers help collect related packages together to provide features. For example, the `lang#python` layer provides auto-completion, syntax checking, and REPL support for python files. This approach helps keep configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install. To install all the `python` features the user has just to add the `lang#python` layer to their custom configuration file.
**Structure**
In SpaceVim, a layer is a single file. In a layer, for example, `autocomplete` layer, the file is `autoload/SpaceVim/layers/autocomplete.vim`, and there are there public functions:
- `SpaceVim#layers#autocomplete#plugins()`: return a list of plugins used in this plugins.
- `SpaceVim#layers#autocomplete#config()`: layer config, such as key bindings and autocmds.
- `SpaceVim#layers#autocomplete#set_variable()`: function for setting layer options.
## Concepts
**Transient-states**
SpaceVim defines a wide variety of transient states (temporary overlay maps)
where it makes sense. This prevents one from doing repetitive and tedious
presses on the SPC key.
When a transient state is active, a documentation is displayed in the
transient state buffer. Additional information may as well be displayed in it.
Move Text Transient State:
![Move Text Transient State](https://user-images.githubusercontent.com/13142418/28489559-4fbc1930-6ef8-11e7-9d5a-716fe8dbb881.png)
## Interface elements ## Interface elements

@ -71,16 +71,18 @@ The default configuration file of SpaceVim is `~/.SpaceVim.d/init.toml`, here is
# Enable autocomplete layer # Enable autocomplete layer
[[layers]] [[layers]]
name = 'autocomplete' name = "autocomplete"
auto-completion-return-key-behavior = "complete" auto-completion-return-key-behavior = "complete"
auto-completion-tab-key-behavior = "cycle" auto-completion-tab-key-behavior = "cycle"
[[layers]] [[layers]]
name = 'shell' name = "shell"
default_position = 'top' default_position = "top"
default_height = 30 default_height = 30
``` ```
This example only list part of SpaceVim options, for the list of SpaceVim options, please read `:h SpaceVim-config`
## Learning SpaceVim ## Learning SpaceVim
- [SpaceVim Documentation](../documentation). Also known as "The Book", The SpaceVim Documentation will introduce - [SpaceVim Documentation](../documentation). Also known as "The Book", The SpaceVim Documentation will introduce

@ -1,10 +0,0 @@
{
"colorscheme": "grubox",
"background": "dark",
"guicolors": true,
"statusline_separator": "nil",
"statusline_inactive_separator": "bar",
"buffer_index_type": 4,
"filetype_icon": false,
"statusline_display_mode": false
}

@ -1,4 +1,10 @@
# This is basic configuration example for SpaceVim #=============================================================================
# basic.toml --- basic configuration example for SpaceVim
# Copyright (c) 2016-2017 Wang Shidong & Contributors
# Author: Wang Shidong < wsdjeg at 163.com >
# URL: https://spacevim.org
# License: GPLv3
#=============================================================================
# All SpaceVim option below [option] section # All SpaceVim option below [option] section
[options] [options]
@ -9,14 +15,16 @@
background = "dark" background = "dark"
# Disable guicolors in basic mode, many terminal do not support 24bit # Disable guicolors in basic mode, many terminal do not support 24bit
# true colors # true colors
guicolors = true guicolors = false
# Disable statusline separator, if you want to use other value, please # Disable statusline separator, if you want to use other value, please
# install nerd fonts # install nerd fonts
statusline_separator = "nil" statusline_separator = "nil"
statusline_separator = "bar" statusline_inactive_separator = "bar"
buffer_index_type = 4 buffer_index_type = 4
filetype_icon = false filetype_icon = false
statusline_display_mode = false statusline_display_mode = false
# Enable vim compatible mode, avoid changing origin vim key bindings
vimcompatible = 1
# Enable autocomplete layer # Enable autocomplete layer
[[layers]] [[layers]]

@ -1,30 +0,0 @@
"=============================================================================
" basic.vim --- Basic mode of SpaceVim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
" SpaceVim Options: {{{
" Disable true colors
let g:spacevim_enable_guicolors = 0
" Use empty string as statusline separator
let g:spacevim_statusline_separator = 'nil'
" Use | as inactive separator of statusline
let g:spacevim_statusline_inactive_separator = 'bar'
" Use general integer as buffer index
let g:spacevim_buffer_index_type = 4
" Disable Filetype icon
let g:spacevim_enable_tabline_filetype_icon = 0
" Disable mode in statusline
let g:spacevim_enable_statusline_display_mode = 0
" }}}

36
mode/dark_powered.toml Normal file

@ -0,0 +1,36 @@
#=============================================================================
# dark_powered.toml --- dark powered configuration example for SpaceVim
# Copyright (c) 2016-2017 Wang Shidong & Contributors
# Author: Wang Shidong < wsdjeg at 163.com >
# URL: https://spacevim.org
# License: GPLv3
#=============================================================================
# All SpaceVim option below [option] section
[options]
# set spacevim theme. by default colorscheme layer is not loaded,
# if you want to use more colorscheme, please load the colorscheme
# layer
colorscheme = "gruvbox"
background = "dark"
# Disable guicolors in basic mode, many terminal do not support 24bit
# true colors
guicolors = true
# Disable statusline separator, if you want to use other value, please
# install nerd fonts
statusline_separator = "arrow"
statusline_inactive_separator = "arrow"
buffer_index_type = 4
filetype_icon = true
statusline_display_mode = false
# Enable autocomplete layer
[[layers]]
name = 'autocomplete'
auto-completion-return-key-behavior = "complete"
auto-completion-tab-key-behavior = "smart"
[[layers]]
name = 'shell'
default_position = 'top'
default_height = 30

@ -1,24 +0,0 @@
"=============================================================================
" dark_powered.vim --- Dark powered mode of SpaceVim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
" SpaceVim Options: {{{
let g:spacevim_enable_debug = 1
let g:spacevim_realtime_leader_guide = 1
let g:spacevim_enable_tabline_filetype_icon = 1
let g:spacevim_enable_statusline_display_mode = 0
let g:spacevim_enable_os_fileformat_icon = 1
let g:spacevim_buffer_index_type = 1
let g:spacevim_enable_vimfiler_welcome = 1
let g:spacevim_enable_debug = 1
" }}}
" SpaceVim Layers: {{{
" }}}