diff --git a/README.md b/README.md index 9a4e46772..df534716f 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Here is a throughput graph of the repository for the last few weeks: - [New Features](#new-features) -- [Install](#install) - [Project layout](#project-layout) - [Support SpaceVim](#support-spacevim) - [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/) -### 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 ```txt diff --git a/autoload/SpaceVim/custom.vim b/autoload/SpaceVim/custom.vim index 5d8a3f75e..ba230c8ce 100644 --- a/autoload/SpaceVim/custom.vim +++ b/autoload/SpaceVim/custom.vim @@ -43,20 +43,23 @@ endfunction function! s:awesome_mode() abort 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, '') call s:write_to_config(config) endfunction function! s:basic_mode() abort 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, '') call s:write_to_config(config) endfunction 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) return endif @@ -134,9 +137,10 @@ endfunction function! s:load_glob_conf() abort - if filereadable(expand('~/.SpaceVim.d/init.toml')) - let g:_spacevim_global_config_path = '~/.SpaceVim.d/init.toml' - let local_conf = expand('~/.SpaceVim.d/init.toml') + let global_dir = empty($SPACEVIMDIR) ? expand('~/.SpaceVim.d/') : $SPACEVIMDIR + if filereadable(global_dir . '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') if getftime(local_conf) < getftime(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 SpaceVim#custom#apply(conf) endif - elseif filereadable(expand('~/.SpaceVim.d/init.vim')) - let g:_spacevim_global_config_path = '~/.SpaceVim.d/init.vim' - let custom_glob_conf = expand('~/.SpaceVim.d/init.vim') - if isdirectory(expand('~/.SpaceVim.d/')) - set runtimepath^=~/.SpaceVim.d - endif + exe 'set runtimepath^=' . global_dir + elseif filereadable(global_dir . 'init.vim') + let g:_spacevim_global_config_path = global_dir . 'init.vim' + let custom_glob_conf = global_dir . 'init.vim' + exe 'set runtimepath^=' . global_dir exe 'source ' . custom_glob_conf else if has('timers') diff --git a/docs/documentation.md b/docs/documentation.md index 82d7fa3d4..41d494dfd 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -12,13 +12,15 @@ description: "General documentation about how to using SpaceVim, including the q - [Screenshots](#screenshots) - [Who can benefit from this?](#who-can-benefit-from-this) - [Update and Rollback](#update-and-rollback) - - [Update SpaceVim itself](#update-spacevim-itself) - - [Update plugins](#update-plugins) - - [Get SpaceVim log](#get-spacevim-log) -- [Configuration layers](#configuration-layers) + - [Update SpaceVim itself](#update-spacevim-itself) + - [Update plugins](#update-plugins) + - [Get SpaceVim log](#get-spacevim-log) - [Custom Configuration](#custom-configuration) + - [Automatic Generation](#automatic-generation) + - [Alternative directory](#alternative-directory) + - [Vim Compatible Mode](#vim-compatible-mode) + - [Private Layers](#private-layers) - [Concepts](#concepts) -- [Differences between vim/neovim and SpaceVim](#differences-between-vimneovim-and-spacevim) - [Interface elements](#interface-elements) - [Colorschemes](#colorschemes) - [Font](#font) @@ -158,7 +160,7 @@ to get more screenshots, see: [issue #415](https://github.com/SpaceVim/SpaceVim/ ## 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. @@ -178,39 +180,23 @@ To update manually close Vim and update the git repository: `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 Tab 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. -## 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 -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. -**Alternative directory** +### Alternative directory + +User configuration can be stored in your `~/.SpaceVim.d` directory. `~/.SpaceVim.d/` will be added to `&runtimepath` of vim. read :h rtp. @@ -244,6 +230,8 @@ here is an example config file for SpaceVim: [lang/java] ``` +This is a list of available options for SpaceVim: + Comprehensive documentation is available for each layer by :h 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#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1) ``` +### Vim Compatible Mode -## 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) - -## Differences between vim/neovim and SpaceVim +This a list of different key bindings between SpaceVim and origin vim. - 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. -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 diff --git a/docs/quick-start-guide.md b/docs/quick-start-guide.md index 3fc4db72d..5561bed05 100644 --- a/docs/quick-start-guide.md +++ b/docs/quick-start-guide.md @@ -71,16 +71,18 @@ The default configuration file of SpaceVim is `~/.SpaceVim.d/init.toml`, here is # Enable autocomplete layer [[layers]] -name = 'autocomplete' +name = "autocomplete" auto-completion-return-key-behavior = "complete" auto-completion-tab-key-behavior = "cycle" [[layers]] -name = 'shell' -default_position = 'top' +name = "shell" +default_position = "top" default_height = 30 ``` +This example only list part of SpaceVim options, for the list of SpaceVim options, please read `:h SpaceVim-config` + ## Learning SpaceVim - [SpaceVim Documentation](../documentation). Also known as "The Book", The SpaceVim Documentation will introduce diff --git a/mode/basic.json b/mode/basic.json deleted file mode 100644 index 7ec2ca6a3..000000000 --- a/mode/basic.json +++ /dev/null @@ -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 -} diff --git a/mode/basic.toml b/mode/basic.toml index 3eecc2222..e3b7e3362 100644 --- a/mode/basic.toml +++ b/mode/basic.toml @@ -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 [options] @@ -9,14 +15,16 @@ background = "dark" # Disable guicolors in basic mode, many terminal do not support 24bit # true colors - guicolors = true + guicolors = false # Disable statusline separator, if you want to use other value, please # install nerd fonts statusline_separator = "nil" - statusline_separator = "bar" + statusline_inactive_separator = "bar" buffer_index_type = 4 filetype_icon = false statusline_display_mode = false + # Enable vim compatible mode, avoid changing origin vim key bindings + vimcompatible = 1 # Enable autocomplete layer [[layers]] diff --git a/mode/basic.vim b/mode/basic.vim deleted file mode 100644 index f5a8d316f..000000000 --- a/mode/basic.vim +++ /dev/null @@ -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 -" }}} - - diff --git a/mode/dark_powered.toml b/mode/dark_powered.toml new file mode 100644 index 000000000..f0aa9e0dd --- /dev/null +++ b/mode/dark_powered.toml @@ -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 diff --git a/mode/dark_powered.vim b/mode/dark_powered.vim deleted file mode 100644 index 39458d4f4..000000000 --- a/mode/dark_powered.vim +++ /dev/null @@ -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: {{{ -" }}} - -