From 059b9c5875e3465d0e0168f4551117828421df90 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sat, 19 Jan 2019 19:47:13 +0800 Subject: [PATCH 001/179] Fix neovim cmdline ref: https://github.com/neovim/neovim/issues/9524 --- autoload/SpaceVim/api/transient_state.vim | 19 +++++++++++-------- autoload/SpaceVim/plugins/highlight.vim | 11 +++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/autoload/SpaceVim/api/transient_state.vim b/autoload/SpaceVim/api/transient_state.vim index b40f90bc9..7e29ae946 100644 --- a/autoload/SpaceVim/api/transient_state.vim +++ b/autoload/SpaceVim/api/transient_state.vim @@ -14,7 +14,7 @@ let s:self._title = 'Transient State' let s:self._handle_inputs = {} let s:self._is_quit = [] let s:self._handle_quit = {} -let s:self.noredraw = 0 +let s:self._clear_cmdline = 1 let s:self._cmp = SpaceVim#api#import('vim#compatible') function! s:self.open() abort @@ -54,17 +54,15 @@ function! s:self.open() abort while 1 if has_key(self._keys, 'logo') noautocmd wincmd p - if self.noredraw - redraw! - endif call call(self._keys.logo, []) noautocmd wincmd p endif - if !self.noredraw - redraw! + if self._clear_cmdline + normal! : else - let self.noredraw = 0 + let self._clear_cmdline = 1 endif + redraw let char = self._getchar() if char ==# "\" || char ==# "\" || char2nr(char) == 128 continue @@ -91,7 +89,12 @@ function! s:self.open() abort exe self._handle_quit[char] endif endif - redraw! + if self._clear_cmdline + normal! : + else + let self._clear_cmdline = 1 + endif + redraw endfunction diff --git a/autoload/SpaceVim/plugins/highlight.vim b/autoload/SpaceVim/plugins/highlight.vim index 74cfd825f..743759d53 100644 --- a/autoload/SpaceVim/plugins/highlight.vim +++ b/autoload/SpaceVim/plugins/highlight.vim @@ -40,11 +40,6 @@ function! s:range_logo() abort endtry let s:hi_range_id = s:CMP.matchaddpos('HiRrange' . s:current_range, [[3, begin, len(s:current_range) + 2]]) let s:hi_range_index = s:CMP.matchaddpos('HiRrangeIndex', [[3, begin + len(s:current_range) + 2, len(index) + 2]]) - redraw! - echon ' Change current range to:' - exe 'echohl HiRrange' . s:current_range - echon s:current_range - echohl None endfunction " }}} @@ -249,7 +244,11 @@ function! s:change_range() abort call s:clear_highlight() call s:highlight() endif - let s:state.noredraw = 1 + let s:state._clear_cmdline = 0 + echon ' Change current range to:' + exe 'echohl HiRrange' . s:current_range + echon s:current_range + echohl None endfunction " }}} From 02e6d9d3b02bc3e7e730fe90d65e8640c047e694 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sat, 19 Jan 2019 19:57:14 +0800 Subject: [PATCH 002/179] Hide cursor when open highlight plugin --- autoload/SpaceVim/plugins/highlight.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autoload/SpaceVim/plugins/highlight.vim b/autoload/SpaceVim/plugins/highlight.vim index 743759d53..2f0870144 100644 --- a/autoload/SpaceVim/plugins/highlight.vim +++ b/autoload/SpaceVim/plugins/highlight.vim @@ -17,6 +17,7 @@ let s:VIMH = SpaceVim#api#import('vim#highlight') let s:STRING = SpaceVim#api#import('data#string') let s:CMP = SpaceVim#api#import('vim#compatible') +let s:HI = SpaceVim#api#import('vim#highlight') "}}} " init local variable {{{ @@ -190,7 +191,17 @@ function! SpaceVim#plugins#highlight#start() abort \ ], \ } \ ) + let save_tve = &t_ve + setlocal t_ve= + if has('gui_running') + let cursor_hi = s:HI.group2dict('Cursor') + call s:HI.hide_in_normal('Cursor') + endif call s:state.open() + let &t_ve = save_tve + if has('gui_running') + call s:HI.hi(cursor_hi) + endif try call s:clear_highlight() catch From 3acb74eb55b9473ba399ee041c4a0e6d091e6e6e Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 20 Jan 2019 20:40:58 +0800 Subject: [PATCH 003/179] Improve lua support (#2470) --- autoload/SpaceVim/layers/lang/lua.vim | 25 ++++-- .../2018-09-27-use-vim-as-a-python-ide.md | 4 +- .../_posts/2019-01-19-use-vim-as-a-lua-ide.md | 82 ++++++++++++++++++ .../_posts/2019-01-20-use-vim-as-a-lua-ide.md | 83 +++++++++++++++++++ 4 files changed, 183 insertions(+), 11 deletions(-) create mode 100644 docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md create mode 100644 docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md diff --git a/autoload/SpaceVim/layers/lang/lua.vim b/autoload/SpaceVim/layers/lang/lua.vim index 2cd7e5de4..4e4ffd2ec 100644 --- a/autoload/SpaceVim/layers/lang/lua.vim +++ b/autoload/SpaceVim/layers/lang/lua.vim @@ -21,20 +21,14 @@ function! SpaceVim#layers#lang#lua#plugins() abort let plugins = [] " Improved Lua 5.3 syntax and indentation support for Vim - call add(plugins, ['tbastos/vim-lua', {'on_ft' : 'lua'}]) + call add(plugins, ['wsdjeg/vim-lua', {'on_ft' : 'lua'}]) call add(plugins, ['WolfgangMehner/lua-support', {'on_ft' : 'lua'}]) - call add(plugins, ['SpaceVim/vim-luacomplete', {'on_ft' : 'lua', 'if' : has('lua')}]) return plugins endfunction let s:lua_repl_command = '' function! SpaceVim#layers#lang#lua#config() abort - if has('lua') - augroup spacevim_lua - autocmd FileType lua setlocal omnifunc=luacomplete#complete - augroup END - endif call SpaceVim#mapping#space#regesit_lang_mappings('lua', function('s:language_specified_mappings')) let luaexe = filter(['lua53', 'lua52', 'lua51'], 'executable(v:val)') @@ -43,8 +37,23 @@ function! SpaceVim#layers#lang#lua#config() abort else call SpaceVim#plugins#runner#reg_runner('lua', 'lua %s') endif + let g:neomake_lua_enabled_makers = ['luac'] + let luacexe = filter(['luac53', 'luac52', 'luac51'], 'executable(v:val)') + if !empty(luacexe) + let g:neomake_lua_luac_maker = { + \ 'exe': luacexe[0], + \ 'args': ['-p'], + \ 'errorformat': '%*\f: %#%f:%l: %m', + \ } + else + let g:neomake_lua_luac_maker = { + \ 'exe': 'luac', + \ 'args': ['-p'], + \ 'errorformat': '%*\f: %#%f:%l: %m', + \ } + endif if !empty(s:lua_repl_command) - call SpaceVim#plugins#repl#reg('lua',s:lua_repl_command) + call SpaceVim#plugins#repl#reg('lua',s:lua_repl_command) else if executable('luap') call SpaceVim#plugins#repl#reg('lua', 'luap') diff --git a/docs/_posts/2018-09-27-use-vim-as-a-python-ide.md b/docs/_posts/2018-09-27-use-vim-as-a-python-ide.md index 1b11e075e..d93ef06c4 100644 --- a/docs/_posts/2018-09-27-use-vim-as-a-python-ide.md +++ b/docs/_posts/2018-09-27-use-vim-as-a-python-ide.md @@ -17,7 +17,7 @@ Each of the following sections will be covered: - [Enable language layer](#enable-language-layer) - [Code completion](#code-completion) -- [Syntax lint](#syntax-lint) +- [Syntax linting](#syntax-linting) - [Import packages](#import-packages) - [Jump to test file](#jump-to-test-file) - [running code](#running-code) @@ -50,8 +50,6 @@ The completion menu will be opened as you type. 1. [neomake](https://github.com/neomake/neomake) - Asynchronous linting and make framework for Neovim/Vim -The javac maker in neomake supports maven projects, gradle projects or eclipse projects. You can also set the classpath. - ### Import packages When edit python file, you can import the package automatically, remove unused package and format package list. diff --git a/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md b/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md new file mode 100644 index 000000000..0d6e2e4f4 --- /dev/null +++ b/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md @@ -0,0 +1,82 @@ +--- +title: "Use Vim as a Lua IDE" +categories: [tutorials, blog] +images: https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png +excerpt: "A general guide for using SpaceVim as Lua IDE, including layer configuration, requiems installation and usage." +type: BlogPosting +comments: true +commentsID: "Use Vim as a Lua IDE" +--- + +# [Blogs](../blog/) >> Use Vim as a Lua IDE + +This is a general guide for using SpaceVim as a lua IDE, including layer configuration and usage. +Each of the following sections will be covered: + + + + +- [Enable language layer](#enable-language-layer) +- [Code completion](#code-completion) +- [Syntax linting](#syntax-linting) +- [Jump to test file](#jump-to-test-file) +- [running code](#running-code) +- [Code formatting](#code-formatting) + + + +### Enable language layer + +To add lua language support in SpaceVim, you need to enable the `lang#lua` layer. Press `SPC f v d` to open +SpaceVim configuration file, and add following configuration: + +```toml +[[layers]] + name = "lang#lua" +``` + +for more info, you can read the [lang#lua](../layers/lang/lua/) layer documentation. + +### Code completion + +`lang#lua` layer will load the vim-lua plugin automatically, unless overriden in your `init.toml`. +The completion menu will be opened as you type. + +![lua](https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png) + +### Syntax linting + +The checkers layer is enabled by default. This layer provides asynchronous syntax linting via [neomake](https://github.com/neomake/neomake). +It will run luac asynchronously. + +![luac](https://user-images.githubusercontent.com/13142418/51438866-b8cfda80-1cec-11e9-8645-b43fc6481e42.png) + +### Jump to test file + +SpaceVim use built-in plugin to manager the files in a project, you can add a `.projections.json` to the root of your project with following content: + +```json +{ + "src/*.lua": {"alternate": "test/{}.lua"}, + "test/*.lua": {"alternate": "src/{}.lua"} +} +``` + +with this configuration, you can jump between the source code and test file via command `:A` + +### running code + +To run current script, you can press `SPC l r`, and a split windows +will be openen, the output of the script will be shown in this windows. +It is running asynchronously, and will not block your vim. + +![luarunner](https://user-images.githubusercontent.com/13142418/51438907-76f36400-1ced-11e9-8838-441965a22ce9.png) + +### Code formatting + +The format layer is also enabled by default, with this layer you can use key binding `SPC b f` to format current buffer. +Before using this feature, please install luaformatter. + +```sh +luarocks install formatter +``` diff --git a/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md b/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md new file mode 100644 index 000000000..5cc37df79 --- /dev/null +++ b/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md @@ -0,0 +1,83 @@ +--- +title: "使用 Vim 搭建 Lua 开发环境" +categories: [tutorials_cn, blog_cn] +images: https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png +excerpt: "这篇文章主要介绍如何使用 SpaceVim 搭建 Lua 的开发环境,简介 lang#lua 模块所支持的功能特性以及使用技巧" +permalink: /cn/:title/ +lang: cn +type: BlogPosting +comments: true +commentsID: "使用 Vim 搭建 Lua 开发环境" +--- + +# [Blogs](../blog/) >> 使用 Vim 搭建 Lua 开发环境 + +SpaceVim 是一个模块化的 Vim IDE,针对 lua 这一语言的支持主要依靠 `lang#lua` 模块以及与之相关的其他模块。 +的这篇文章主要介绍如何使用 SpaceVim 搭建 lua 的开发环境,侧重介绍跟 lua 开发相关使用技巧。 +在阅读这篇文章之前,可以先阅读《[使用 Vim 搭建基础的开发环境](../use-vim-as-ide/)》,对语言相关以外的功能有一个大致的了解。 + + + +- [安装模块](#安装模块) +- [代码自动补全](#代码自动补全) +- [语法检查](#语法检查) +- [工程文件跳转](#工程文件跳转) +- [快速运行](#快速运行) +- [代码格式化](#代码格式化) + + + +### 安装模块 + +SpaceVim 初次安装时默认并未启用相关语言模块。首先需要启用 +`lang#lua` 模块, 通过快捷键 `SPC f v d` 打开配置文件,添加: + +```toml +[[layers]] + name = "lang#lua" +``` + +启用 `lang#lua` 模块后,在打开 lua 文件时,就可以使用语言专属快捷键,这些快捷键都是以 `SPC l` 为前缀的。 + +### 代码自动补全 + +`autocomplete` 模块为 SpaceVim 提供了自动补全功能, +该模块会根据当前环境自动在多种补全引擎之间选择合适的, +默认的补全引擎有:deoplete、neocomplete、ycm、asyncomplete 以及 neocomplcache。 +几种自动补全引擎当中,要数 deoplete 的体验效果最好。 + +![lua](https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png) + +### 语法检查 + +`checkers` 模块为 SpaceVim 提供了语法检查的功能,该模块默认已经载入。该模块默认使用 [neomake](https://github.com/neomake/neomake) +这一异步语法检查工具。对于 luac 的支持,是通过异步调用 luac 命令来完成的。 + +![luac](https://user-images.githubusercontent.com/13142418/51438866-b8cfda80-1cec-11e9-8645-b43fc6481e42.png) + +### 工程文件跳转 + +SpaceVim 自带工程管理插件,可以识别项目根目录,自动跳转alternate文件。 + +### 快速运行 + +在编辑 lua 文件时,可以快速运行当前文件,这个功能有点类似于 vscode 的 code runner 插件,默认的快捷键是 `SPC l r`。按下后, +会在屏幕下方打开一个插件窗口,运行的结果会被展示在窗口内。于此同时,光标并不会跳到该插件窗口,避免影响编辑。在这里需要说明下, +这一功能是根据当前文件的路径调用相对应的 lua 命令。因此,在执行这个快捷键之前,应当先保存一下该文件。 + +![luarunner](https://user-images.githubusercontent.com/13142418/51438907-76f36400-1ced-11e9-8838-441965a22ce9.png) + +### 代码格式化 + +lua 代码格式化,主要依赖 `format` 模块,同时需要安装相关的后台命令 luaformatter: + +```toml +[[layers]] + name = "format" +``` + +安装 luaformatter: + +```sh +luarocks install formatter +``` From 859aad6cca399d7f800a86b587d0b009787eca3e Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sun, 20 Jan 2019 23:16:04 +0800 Subject: [PATCH 004/179] Fix repl windows && lua repl command --- autoload/SpaceVim/layers/lang/lua.vim | 2 ++ autoload/SpaceVim/plugins/repl.vim | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/lua.vim b/autoload/SpaceVim/layers/lang/lua.vim index 4e4ffd2ec..d5549ed57 100644 --- a/autoload/SpaceVim/layers/lang/lua.vim +++ b/autoload/SpaceVim/layers/lang/lua.vim @@ -57,6 +57,8 @@ function! SpaceVim#layers#lang#lua#config() abort else if executable('luap') call SpaceVim#plugins#repl#reg('lua', 'luap') + elseif !empty(luaexe) + call SpaceVim#plugins#repl#reg('lua', luaexe) else call SpaceVim#plugins#repl#reg('lua', 'lua') endif diff --git a/autoload/SpaceVim/plugins/repl.vim b/autoload/SpaceVim/plugins/repl.vim index bc9bc6c64..ae21d674b 100644 --- a/autoload/SpaceVim/plugins/repl.vim +++ b/autoload/SpaceVim/plugins/repl.vim @@ -171,7 +171,7 @@ function! s:open_windows() abort botright split __REPL__ let lines = &lines * 30 / 100 exe 'resize ' . lines - setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber winfixheight set filetype=SpaceVimREPL nnoremap q :call close() let s:bufnr = bufnr('%') From f90a74f8f067bceee85010a373ad37c09bb25ea1 Mon Sep 17 00:00:00 2001 From: Bernard Vander Beken Date: Sun, 20 Jan 2019 20:50:16 +0100 Subject: [PATCH 005/179] Fix typo --- docs/layers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/layers.md b/docs/layers.md index 32c93901f..22e309292 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -49,7 +49,7 @@ default_height = 30 ### Disable layers -Some layers are enabled by defalut, here is an example for disable `shell` layer: +Some layers are enabled by default, here is an example for disable `shell` layer: ```toml [[layers]] From d6445c5633c2b2eef2bea793eea799339223f947 Mon Sep 17 00:00:00 2001 From: Chen Lijun Date: Mon, 21 Jan 2019 02:07:13 +0100 Subject: [PATCH 006/179] Fix: call fzf#wrap in fzf#run (#2472) This allows colors, history, etc. configuration through fzf global variables to be applied. --- autoload/SpaceVim/layers/fzf.vim | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/autoload/SpaceVim/layers/fzf.vim b/autoload/SpaceVim/layers/fzf.vim index e0e63ad8e..eb1064441 100644 --- a/autoload/SpaceVim/layers/fzf.vim +++ b/autoload/SpaceVim/layers/fzf.vim @@ -143,15 +143,15 @@ endfunction command! FzfColors call colors() function! s:colors() abort let s:source = 'colorscheme' - call fzf#run({'source': map(split(globpath(&rtp, 'colors/*.vim')), + call fzf#run(fzf#wrap({'source': map(split(globpath(&rtp, 'colors/*.vim')), \ "fnamemodify(v:val, ':t:r')"), - \ 'sink': 'colo','options': '--reverse', 'down': '40%'}) + \ 'sink': 'colo','options': '--reverse', 'down': '40%'})) endfunction command! FzfFiles call files() function! s:files() abort let s:source = 'files' - call fzf#run({'sink': 'e', 'options': '--reverse', 'down' : '40%'}) + call fzf#run(fzf#wrap("files", {'sink': 'e', 'options': '--reverse', 'down' : '40%'})) endfunction let s:source = '' @@ -194,12 +194,12 @@ function! s:jumps() abort function! s:jumplist() abort return split(s:CMP.execute('jumps'), '\n')[1:] endfunction - call fzf#run({ + call fzf#run(fzf#wrap("jumps", { \ 'source': reverse(jumplist()), \ 'sink': function('s:bufopen'), \ 'options': '+m', \ 'down': len(jumplist()) + 2 - \ }) + \ })) endfunction command! FzfMessages call message() function! s:yankmessage(e) abort @@ -213,12 +213,12 @@ function! s:message() abort function! s:messagelist() abort return split(s:CMP.execute('message'), '\n') endfunction - call fzf#run({ + call fzf#run(fzf#wrap("messages", { \ 'source': reverse(messagelist()), \ 'sink': function('s:yankmessage'), \ 'options': '+m', \ 'down': len(messagelist()) + 2 - \ }) + \ })) endfunction command! FzfQuickfix call s:quickfix() @@ -238,12 +238,12 @@ function! s:quickfix() abort function! s:quickfix_list() abort return map(getqflist(), 's:quickfix_to_grep(v:val)') endfunction - call fzf#run({ + call fzf#run(fzf#wrap("quickfix", { \ 'source': reverse(quickfix_list()), \ 'sink': function('s:open_quickfix_item'), \ 'options': '--reverse', \ 'down' : '40%', - \ }) + \ })) endfunction command! FzfLocationList call s:location_list() function! s:location_list_to_grep(v) abort @@ -262,12 +262,12 @@ function! s:location_list() abort function! s:get_location_list() abort return map(getloclist(0), 's:location_list_to_grep(v:val)') endfunction - call fzf#run({ + call fzf#run(fzf#wrap("location_list", { \ 'source': reverse(get_location_list()), \ 'sink': function('s:open_location_item'), \ 'options': '--reverse', \ 'down' : '40%', - \ }) + \ })) endfunction @@ -337,12 +337,12 @@ function! s:register() abort function! s:registers_list() abort return split(s:CMP.execute('registers'), '\n')[1:] endfunction - call fzf#run({ + call fzf#run(fzf#wrap("registers", { \ 'source': reverse(registers_list()), \ 'sink': function('s:yankregister'), \ 'options': '+m', \ 'down': '40%' - \ }) + \ })) endfunction command! Fzfbuffers call buffers() @@ -354,12 +354,12 @@ function! s:buffers() abort function! s:buffer_list() abort return split(s:CMP.execute('buffers'), '\n') endfunction - call fzf#run({ + call fzf#run(fzf#wrap("buffers", { \ 'source': reverse(buffer_list()), \ 'sink': function('s:open_buffer'), \ 'options': '+m', \ 'down': '40%' - \ }) + \ })) endfunction let s:ansi = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36} @@ -419,11 +419,11 @@ function! s:helptags(...) let s:helptags_script = tempname() call writefile(['/('.(s:SYS.isWindows ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('.s:green('%-40s', 'Label').'\t%s\t%s\n), $2, $3, $1)'], s:helptags_script) let s:source = 'help' - call fzf#run({ + call fzf#run(fzf#wrap("helptags", { \ 'source': 'grep -H ".*" '.join(map(tags, 'shellescape(v:val)')). \ ' | perl -n '. shellescape(s:helptags_script).' | sort', \ 'sink': function('s:helptag_sink'), \ 'options': ['--ansi', '--reverse', '+m', '--tiebreak=begin', '--with-nth', '..-2'] + (empty(query) ? [] : ['--query', query]), \ 'down': '40%' - \ }) + \ })) endfunction From 62661587224d18b94b032a1e1d7ff02102b90757 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Mon, 21 Jan 2019 09:51:53 +0800 Subject: [PATCH 007/179] Doc: fix typos. (#2471) --- docs/cn/conventions.md | 27 +++---- docs/cn/development.md | 12 +-- docs/cn/documentation.md | 140 ++++++++++++++++++----------------- docs/cn/faq.md | 14 ++-- docs/cn/layers.md | 10 +-- docs/cn/quick-start-guide.md | 16 ++-- 6 files changed, 110 insertions(+), 109 deletions(-) diff --git a/docs/cn/conventions.md b/docs/cn/conventions.md index 8905a6c7b..5f955fb74 100644 --- a/docs/cn/conventions.md +++ b/docs/cn/conventions.md @@ -41,7 +41,7 @@ lang: cn ## Commit emoji 规范 - `:memo:` 添加一个备注或者文档 -- `:gift:` 新的特新 +- `:gift:` 新的特性 - `:bug:` bug 修复 - `:bomb:` 破坏向后兼容 - `:white_check_mark:` 添加测试 @@ -52,7 +52,7 @@ lang: cn ### 可移植性 -Vim 具有高度可定制性。用户可以更改很多的默认设置,包括区分大小写,正则表达式规则,替换规则,还有很多别的。为了让你的脚本可以适用于所有用户,请遵循下面的引导: +Vim 具有高度可定制性。用户可以更改很多的默认设置,包括区分大小写,正则表达式规则,替换规则,还有很多别的。为了让你的脚本可以适用于所有用户,请遵循下面的规则: #### 字符串 @@ -64,9 +64,10 @@ Vim 具有高度可定制性。用户可以更改很多的默认设置,包括 #### 匹配字符串 -**用 =~# 或者 =~? 操作符家族替换=~家族** +**用`=~#`或者`=~?`操作符家族替换`=~`家族** -匹配行为取决于用户的忽略大小写设置(ignorecase)和智能大小写(smartcase)设置以及你是否将它们与 =~, =~# 或 =~?操作符家族进行比较。使用 =~# 和 =~? 操作符家族显式的比较字符串,除非明确的要遵守用户的大小写语义设置。 +匹配行为取决于用户的忽略大小写设置(ignorecase)和智能大小写(smartcase)设置以及你是否将它们与`=~,` `=~#` 或 `=~?`操作符家族进行比较。 +使用`=~#`和`=~?` 操作符家族显式的比较字符串,除非明确的要遵守用户的大小写语义设置。 #### 正则表达式 @@ -80,11 +81,11 @@ Vim 具有高度可定制性。用户可以更改很多的默认设置,包括 **避免命令意想不到的副作用** -避免使用 `:s[ubtitute]` 因为它引动光标并打印错误消息。首选功能(例如 search()) 比 s[ubtitute] 更适用于脚本。 +避免使用 `:s[ubstitute]` 因为它会移动光标并打印错误消息。函数(例如 search())更适用于脚本。 -这意味着 g 标志取决于上层中 gdefault 设置。如果你用了 `:subtitute` 你必须要保存 gdefault, 把它设置为 0 或 1 预先生成替换并且在操作完成后还原它。 +这意味着 g 标志取决于上层中 gdefault 的设置。如果你用了 `:substitute` 你必须要保存 gdefault, 把它设置为 0 或 1,预先生成替换并且在操作完成后还原它。 For many Vim commands, functions exist that do the same thing with fewer side effects. See `:help functions()` for a list of built-in functions. -有很多内置的 Vim 命令,函数,可以在更小的影响下完成同样的事情。查看 `:help functions()` 查看内置的函数表。 +有很多内置的 Vim 命令、函数,可以在更小的影响下完成同样的事情。查看 `:help functions` 查看内置的函数表。 #### 脆弱命令 @@ -92,7 +93,7 @@ For many Vim commands, functions exist that do the same thing with fewer side ef 一直使用普通模式(normal) 在普通模式下安装。后者取决于用户的按键映射,可以做任何事情。 -避免 `:s[ubtitute]`,因为它的行为取决于上层的一些运行设置。 +避免 `:s[ubstitute]`,因为它的行为取决于上层的一些运行设置。 其它同样的命令的应用,在此不再列出。 @@ -135,13 +136,13 @@ Vim 脚本在处理一些类型(style)时有不安全,不直观的行为。举 **用 Vim 脚本替代** -避免使用其它的脚本语言,例如 Ruby 和 Lua 。 我们不能保证,用户的 Vim 已经完成了对 non-vimscript languages 的支持。 +避免使用其它的脚本语言,例如 Ruby 和 Lua。 我们不能保证,用户的 Vim 已经完成了对 non-vimscript languages 的支持。 #### 插件布局 **将功能组织到模块化插件中** -把你的功能组织成为一个插件,统一放在一个文件夹中(或者是代码仓库)分享你的插件名(用一个 "vim-" 前缀或者需要的话使用 ".vim" 后缀)。它应该可以被拆分到 plugin/, autoload/, 等等。子目录应该以 addon-info.json 格式声明元数据(详情参见 VAM 文档)。 +把你的功能组织成为一个插件,统一放在一个文件夹中(或者是代码仓库)分享你的插件名(用一个 "vim-" 前缀或者需要的话使用 ".vim" 后缀)。它应该可以被拆分到 plugin/, autoload/, 等等。子目录应该以 addon-info.json 格式声明元数据(详情参见 Vim 文档)。 #### 功能 @@ -155,7 +156,7 @@ Vim 脚本在处理一些类型(style)时有不安全,不直观的行为。举 [!] 允许开发者无需申诉(complaint)便可重新加载它们的功能。 -[abort] 强制函数再遇到错误时停止。 +[abort] 强制函数在遇到错误时停止。 #### 命令 @@ -259,7 +260,7 @@ autocommand BufEnter #### 命名 -总的来说,使用像这样的插件名 plugin-names-like-this,像这样的函数名 FunctionNamesLikeThis,像这样的命令名 CommandNamesLikeThis,像这样的参数组 augroup_names_like_this,像这样的变量名 variable_names_like_this 。 +总的来说,使用像这样的插件名 plugin-names-like-this,像这样的函数名 FunctionNamesLikeThis,像这样的命令名 CommandNamesLikeThis,像这样的参数组 augroup_names_like_this,像这样的变量名 variable_names_like_this。 总是在变量名前加上它们的范围前缀 - plugin-names-like-this @@ -282,7 +283,7 @@ autocommand BufEnter - 本地缓冲区(Buffer-local)变量的前缀为`b:` - `g:`, `s:`, 和 `a:` 前缀必须使用 - `b:` 当你想要改变本地缓冲区(buffer-local)的变量的语义时前缀为 `b:` - - `l:` and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. + - `l:` and `v:` should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. ## markdown 代码规范 diff --git a/docs/cn/development.md b/docs/cn/development.md index 0deb4084e..a11aea52b 100644 --- a/docs/cn/development.md +++ b/docs/cn/development.md @@ -57,7 +57,7 @@ SpaceVim 是每个志愿者的努力的结晶,我们鼓励你参与进来,Sp - 检查错误追踪中是否存在重复的问题,你可以通过在错误追踪中搜索关键词来确认,错误追踪中是否存在重复的问题 -- 检查问题是否在最新版的 SpaceVim 中修复,请更新你的 SpaceVim,然后进行 bug 重现操作。 +- 检查问题是否在最新版的 SpaceVim 中修复,请更新你的 SpaceVim,然后进行 Bug 重现操作。 - 按照下面的问题格式,建立清晰的问题标题 @@ -125,11 +125,11 @@ git rebase upstream/master - 每个 PR 一个主题 - 每个 PR 一个提交 - 如果你有一些不同主题的提交,请关闭 PR 然后为每个主题创建一个新的 PR -- 如果你仍然有很多提交,请把他们打包成一个提交 +- 如果你仍然有很多提交,请把它们打包成一个提交 #### 复杂的 PRs (大的重构,等): -只打包一些枯燥的提交,比如修改错别字,语法修复,等等... 把重要和独立的步骤分别放在不同的提交中。 +只打包一些枯燥的提交,比如修改错别字,语法修复,等等。把重要和独立的步骤分别放在不同的提交中。 Those PRs are merged and explicitly not fast-forwarded. 这些 PRs 被合并并且非明试快速转发。 提交信息 @@ -269,11 +269,11 @@ If you contribute to an already existing layer, you should not modify any header 按键映射是 SpaceVim 中非常重要的一部分。 -如果你只想要拥有自己的按键映射的话,你可以在`~/.SpaceVim.d/init.vim`文件中进行修改。 +如果你只想要拥有自己的按键映射的话,你可以在 bootstrap function 文件中进行修改。 如果你认为贡献一个新的按键映射有必要,那么请首先阅读文档,把自己的按键映射调整为最佳状态,然后用你更改后的按键映射进行提交 PR。 -始终牢记,在相关文档中记录新的按键映射或者是按键映射更改。他应该是层文件和 [documentation.md](https://spacevim.org/cn/documentation)。 +始终牢记,在相关文档中记录新的按键映射或者是按键映射更改。它应该是 layername.md 和 [documentation.md](https://spacevim.org/cn/documentation)。 ##### 特定语言的按键绑定 @@ -305,7 +305,7 @@ You are free to choose a reasonable height size but the width size should be aro ## 基于 SpaceVim 开发 -SpaceVim 提供了一套内置的公共函数库[(API)](../api/),可以基于这个公共函数开发兼容 Vim 和 Neovim 的插件。同时,也可以像插件的 README 中添加 SpaceVim 的图标: +SpaceVim 提供了一套内置的公共函数库[(API)](../api/),可以基于这个公共函数开发兼容 Vim 和 Neovim 的插件。同时,也可以向插件的 README 中添加 SpaceVim 的图标: ![](https://img.shields.io/badge/build%20with-SpaceVim-ff69b4.svg) diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 147f35d8c..ee59dea55 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1,6 +1,6 @@ --- title: "SpaceVim 中文手册" -description: "SpaceVim 是一个社区驱动的模块化 Vim 配置,以模块的方式组织和管理插件,为不同语言开发定制特定的模块,提供语法检查、自动补全、格式化、一键编译运行、以及 REPL 和 DEBUG 支持。" +description: "SpaceVim 是一个社区驱动的模块化 Vim 配置,以模块的方式组织和管理插件,为不同语言开发定制特定的模块,提供语法检查、自动补全、格式化、一键编译运行以及 REPL 和 DEBUG 支持。" redirect_from: "/README_zh_cn/" lang: cn --- @@ -164,7 +164,7 @@ Neovim 运行在 iTerm2 上,采用 SpaceVim,配色为:_base16-solarized-da **自动更新** -注意:默认,这一特性是禁用的,因为自动更新将会增加 SpaceVim 的启动时间,影响用户体验。如果你需要这一特性,可以将如下加入到用户配置文件中:`let g:spacevim_automatic_update = 1`。 +注意:默认,这一特性是禁用的,因为自动更新将会增加 SpaceVim 的启动时间,影响用户体验。如果你需要这一特性,可以将如下加入到用户配置文件中:`automatic_update = true`。 启用这一特性后,SpaceVim 将会在每次启动时候检测是否有新版本。更新后需重启 SpaceVim。 @@ -196,26 +196,26 @@ SpaceVim 同时还支持项目本地配置,配置初始文件为,当前目 所有的 SpaceVim 选项可以使用 `:h SpaceVim-config` 来查看。选项名称为原先 Vim 脚本中使用的变量名称去除 `g:spacevim_` 前缀。 -完整的内置文档可以通过 `:h SpaceVim` 进行查阅。也可以通过按键 `SPC h SPC` 模糊搜索,该快捷键需要载入一个模糊搜索的模块。 +完整的内置文档可以通过 `:h SpaceVim` 进行查阅。也可以通过按键 `SPC h SPC` 模糊搜索,该快捷键需要载入一个模糊搜索模块。 **添加自定义插件** -如果你需要添加 github 上的插件,只需要在 SpaceVim 配置文件中添加 `custom_plugins` 片段: +如果你需要添加 github 上的插件,只需要在 SpaceVim 配置文件中添加 `[[custom_plugins]]` 片段: ```toml [[custom_plugins]] name = "lilydjwg/colorizer" on_cmd = ["ColorHighlight", "ColorToggle"] - merged = 0 + merged = false ``` 以上这段配置,添加了插件 `lilydjwg/colorizer`,并且,通过 `on_cmd` 这一选项使得这个插件延迟加载。 -该插件会在第一次执行 `ColorHighlight` 或者 `ColorToggle` 命令时被加载。除了 `on_cmd` 以外,还有一些其他的选项, +该插件会在第一次执行 `ColorHighlight` 或者 `ColorToggle` 命令时被加载。除了 `on_cmd` 以外,还有一些其它的选项, 可以通过 `:h dein-options` 查阅。 **禁用插件** -SpaceVim 默认安装了一些插件,如果需要禁用某个插件,可以通过 `disabled_plugins` 这一选项来操作: +SpaceVim 默认安装了一些插件,如果需要禁用某个插件,可以通过`~/.SpaceVim.d/init.toml`的`[options]`片段中的 `disabled_plugins` 这一选项来操作: ```toml [options] @@ -226,21 +226,25 @@ SpaceVim 默认安装了一些插件,如果需要禁用某个插件,可以 ### 启动函数 由于 toml 配置的局限性,SpaceVim 提供了两种启动函数 `bootstrap_before` 和 `bootstrap_after`,在该函数内可以使用 Vim script。 -可通过设置这两个选项值来指定函数名称。 - +可通过`~/.SpaceVim.d/init.toml`的`[options]`片段中的这两个选项`bootstrap_before` 和 `bootstrap_after`来指定函数名称,例如: +```toml +[options] + bootstrap_before = "myspacevim#before" + bootstrap_after = "myspacevim#after" +``` 启动函数文件应放置在 Vim &runtimepath 的 autoload 文件夹内。例如: 文件名:`~/.SpaceVim.d/autoload/myspacevim.vim` ```vim -func! myspacevim#before() abort +function! myspacevim#before() abort let g:neomake_enabled_c_makers = ['clang'] nnoremap jk -endf +endfunction -func! myspacevim#after() abort +function! myspacevim#after() abort iunmap jk -endf +endfunction ``` 函数 `bootstrap_before` 将在读取用户配置后执行,而函数 `bootstrap_after` 将在 VimEnter autocmd 之后执行。 @@ -248,10 +252,10 @@ endf 如果你需要添加自定义以 `SPC` 为前缀的快捷键,你需要使用 bootstrap function,在其中加入: ```vim -func! myspacevim#before() abort +function! myspacevim#before() abort call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup') call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1) -endf +endfunction ``` ### Vim 兼容模式 @@ -259,26 +263,25 @@ endf 以下为 SpaceVim 中与 Vim 默认情况下的一些差异。 - Noraml 模式下 `s` 按键不再删除光标下的字符,在 SpaceVim 中, - 它是窗口相关快捷键的前缀(可以在配置文件中设置成其他按键)。 + 它是窗口相关快捷键的前缀(可以在配置文件中设置成其它按键)。 如果希望恢复 `s` 按键原先的功能,可以通过 `windows_leader = ""` 将窗口前缀键设为空字符串来禁用这一功能。 - Normal 模式下 `,` 按键在 Vim 默认情况下是重复上一次的 `f`、`F`、`t` 和 `T` 按键,但在 SpaceVim 中默认被用作为语言专用的前缀键。如果需要禁用此选项, 可设置 `enable_language_specific_leader = false`。 - Normal 模式下 `q` 按键在 SpaceVim 中被设置为了智能关闭窗口, - 即大多数情况下按下 `q` 键即可关闭当前窗口。可以通过 `windows_smartclose = ""` 使用一个空字符串来禁用这一功能,或修改为其他按键。 + 即大多数情况下按下 `q` 键即可关闭当前窗口。可以通过 `windows_smartclose = ""` 使用一个空字符串来禁用这一功能,或修改为其它按键。 - 命令行模式下 `Ctrl-a` 按键在 SpaceVim 中被修改为了移动光标至命令行行首。 - 命令行模式下 `Ctrl-b` 按键被映射为方向键 ``, 用以向左移动光标。 - 命令行模式下 `Ctrl-f` 按键被映射为方向键 ``, 用以向右移动光标。 -可以通过设置 `vimcompatible = true` 来启用 Vim 兼容模式,而在兼容模式下, -以上所有差异将不存在。当然,也可通过对应的选项禁用某一个差异。比如,恢复逗号`,`的原始功能, -可以通过禁用语言专用的前缀键: +可以通过设置 `vimcompatible = true` 来启用 Vim 兼容模式,而在兼容模式下,以上所有差异将不存在。 +当然,也可通过对应的选项禁用某一个差异。例如,恢复逗号`,`的原始功能,可以通过禁用语言专用的前缀键: ```toml [options] enable_language_specific_leader = false ``` -如果发现有其他区别,可以[提交 PR](http://spacevim.org/development/)。 +如果发现有其它区别,可以[提交 PR](http://spacevim.org/development/)。 ### 私有模块 @@ -291,7 +294,7 @@ SpaceVim 的[模块首页](../layers/)。 **结构** -在 SpaceVim 中,一个模块是一单个 Vim 文件,比如,`autocomplete` 模块存储在 `autoload/SpaceVim/layers/autocomplete.vim`,在这个文件内有以下几种公共函数: +在 SpaceVim 中,一个模块是一个单个的 Vim 文件,例如,`autocomplete` 模块存储在 `autoload/SpaceVim/layers/autocomplete.vim`,在这个文件内有以下几个公共函数: - `SpaceVim#layers#autocomplete#plugins()`: 返回该模块插件列表 - `SpaceVim#layers#autocomplete#config()`: 模块相关设置 @@ -299,30 +302,25 @@ SpaceVim 的[模块首页](../layers/)。 ### 调试上游插件 -当发现某个内置上游插件存在问题时,需要修改并调试上游插件,可以依照以下步骤: +当发现某个内置上游插件存在问题,需要修改并调试上游插件时,可以依照以下步骤操作: 1. 禁用内置上游插件 - 比如,调试内置语法检查插件 neomake.vim - ```toml [options] disabled_plugins = ["neomake.vim"] ``` -2. 添加自己 fork 的插件,或者本地克隆版本: - -修改配置文件 `init.toml`,加入以下部分,来添加自己 fork 的版本: - +2. 添加自己 fork 的插件 +修改配置文件`init.toml`,加入以下部分,来添加自己 fork 的版本: ```toml [[custom_plugins]] name = 'wsdjeg/neomake.vim' # note: you need to disable merged feature merged = false ``` - -或者使用 `bootstrap_before` 函数添加本地路径: - +或者添加本地克隆版本 +使用`bootstrap_before`函数来添加本地路径: ```vim function! myspacevim#before() abort set rtp+=~/path/to/your/localplugin @@ -333,7 +331,7 @@ endfunction **临时快捷键菜单** -SpaceVim 根据需要定义了很多临时快捷键,这将避免需要重复某些操作时,过多按下 `SPC` 前置键。当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口,提示每一临时快捷键的功能。此外一些格外的辅助信息也将会体现出来。 +SpaceVim 根据需要定义了很多临时快捷键,这可以避免需要重复某些操作时,过多按下 `SPC` 前置键。当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口,提示每一临时快捷键的功能。此外一些格外的辅助信息也将会体现出来。 文本移动临时快捷键: @@ -341,13 +339,13 @@ SpaceVim 根据需要定义了很多临时快捷键,这将避免需要重复 ## 优雅的界面 -SpaceVim 集成了多种使用 UI 插件,如常用的文件树、语法树等插件,配色主题默认采用的是 gruvbox。 +SpaceVim 集成了多种实用的 UI 插件,如常用的文件树、语法树等插件,配色主题默认采用的是 gruvbox。 ### 颜色主题 默认的颜色主题采用的是 [gruvbox](https://github.com/morhetz/gruvbox)。这一主题有深色和浅色两种。关于这一主题一些详细的配置可以阅读 `:h gruvbox`。 -如果需要修改 SpaceVim 的主题,可以在 `~/.SpaceVim.d/init.toml` 中修改 `colorscheme`。例如,使用 Vim 自带的内置主题 `desert`: +如果需要修改 SpaceVim 的主题,可以在`~/.SpaceVim.d/init.toml`的`[options]`片段中修改 `colorscheme`选项。例如,使用 Vim 自带的内置主题 `desert`: ```toml [options] @@ -367,7 +365,7 @@ SpaceVim 集成了多种使用 UI 插件,如常用的文件树、语法树等 SpaceVim 在终端下默认使用了真色,因此使用之前需要确认下你的终端是否支持真色。 可以阅读 [Colours in terminal](https://gist.github.com/XVilka/8346728) 了解根多关于真色的信息。 -如果你的终端不支持真色,可以在 SpaceVim 用户配置 `[options]` 中禁用真色支持: +如果你的终端不支持真色,可以在 `~/.SpaceVim.d/init.toml` 的`[options]`片段中禁用真色支持: ```toml enable_guicolors = false @@ -377,12 +375,12 @@ SpaceVim 在终端下默认使用了真色,因此使用之前需要确认下 在 SpaceVim 中默认的字体是 [SauceCodePro Nerd Font Mono](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/SourceCodePro.zip)。 如果你也喜欢这一字体,建议将这一字体安装到系统中。 -如果需要修改 SpaceVim 的字体,可以在用户配置文件中修改选项 `guifont`,默认值为: +如果需要修改 SpaceVim 的字体,可以在`~/.SpaceVim.d/init.toml`的`[options]`片段中修改选项 `guifont`,默认值为: ```toml +[options] guifont = "SauceCodePro Nerd Font Mono:h11" ``` - 如果指定的字体不存在,将会使用系统默认的字体,此外,这一选项在终端下是无效的,终端下修改字体,需要修改终端自身配置。 ### 界面元素切换 @@ -459,7 +457,7 @@ SpaceVim 默认使用 `nerd fonts`,可参阅其安装指南进行安装。 **搜索结果信息:** -当使用 `/` 或 `?` 进行搜索时,或当按下 `n` 或 `N` 后,搜索结果序号将被展示在状态栏中,类似于 `20/22` 显示搜索结果总数以及当前结果的序号。具体的效果图如下: +当使用 `/` 或 `?` 进行搜索时,或当按下 `n` 或 `N` 后,搜索结果序号将被展示在状态栏中,使用类似于 `20/22` 这样的分数显示搜索结果的当前序号以及结果总数。具体的效果图如下: ![search status](https://cloud.githubusercontent.com/assets/13142418/26313080/578cc68c-3f3c-11e7-9259-a27419d49572.png) @@ -479,10 +477,10 @@ _acpi_ 可展示电池电量剩余百分比。 **状态栏分割符:** -可通过使用 `statusline_separator` 来定制状态栏分割符,例如使用非常常用的方向箭头作为状态栏分割符: +可通过使用 `statusline_separator` 来定制状态栏分割符,例如使用常用的方向箭头作为状态栏分割符: ```toml - statusline_separator = 'arrow' + statusline_separator = 'arrow' ``` SpaceVim 所支持的分割符以及截图如下: @@ -511,7 +509,7 @@ SpaceVim 所支持的分割符以及截图如下: **状态栏的颜色** -SpaceVim 默认为 [colorcheme 模块](../layers/colorscheme/)所包含的主题颜色提供了状态栏主题,若需要使用其他颜色主题, +SpaceVim 默认为 [colorcheme 模块](../layers/colorscheme/)所包含的主题颜色提供了状态栏主题,若需要使用其它颜色主题, 需要自行设置状态栏主题。若未设置,则使用 gruvbox 的主题。 可以参考以下模板来设置: @@ -556,16 +554,17 @@ endfunction 可以设置 `custom_color_palette`: ```toml -custom_color_palette = [ - ["#282828", "#a89984", 246, 235], - ["#a89984", "#504945", 239, 246], - ["#a89984", "#3c3836", 237, 246], - ["#665c54", 241], - ["#282828", "#83a598", 235, 109], - ["#282828", "#fe8019", 235, 208], - ["#282828", "#8ec07c", 235, 108], - ["#282828", "#689d6a", 235, 72], - ["#282828", "#8f3f71", 235, 132], +[options] + custom_color_palette = [ + ["#282828", "#a89984", 246, 235], + ["#a89984", "#504945", 239, 246], + ["#a89984", "#3c3836", 237, 246], + ["#665c54", 241], + ["#282828", "#83a598", 235, 109], + ["#282828", "#fe8019", 235, 208], + ["#282828", "#8ec07c", 235, 108], + ["#282828", "#689d6a", 235, 72], + ["#282828", "#8f3f71", 235, 132], ] ``` @@ -612,7 +611,7 @@ custom_color_palette = [ ### 窗口管理器 窗口管理器快捷键只可以在 Normal 模式下使用,默认的前缀按键为 `s`,可以在配置文件中通过修改 -SpaceVim 选项 `window_leader` 的值来设为其他按键: +SpaceVim 选项 `window_leader` 的值来设为其它按键: | 按键 | 描述 | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | @@ -854,12 +853,12 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的 **添加用户自定义插件** -如果添加来自于 github.com 的插件,可以 `用户名/仓库名` 这一格式,将该插件添加到 `custom_plugins`,示例如下: +如果添加来自于 github.com 的插件,可以 `用户名/仓库名` 这一格式,将该插件添加到 `[[ustom_plugins]]`,示例如下: ```toml [[custom_plugins]] name = 'lilydjwg/colorizer' -merged = 0 +merged = false ``` #### 界面元素显示切换 @@ -998,7 +997,7 @@ merged = 0 | `SPC w K` | 将窗口向上移动 | | `SPC w l` | 移至右方窗口 | | `SPC w L` | 将窗口向右移动 | -| `SPC w m` | 最大化/最小化窗口(最大化相当于关闭其他窗口)(TODO, now only support maximize) | +| `SPC w m` | 最大化/最小化窗口(最大化相当于关闭其它窗口)(TODO, now only support maximize) | | `SPC w M` | 选择窗口进行替换 | | `SPC w o` | 按序切换标签页 | | `SPC w p m` | open messages buffer in a popup window (TODO) | @@ -1029,7 +1028,7 @@ Buffer 操作相关快捷键都是以 `SPC b` 为前缀的: | `SPC u SPC b d` | kill the current buffer and window (does not delete the visited file) (TODO) | | `SPC b D` | 选择一个窗口,并删除其 buffer | | `SPC u SPC b D` | kill a visible buffer and its window using ace-window(TODO) | -| `SPC b C-d` | 删除其他 buffer | +| `SPC b C-d` | 删除其它 buffers | | `SPC b C-D` | kill buffers using a regular expression(TODO) | | `SPC b e` | 清除当前 buffer 内容,需要手动确认 | | `SPC b h` | 打开 _SpaceVim_ 欢迎界面 | @@ -1093,11 +1092,12 @@ SpaceVim 相关的快捷键均以 `SPC f v` 为前缀,这便于快速访问 Sp #### 文件树 -SpaceVim 使用 vimfiler 作为默认的文件树插件,默认的快捷键是 `F3`, SpaceVim 也提供了另外一组快捷键 `SPC f t` 和 `SPC f T` 来打开文件树,如果需要使用 nerdtree 作为默认文件树,需要设置: +SpaceVim 使用 vimfiler 作为默认的文件树插件,默认的快捷键是 `F3`, SpaceVim 也提供了另外一组快捷键 `SPC f t` 和 `SPC f T` 来打开文件树,如果需要使用 nerdtree 作为默认文件树,需要在`~/.SpaceVim.d/init.toml`的`[options]`片段中修改选项 vimfiler: ```toml -# 默认值为 vimfiler -filemanager = "nerdtree" +[options] + # 默认值为 vimfiler + filemanager = "nerdtree" ``` SpaceVim 的文件树提供了版本控制信息的接口,但是这一特性需要分析文件夹内容, @@ -1262,7 +1262,7 @@ SpaceVim 中的搜索命令以 `SPC s` 为前缀,前一个键是使用的工 如果最后一个键(决定范围)是大写字母,那么就会对当前光标下的单词进行搜索。 举个例子 `SPC s a B` 将会搜索当前光标下的单词。 -如果工具键被省略了,那么会用默认的搜索工具进行搜索。默认的搜索工具对应在 `g:spacevim_search_tools` +如果工具键被省略了,那么会用默认的搜索工具进行搜索。默认的搜索工具对应在 `search_tools` 列表中的第一个工具。列表中的工具默认的顺序为:`rg`, `ag`, `pt`, `ack`, `grep`。 举个例子:如果 `rg` 和 `ag` 没有在系统中找到,那么 `SPC s b` 会使用 `pt` 进行搜索。 @@ -1440,9 +1440,11 @@ endfunction | `SPC s w g` | Get Google suggestions in Vim. Opens Google results in Browser. | | `SPC s w w` | Get Wikipedia suggestions in Vim. Opens Wikipedia page in Browser.(TODO) | -**注意**: 为了在 Vim 中使用谷歌 suggestions,你需要在你的配置文件的[options]片断中加入如下配置: +**注意**: 为了在 Vim 中使用谷歌 suggestions,需要在 `~/.SpaceVim.d/init.toml` 的`[[options]]`片段中加入如下配置: -`enable_googlesuggest = 1` +```toml + enable_googlesuggest = true +``` #### 实时代码检索 @@ -1467,7 +1469,7 @@ FlyGrep 缓冲区的按键绑定: #### 保持高亮 -SpaceVim 使用 `g:spacevim_search_highlight_persist` 保持当前搜索结果的高亮状态到下一次搜索。 +SpaceVim 使用 `search_highlight_persist` 保持当前搜索结果的高亮状态到下一次搜索。 同样可以通过 `SPC s c` 或者运行 ex 命令 `:noh` 来取消搜索结果的高亮表示。 #### 高亮光标下变量 @@ -1607,7 +1609,7 @@ In transient state: | `-` | 为光标下的数字减 1 | | 其它任意键 | 离开 transient state | -**提示:** 如果你想为光标下的数字所增加的值大于 `1`,你可以使用前缀参数。例如:`10 SPC n +` 将为为光标下的数字增加 `10`。 +**提示:** 如果你想为光标下的数字所增加的值大于 `1`,你可以使用前缀参数。例如:`10 SPC n +` 将为光标下的数字加 `10`。 #### Replace text with iedit @@ -1744,9 +1746,9 @@ SpaceVim 通过 [neomake](https://github.com/neomake/neomake) fly 工具来进 | 提示符 | 描述 | 自定义选项 | | ------ | ----------- | --------------------------- | -| `✖` | Error | `g:spacevim_error_symbol` | -| `➤` | warning | `g:spacevim_warning_symbol` | -| `🛈` | Info | `g:spacevim_info_symbol` | +| `✖` | Error | `error_symbol` | +| `➤` | warning | `warning_symbol` | +| `🛈` | Info | `info_symbol` | ### 工程管理 @@ -1756,7 +1758,7 @@ SpaceVim 中的工程通过 vim-projectionisst 和 vim-rooter 进行管理。当 工程管理的命令以 `p` 开头: | 快捷键 | 描述 | -| ----------- | ---------------------------------------------- | +| ----------- | ----------------------------------------------- | | `SPC p '` | 在当前工程的根目录打开 shell(需要 shell 模块) | #### 在工程中搜索文件 diff --git a/docs/cn/faq.md b/docs/cn/faq.md index 343719e84..221a13ce1 100644 --- a/docs/cn/faq.md +++ b/docs/cn/faq.md @@ -42,11 +42,11 @@ SpaceVim 在启动时直接读取缓存的 json 文件,效率更高。 ### 为什么 SpaceVim 颜色主题和官网不一致? 因为在 SpaceVim 中,默认情况下启用了终端真色,因此你需要确保你的终端支持真色。 -但是并不是每种终端都支持真色。因此,当你的终端不支持真色时, -你可以在配置文件里面禁用真色支持: +但是并不是每种终端都支持真色。因此,当你的终端不支持真色时,你可以在配置文件里面禁用真色支持: ```toml - enable_guicolors = false +[options] + enable_guicolors = false ``` ### 如何增加自定义快捷键? @@ -57,19 +57,17 @@ SpaceVim 在启动时直接读取缓存的 json 文件,效率更高。 比如,我需要加入这样一个快捷键,使用 ` w` 来保存当前文件。那么, 我需要修改配置文件,并指定一个载入时需要调用的方法: -修改 `~/.SpaceVim.d/init.toml`,加入 `bootstrap_before` 选项: - +在`~/.SpaceVim.d/init.toml`的[options]片断中加入 `bootstrap_before` 选项: ```toml [options] - bootstrap_before = "myspacevim#init" + bootstrap_before = "myspacevim#init" ``` 添加文件 `~/.SpaceVim.d/autoload/myspacevim.vim`, 并加入如下内容: - ```vim function! myspacevim#init() abort - nnoremap w :w + nnoremap w :w endfunction ``` diff --git a/docs/cn/layers.md b/docs/cn/layers.md index 6fc42f79a..571e1027c 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -34,9 +34,9 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 ```toml [[layers]] - name = "shell" - default_position = "top" - default_height = 30 + name = "shell" + default_position = "top" + default_height = 30 ``` ### 禁用模块 @@ -47,8 +47,8 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 ```toml [[layers]] - name = "shell" - enable = false + name = "shell" + enable = false ``` diff --git a/docs/cn/quick-start-guide.md b/docs/cn/quick-start-guide.md index 09e207cda..ee455eeee 100644 --- a/docs/cn/quick-start-guide.md +++ b/docs/cn/quick-start-guide.md @@ -1,6 +1,6 @@ --- title: "入门指南" -description: "SpaceVim 入门教程,包括安装初始化配置等内容" +description: "SpaceVim 入门教程,包括安装、初始化配置等内容" lang: cn --- @@ -105,19 +105,19 @@ SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单 # 启用 autocomplete 模块,启用模块时,可以列出一些模块选项,并赋值, # 关于模块的选项,请阅读各个模块的文档 [[layers]] -name = "autocomplete" -auto-completion-return-key-behavior = "complete" -auto-completion-tab-key-behavior = "cycle" + name = "autocomplete" + auto-completion-return-key-behavior = "complete" + auto-completion-tab-key-behavior = "cycle" # 禁用 shell 模块,禁用模块时,需要加入 enable = false [[layers]] -name = "shell" -enable = false + name = "shell" + enable = false # 添加自定义插件 [[custom_plugins]] -name = "lilydjwg/colorizer" -merged = 0 + name = "lilydjwg/colorizer" + merged = false ``` ### 学习 SpaceVim From 6d514432a16e7d67de5c9359d9551c5d083f1356 Mon Sep 17 00:00:00 2001 From: John R Barker Date: Mon, 21 Jan 2019 08:39:33 +0000 Subject: [PATCH 008/179] Typo dashboard (#2477) --- docs/layers/github.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/layers/github.md b/docs/layers/github.md index 9cee42874..3bc7afad3 100644 --- a/docs/layers/github.md +++ b/docs/layers/github.md @@ -51,7 +51,7 @@ func! myspacevim#before() abort let g:gista#client#default_username = 'monkeyxite' endf ``` -Refer [github dashboar](https://github.com/junegunn/vim-github-dashboard), for security concerns you could create a Personal Access Token, export it as an environment variable and use it as a password. +Refer [github dashboard](https://github.com/junegunn/vim-github-dashboard), for security concerns you could create a Personal Access Token, export it as an environment variable and use it as a password. ```shell # in some secure file sourced in your .bashrc, .bash_profile, .zshrc, etc. export GITHUB_TOKEN="" From 7638455d9bc6175c79748105944fb62dda5442d8 Mon Sep 17 00:00:00 2001 From: Chen Lijun Date: Mon, 21 Jan 2019 15:18:53 +0100 Subject: [PATCH 009/179] Add: zeal layer (#2469) --- autoload/SpaceVim/layers/tools/zeal.vim | 32 ++++++++++++++++++++++ docs/layers/tools/zeal.md | 36 +++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 autoload/SpaceVim/layers/tools/zeal.vim create mode 100644 docs/layers/tools/zeal.md diff --git a/autoload/SpaceVim/layers/tools/zeal.vim b/autoload/SpaceVim/layers/tools/zeal.vim new file mode 100644 index 000000000..1b6f5cacb --- /dev/null +++ b/autoload/SpaceVim/layers/tools/zeal.vim @@ -0,0 +1,32 @@ +"============================================================================= +" zeal.vim --- tools#zeal layer file for SpaceVim +" Copyright (c) 2018 Shidong Wang & Contributors +" Author: Chen Lijun < chenlijun1999 at gmail.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +"" +" @section tools#zeal, layer-tools-zeal +" @parentsection layers +" This layer provides Zeal integration for SpaceVim +function! SpaceVim#layers#tools#zeal#plugins() abort + return [ + \ ['KabbAmine/zeavim.vim', { + \ 'on_map': { 'nv': ['Zeavim', 'ZVVisSelection', 'ZVKeyDocset'] } + \ }], + \ ] +endfunction + +function! SpaceVim#layers#tools#zeal#config() abort + " Disable default mapping + let g:zv_disable_mapping = 1 + + let g:_spacevim_mappings_space.D = { 'name' : '+Zeal' } + call SpaceVim#mapping#space#def('nmap', ['D', 'd'], + \ 'Zeavim', 'search word under cursor', 0) + call SpaceVim#mapping#space#def('vmap', ['D', 'D'], + \ 'ZVVisSelection', 'search selected text', 0) + call SpaceVim#mapping#space#def('nmap', ['D', 's'], + \ 'ZVKeyDocset', 'specify docset and query', 0) +endfunction diff --git a/docs/layers/tools/zeal.md b/docs/layers/tools/zeal.md new file mode 100644 index 000000000..276ac2700 --- /dev/null +++ b/docs/layers/tools/zeal.md @@ -0,0 +1,36 @@ +--- +title: "SpaceVim zeal layer" +description: "This layer provides Zeal integration for SpaceVim" +--- + +# [SpaceVim Layers:](https://spacevim.org/layers) tools#zeal + + + +- [Description](#description) +- [Layer Installation](#layer-installation) +- [Key bindings](#key-bindings) + + + +## Description + +This layer provides Zeal integration for SpaceVim. + +## Layer Installation + +To use this configuration layer, add it to your `~/.SpaceVim.d/init.toml`. + + +```toml +[[layers]] + name = "tools#zeal" +``` + +## Key bindings + +| Key Binding | Description | +| ----------- | ---------------------------------------------------- | +| `SPC D d` | search word under cursor | +| `SPC D D` | search selected text | +| `SPC D s` | select docset (TIP: use tab completion) and search | From 55b1bd60ef23ca31ef54a2af9f07d7d5c8018159 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Mon, 21 Jan 2019 22:19:33 +0800 Subject: [PATCH 010/179] Add chinese linter to layer chinese (#2473) * Add: add plugin wsdjeg/ChineseLinter.vim to layer-chinese. * Fixed: fix a typo. --- autoload/SpaceVim/layers/chinese.vim | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/layers/chinese.vim b/autoload/SpaceVim/layers/chinese.vim index bafff50cf..77c35e196 100644 --- a/autoload/SpaceVim/layers/chinese.vim +++ b/autoload/SpaceVim/layers/chinese.vim @@ -9,8 +9,9 @@ function! SpaceVim#layers#chinese#plugins() abort let plugins = [ - \ ['yianwillis/vimcdoc', {'merged' : 0}], - \ ['ianva/vim-youdao-translater', { 'on_cmd' : ['Ydv','Ydc','Yde']}], + \ ['yianwillis/vimcdoc' , {'merged' : 0}], + \ ['ianva/vim-youdao-translater' , {'on_cmd' : ['Ydv' , 'Ydc', 'Yde']}], + \ ['wsdjeg/ChineseLinter.vim' , {'merged' : 0, 'on_cmd' : ['CheckChinese']}], \ ] if SpaceVim#layers#isLoaded('ctrlp') call add(plugins, ['vimcn/ctrlp.cnx', {'merged' : 0}]) @@ -20,7 +21,8 @@ endfunction function! SpaceVim#layers#chinese#config() abort let g:_spacevim_mappings_space.x.g = {'name' : '+translate'} - call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc', 'translate current word', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'g', 't'], 'Ydc' , 'translate current word' , 1) + call SpaceVim#mapping#space#def('nnoremap', ['l', 'c'] , 'CheckChinese', 'Check with ChineseLinter', 1) " do not load vimcdoc plugin let g:loaded_vimcdoc = 1 endfunction From b3bfe5d9ee65695818a14540fe90b1d3831369fc Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Mon, 21 Jan 2019 22:41:23 +0800 Subject: [PATCH 011/179] Update about page (#2468) * Update about page * Update about page * Fix type --- README.md | 1 + docs/about.md | 13 ++----------- docs/cn/about.md | 32 +++++++++++++------------------- 3 files changed, 16 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 0412bb075..534cb0d91 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ Bitcoin: 1DtuVeg81c2L9NEhDaVTAAbrCR3pN5xPFv ### Credits & Thanks This project exists to thank all the people who have [contributed](CONTRIBUTING.md): + - [@Gabirel](https://github.com/Gabirel) and his [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim) diff --git a/docs/about.md b/docs/about.md index 4abe5566a..9ec8f10f0 100644 --- a/docs/about.md +++ b/docs/about.md @@ -14,22 +14,13 @@ language or feature by grouping all the related plugins together. It got inspire - more IDE-like features in vim and neovim - better default different languages -### Principles - -- Do not regress from origin -- Decide outcomes by weighing cost and benefit -- prefer usability over tradition if the benefits are overwhelming -- Give usability a chance - ### Credits & Thanks -This project exists thanks to all the people who have contributed to SpaceVim: +This project exists to thank all the people who have [contributed](CONTRIBUTING.md): - [@Gabirel](https://github.com/Gabirel) and his [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim) - [@everettjf](https://github.com/everettjf) and his [SpaceVimTutorial](https://everettjf.gitbooks.io/spacevimtutorial/content/) - [vimdoc](https://github.com/google/vimdoc) generate doc file for SpaceVim -- [Rafael Bodill](https://github.com/rafi) and his vim-config -- [Bailey Ling](https://github.com/bling) and his dotvim -- authors of all the plugins used in SpaceVim. +- Authors of all the plugins used in SpaceVim. diff --git a/docs/cn/about.md b/docs/cn/about.md index 62967a337..997d48490 100644 --- a/docs/cn/about.md +++ b/docs/cn/about.md @@ -6,29 +6,23 @@ lang: cn # 关于我们 -## 版本 +[SpaceVim](https://github.com/SpaceVim/SpaceVim) 是一个社区驱动的模块化 Vim/Neovim 配置集合,以模块的方式组织管理插件以 +及相关配置,为不同的语言开发量身定制了相关的开发模块,该模块提供代码自动补全, +语法检查、格式化、调试、REPL 等特性。用户仅需载入相关语言的模块即可得到一个开箱 +即用的 Vim-IDE。 +这一项目的灵感来自于 spacemacs。 -[SpaceVim](https://github.com/SpaceVim/SpaceVim) 是一个社区驱动的 Vim 配置,支持 Vim 和 Neovim。 -SpaceVim 使用模块的方式来组织插件,对新手更加友好。 - -## 目标 +### 目标 - 提供可跨平台的优雅的用户体验。 -- 为不同语言开发提供完整的解决方案。 +- 让搭建不同语言开发环境变得更便捷 -## 标准 +### 鸣谢 -- 兼容 Vim 和 Neovim,尽量确保 Vim 下和 Neovim 下有相同的用户体验 -- 兼容 Vim 7.4 或者无 +py/+py3/+lua 等特性的 Vim -- 不要从 origin 回归 -- 通过权衡成本和收益来决定结果 -- 收益与传统相比较,当收益是压倒性的时候,我们选择收益,而非坚持传统 -- 给可用性一个机会 +感谢所有曾经向 SpaceVim 贡献过代码的用户: -## 鸣谢 + -- 开发者:[Wang Shidong](https://github.com/wsdjeg) -- [![贡献者](https://img.shields.io/github/contributors/SpaceVim/SpaceVim.svg)](https://github.com/SpaceVim/SpaceVim/graphs/contributors) -- [vimdoc](https://github.com/google/vimdoc) 自动生成 Vim 文档 -- [Rafael Bodill](https://github.com/rafi) 的 Vim 配置 -- [Bailey Ling](https://github.com/bling) 的 Vim 配置 +- [@Gabirel](https://github.com/Gabirel) 及其 [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim) +- [vimdoc](https://github.com/google/vimdoc):帮助文档自动生成工具 +- SpaceVim 中涉及到的所有插件的作者 From f11b6b525eb382594fcd982ad501d7bf3aaf6c4a Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Mon, 21 Jan 2019 22:58:28 +0800 Subject: [PATCH 012/179] Update following HEAD page --- wiki/cn/Following-HEAD.md | 56 +++++++++++++++++++++++++++++++++++--- wiki/en/Following-HEAD.md | 57 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 106 insertions(+), 7 deletions(-) diff --git a/wiki/cn/Following-HEAD.md b/wiki/cn/Following-HEAD.md index e5f3905ea..51fb0c493 100644 --- a/wiki/cn/Following-HEAD.md +++ b/wiki/cn/Following-HEAD.md @@ -9,18 +9,68 @@ #### 新特性 -- Add some log for flygrep [#2388](https://github.com/SpaceVim/SpaceVim/pull/2388) +- Add chinese linter to layer chinese [#2473](https://github.com/SpaceVim/SpaceVim/pull/2473) +- Add: zeal layer [#2469](https://github.com/SpaceVim/SpaceVim/pull/2469) +- Add: add a new feature 'format all tables' for markdown. [#2457](https://github.com/SpaceVim/SpaceVim/pull/2457) +- add ctrl - r [#2436](https://github.com/SpaceVim/SpaceVim/pull/2436) +- add mapping to clear quickfix [#2430](https://github.com/SpaceVim/SpaceVim/pull/2430) +- Add alt file plugin [#2416](https://github.com/SpaceVim/SpaceVim/pull/2416) +- Add: coc.nvim integration enhacements [#2415](https://github.com/SpaceVim/SpaceVim/pull/2415) +- Add plugin for git log [#1963](https://github.com/SpaceVim/SpaceVim/pull/1963) #### 问题修复 +- Fix typo [#2475](https://github.com/SpaceVim/SpaceVim/pull/2475) +- Fix: call fzf#wrap in fzf#run [#2472](https://github.com/SpaceVim/SpaceVim/pull/2472) +- Fix typo: statuline -> statusline [#2451](https://github.com/SpaceVim/SpaceVim/pull/2451) +- fix #2448 [#2450](https://github.com/SpaceVim/SpaceVim/pull/2450) +- Fix runner close job [#2441](https://github.com/SpaceVim/SpaceVim/pull/2441) +- Fix rust runner in windows [#2438](https://github.com/SpaceVim/SpaceVim/pull/2438) +- Fixed: fix typos. [#2437](https://github.com/SpaceVim/SpaceVim/pull/2437) +- Fix lua runner in windows [#2427](https://github.com/SpaceVim/SpaceVim/pull/2427) +- Fix go run support [#2426](https://github.com/SpaceVim/SpaceVim/pull/2426) +- Fixed: fix a typo, there should be a \| between >> and \/\/. [#2423](https://github.com/SpaceVim/SpaceVim/pull/2423) +- Fixed: Fix an alignment error and fix the regular expression. [#2420](https://github.com/SpaceVim/SpaceVim/pull/2420) +- Fix api import [#2418](https://github.com/SpaceVim/SpaceVim/pull/2418) +- fix `docs/cn/layers/lang/vue.md` [#2417](https://github.com/SpaceVim/SpaceVim/pull/2417) +- Fixed: fix typos. [#2413](https://github.com/SpaceVim/SpaceVim/pull/2413) +- Fix docker support [#2406](https://github.com/SpaceVim/SpaceVim/pull/2406) - Fix debug command [#2226](https://github.com/SpaceVim/SpaceVim/pull/2226) +- Fix perl support [#2230](https://github.com/SpaceVim/SpaceVim/pull/2230) - Fix preview in flygrep [#2256](https://github.com/SpaceVim/SpaceVim/pull/2256) #### 未知 -- Rework faq.md phrasing. [#2386](https://github.com/SpaceVim/SpaceVim/pull/2386) -- Update to v1.1.0-dev [#2382](https://github.com/SpaceVim/SpaceVim/pull/2382) +- Typo dashboard [#2477](https://github.com/SpaceVim/SpaceVim/pull/2477) +- Doc: fix typos. [#2471](https://github.com/SpaceVim/SpaceVim/pull/2471) +- Improve lua support [#2470](https://github.com/SpaceVim/SpaceVim/pull/2470) +- Update about page [#2468](https://github.com/SpaceVim/SpaceVim/pull/2468) +- Update post for FlyGrep [#2465](https://github.com/SpaceVim/SpaceVim/pull/2465) +- implment Ctrl-r to paste from register for flygrep [#2460](https://github.com/SpaceVim/SpaceVim/pull/2460) +- update uncrustify URL link [#2456](https://github.com/SpaceVim/SpaceVim/pull/2456) +- remember cursor position when switch buffer [#2454](https://github.com/SpaceVim/SpaceVim/pull/2454) +- Improve terminal statusline [#2453](https://github.com/SpaceVim/SpaceVim/pull/2453) +- Doc: Correct documentations by ChineseLinter and fix typos. [#2452](https://github.com/SpaceVim/SpaceVim/pull/2452) +- Doc: Correct conventions.md by ChineseLinter and fix some typos. [#2449](https://github.com/SpaceVim/SpaceVim/pull/2449) +- Cosmetics, realign text, remove trailing spaces and tabulation [#2445](https://github.com/SpaceVim/SpaceVim/pull/2445) +- Doc: Fix typos and translate [#2443](https://github.com/SpaceVim/SpaceVim/pull/2443) +- Doc: fix serval typos. [#2442](https://github.com/SpaceVim/SpaceVim/pull/2442) +- Enhance c/c++ layer [#2440](https://github.com/SpaceVim/SpaceVim/pull/2440) +- Install, Fix bad version [#2439](https://github.com/SpaceVim/SpaceVim/pull/2439) +- Use a yellow ⚠ for warnings messages [#2435](https://github.com/SpaceVim/SpaceVim/pull/2435) +- Update statusline support for startify [#2434](https://github.com/SpaceVim/SpaceVim/pull/2434) +- Doc, cosmetics: remove trailing spaces [#2433](https://github.com/SpaceVim/SpaceVim/pull/2433) +- Improve statusline support for gina [#2432](https://github.com/SpaceVim/SpaceVim/pull/2432) +- Doc: fix typo for javascript [#2428](https://github.com/SpaceVim/SpaceVim/pull/2428) +- Jump to test of api [#2424](https://github.com/SpaceVim/SpaceVim/pull/2424) +- patch for #2114 [#2422](https://github.com/SpaceVim/SpaceVim/pull/2422) +- Doc: typo fixes [#2421](https://github.com/SpaceVim/SpaceVim/pull/2421) +- Doc: add description for SPC l k. [#2414](https://github.com/SpaceVim/SpaceVim/pull/2414) +- Website: add vim#command api doc [#2412](https://github.com/SpaceVim/SpaceVim/pull/2412) +- Improve shell layer key binding [#2409](https://github.com/SpaceVim/SpaceVim/pull/2409) - Doc: add some tweaks on doc instructions [#2056](https://github.com/SpaceVim/SpaceVim/pull/2056) +- Improve startup experience [#1977](https://github.com/SpaceVim/SpaceVim/pull/1977) +- [issue#2367]: clear rootDir cache after rooter pattern changed [#2370](https://github.com/SpaceVim/SpaceVim/pull/2370) diff --git a/wiki/en/Following-HEAD.md b/wiki/en/Following-HEAD.md index 591e0a499..d5da2926b 100644 --- a/wiki/en/Following-HEAD.md +++ b/wiki/en/Following-HEAD.md @@ -7,21 +7,70 @@ The next release is v1.1.0 - #### New Features -- Add some log for flygrep [#2388](https://github.com/SpaceVim/SpaceVim/pull/2388) +- Add chinese linter to layer chinese [#2473](https://github.com/SpaceVim/SpaceVim/pull/2473) +- Add: zeal layer [#2469](https://github.com/SpaceVim/SpaceVim/pull/2469) +- Add: add a new feature 'format all tables' for markdown. [#2457](https://github.com/SpaceVim/SpaceVim/pull/2457) +- add ctrl - r [#2436](https://github.com/SpaceVim/SpaceVim/pull/2436) +- add mapping to clear quickfix [#2430](https://github.com/SpaceVim/SpaceVim/pull/2430) +- Add alt file plugin [#2416](https://github.com/SpaceVim/SpaceVim/pull/2416) +- Add: coc.nvim integration enhacements [#2415](https://github.com/SpaceVim/SpaceVim/pull/2415) +- Add plugin for git log [#1963](https://github.com/SpaceVim/SpaceVim/pull/1963) #### Bug Fixs +- Fix typo [#2475](https://github.com/SpaceVim/SpaceVim/pull/2475) +- Fix: call fzf#wrap in fzf#run [#2472](https://github.com/SpaceVim/SpaceVim/pull/2472) +- Fix typo: statuline -> statusline [#2451](https://github.com/SpaceVim/SpaceVim/pull/2451) +- fix #2448 [#2450](https://github.com/SpaceVim/SpaceVim/pull/2450) +- Fix runner close job [#2441](https://github.com/SpaceVim/SpaceVim/pull/2441) +- Fix rust runner in windows [#2438](https://github.com/SpaceVim/SpaceVim/pull/2438) +- Fixed: fix typos. [#2437](https://github.com/SpaceVim/SpaceVim/pull/2437) +- Fix lua runner in windows [#2427](https://github.com/SpaceVim/SpaceVim/pull/2427) +- Fix go run support [#2426](https://github.com/SpaceVim/SpaceVim/pull/2426) +- Fixed: fix a typo, there should be a \| between >> and \/\/. [#2423](https://github.com/SpaceVim/SpaceVim/pull/2423) +- Fixed: Fix an alignment error and fix the regular expression. [#2420](https://github.com/SpaceVim/SpaceVim/pull/2420) +- Fix api import [#2418](https://github.com/SpaceVim/SpaceVim/pull/2418) +- fix `docs/cn/layers/lang/vue.md` [#2417](https://github.com/SpaceVim/SpaceVim/pull/2417) +- Fixed: fix typos. [#2413](https://github.com/SpaceVim/SpaceVim/pull/2413) +- Fix docker support [#2406](https://github.com/SpaceVim/SpaceVim/pull/2406) - Fix debug command [#2226](https://github.com/SpaceVim/SpaceVim/pull/2226) +- Fix perl support [#2230](https://github.com/SpaceVim/SpaceVim/pull/2230) - Fix preview in flygrep [#2256](https://github.com/SpaceVim/SpaceVim/pull/2256) #### Unmarked PRs -- Rework faq.md phrasing. [#2386](https://github.com/SpaceVim/SpaceVim/pull/2386) -- Update to v1.1.0-dev [#2382](https://github.com/SpaceVim/SpaceVim/pull/2382) +- Typo dashboard [#2477](https://github.com/SpaceVim/SpaceVim/pull/2477) +- Doc: fix typos. [#2471](https://github.com/SpaceVim/SpaceVim/pull/2471) +- Improve lua support [#2470](https://github.com/SpaceVim/SpaceVim/pull/2470) +- Update about page [#2468](https://github.com/SpaceVim/SpaceVim/pull/2468) +- Update post for FlyGrep [#2465](https://github.com/SpaceVim/SpaceVim/pull/2465) +- implment Ctrl-r to paste from register for flygrep [#2460](https://github.com/SpaceVim/SpaceVim/pull/2460) +- update uncrustify URL link [#2456](https://github.com/SpaceVim/SpaceVim/pull/2456) +- remember cursor position when switch buffer [#2454](https://github.com/SpaceVim/SpaceVim/pull/2454) +- Improve terminal statusline [#2453](https://github.com/SpaceVim/SpaceVim/pull/2453) +- Doc: Correct documentations by ChineseLinter and fix typos. [#2452](https://github.com/SpaceVim/SpaceVim/pull/2452) +- Doc: Correct conventions.md by ChineseLinter and fix some typos. [#2449](https://github.com/SpaceVim/SpaceVim/pull/2449) +- Cosmetics, realign text, remove trailing spaces and tabulation [#2445](https://github.com/SpaceVim/SpaceVim/pull/2445) +- Doc: Fix typos and translate [#2443](https://github.com/SpaceVim/SpaceVim/pull/2443) +- Doc: fix serval typos. [#2442](https://github.com/SpaceVim/SpaceVim/pull/2442) +- Enhance c/c++ layer [#2440](https://github.com/SpaceVim/SpaceVim/pull/2440) +- Install, Fix bad version [#2439](https://github.com/SpaceVim/SpaceVim/pull/2439) +- Use a yellow ⚠ for warnings messages [#2435](https://github.com/SpaceVim/SpaceVim/pull/2435) +- Update statusline support for startify [#2434](https://github.com/SpaceVim/SpaceVim/pull/2434) +- Doc, cosmetics: remove trailing spaces [#2433](https://github.com/SpaceVim/SpaceVim/pull/2433) +- Improve statusline support for gina [#2432](https://github.com/SpaceVim/SpaceVim/pull/2432) +- Doc: fix typo for javascript [#2428](https://github.com/SpaceVim/SpaceVim/pull/2428) +- Jump to test of api [#2424](https://github.com/SpaceVim/SpaceVim/pull/2424) +- patch for #2114 [#2422](https://github.com/SpaceVim/SpaceVim/pull/2422) +- Doc: typo fixes [#2421](https://github.com/SpaceVim/SpaceVim/pull/2421) +- Doc: add description for SPC l k. [#2414](https://github.com/SpaceVim/SpaceVim/pull/2414) +- Website: add vim#command api doc [#2412](https://github.com/SpaceVim/SpaceVim/pull/2412) +- Improve shell layer key binding [#2409](https://github.com/SpaceVim/SpaceVim/pull/2409) - Doc: add some tweaks on doc instructions [#2056](https://github.com/SpaceVim/SpaceVim/pull/2056) +- Improve startup experience [#1977](https://github.com/SpaceVim/SpaceVim/pull/1977) +- [issue#2367]: clear rootDir cache after rooter pattern changed [#2370](https://github.com/SpaceVim/SpaceVim/pull/2370) From 472b71c0855f6dbf1270dda980ba95e6454c5ea1 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Tue, 22 Jan 2019 00:04:36 +0800 Subject: [PATCH 013/179] Add disk explorer for windows (#2165) * Add disk explorer for windows * Update windisk.vim * Fix windows support * add key binding * add functions for manager disk * Use SPC f d only in windows os --- autoload/SpaceVim/layers/core.vim | 3 ++ autoload/SpaceVim/layers/core/statusline.vim | 3 +- autoload/SpaceVim/plugins/windisk.vim | 46 ++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 autoload/SpaceVim/plugins/windisk.vim diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 46635b475..695e248cc 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -170,6 +170,9 @@ function! SpaceVim#layers#core#config() abort \ 'delete-current-buffer-file', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', '/'], 'call SpaceVim#plugins#find#open()', 'find-files', 1) + if s:SYS.isWindows + call SpaceVim#mapping#space#def('nnoremap', ['f', 'd'], 'call SpaceVim#plugins#windisk#open()', 'open-windisk-manager', 1) + endif if g:spacevim_filemanager ==# 'vimfiler' call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler', 'toggle_file_tree', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle', 'show_file_tree', 1) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 5821b1f15..cf2fc6732 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -386,7 +386,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort \ . '%#SpaceVim_statusline_b# LayerManager %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep elseif &filetype ==# 'SpaceVimGitLogPopup' return '%#SpaceVim_statusline_a# Git log popup %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep - + elseif &filetype ==# 'SpaceVimWinDiskManager' + return '%#SpaceVim_statusline_a# WinDisk %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep elseif &filetype ==# 'SpaceVimTodoManager' return '%#SpaceVim_statusline_a# TODO manager %#SpaceVim_statusline_a_SpaceVim_statusline_b#' . s:lsep diff --git a/autoload/SpaceVim/plugins/windisk.vim b/autoload/SpaceVim/plugins/windisk.vim new file mode 100644 index 000000000..19d775ec3 --- /dev/null +++ b/autoload/SpaceVim/plugins/windisk.vim @@ -0,0 +1,46 @@ +"============================================================================= +" windisk.vim --- disk manager for windows +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +func! SpaceVim#plugins#windisk#open() + let disks = s:get_disks() + if !empty(disks) + " 1. open plugin buffer + noautocmd vsplit __windisk__ + vertical resize 20 + let s:disk_buffer_nr = bufnr('%') + set ft=SpaceVimWinDiskManager + setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber winfixwidth + " 2. init buffer option and syntax + let lines = disks + setlocal modifiable + call setline(1, lines) + setlocal nomodifiable + " 2. updated content + " 3. init buffer key bindings + nnoremap :call open_disk(getline('.')) + else + " TODO: print warnning, not sure if it is needed. + endif +endf + +func! s:get_disks() + return map(filter(range(65, 97), "isdirectory(nr2char(v:val) . ':/')"), 'nr2char(v:val) . ":/"') +endf + + +function! s:open_disk(d) abort + call s:close_disk_buffer() + exe 'VimFiler -no-toggle ' . a:d + doautocmd WinEnter +endfunction + + +function! s:close_disk_buffer() abort + exe 'bd ' . s:disk_buffer_nr +endfunction + From f5c8244f2c4411482b978239d3986dd719e0a174 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Tue, 22 Jan 2019 07:50:55 +0800 Subject: [PATCH 014/179] Doc: fix typos. (#2481) --- docs/404.md | 2 +- docs/about.md | 6 +- docs/api.md | 6 +- docs/blog.md | 2 +- docs/community.md | 2 +- docs/conventions.md | 25 +- docs/development.md | 69 ++- docs/documentation.md | 945 +++++++++++++++++++------------------- docs/faq.md | 24 +- docs/index.md | 18 +- docs/layers.md | 170 +++---- docs/quick-start-guide.md | 30 +- docs/sponsors.md | 146 +++--- 13 files changed, 719 insertions(+), 726 deletions(-) diff --git a/docs/404.md b/docs/404.md index 99f60291d..101c9f69c 100644 --- a/docs/404.md +++ b/docs/404.md @@ -11,6 +11,6 @@ permalink: /404 {% else %} ## Oops! The page you requested was not found! -> you can go to [home](https://spacevim.org) or checkout [Blogs](https://spacevim.org/blog/) +> You can go to [home](https://spacevim.org) or checkout [Blogs](https://spacevim.org/blog/) {% endif %} diff --git a/docs/about.md b/docs/about.md index 9ec8f10f0..a1707cef8 100644 --- a/docs/about.md +++ b/docs/about.md @@ -5,14 +5,14 @@ description: "SpaceVim is a community-driven vim distribution with layer feature # About -[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven vim distribution with layer feature. +[SpaceVim](https://github.com/SpaceVim/SpaceVim) is a community-driven Vim distribution with layer feature. SpaceVim manages collections of plugins in layers. Layers make it easy for you, the user, to enable a new language or feature by grouping all the related plugins together. It got inspired by spacemacs. ### Goals -- more IDE-like features in vim and neovim -- better default different languages +- More IDE-like features in Vim and Neovim +- Better default different languages ### Credits & Thanks diff --git a/docs/api.md b/docs/api.md index 642814620..a03a205de 100644 --- a/docs/api.md +++ b/docs/api.md @@ -14,8 +14,8 @@ description: "A list of available APIs in SpaceVim, provide compatible functions #### Introduction -SpaceVim provides many public apis, you can use this apis in your plugins. -This is an example for how to load API, and how to use the public functions within the APIs. +SpaceVim provides many public APIs, you can use these APIs in your plugins. +The following example shows how to load APIs, and how to use the public functions within the APIs. ```vim " use SpaceVim#api#import() to load the API @@ -36,7 +36,7 @@ echom s:file.pathSeparator ## Available APIs -here is the list of all available APIs, and welcome to contribute to SpaceVim. +Here is the list of all available APIs, and welcome to contribute to SpaceVim. | Name | Description | | ------------------------------------- | -------------------------------------------------------------------------------------------------- | diff --git a/docs/blog.md b/docs/blog.md index a3b12cb34..481712e3b 100644 --- a/docs/blog.md +++ b/docs/blog.md @@ -6,7 +6,7 @@ description: "A list of latest blog about the feature of SpaceVim and tutorials # Blog Here you can learn more about SpaceVim with our tutorials and find out what's -going on. feel free to [feed this blog via RSS](../../feed.xml): +going on. Feel free to [feed this blog via RSS](../../feed.xml):
    {% for post in site.categories.blog %} diff --git a/docs/community.md b/docs/community.md index f064bd5b8..a436074db 100644 --- a/docs/community.md +++ b/docs/community.md @@ -33,7 +33,7 @@ Visit these resources for help or general questions. ### Chat All of these channels are bridged together. Click on one of the badges -below to join the chat, In all of these channels, messages from +below to join the chat. In all of these channels, messages from `SpaceVimBot` is sent by remote user, and the format of the remote messages is: diff --git a/docs/conventions.md b/docs/conventions.md index af0c46fa1..c2148fb72 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -39,9 +39,9 @@ description: "conventions of contributing to SpaceVim, including the coding styl ## Commit emoji convention -- `:memo:` Add comment or doc +- `:memo:` Add comment or doc. - `:gift:` New feature. -- `:bug:` Bug fix +- `:bug:` Bug fix. - `:bomb:` Breaking compatibility. - `:white_check_mark:` Write test. - `:fire:` Remove something. @@ -83,7 +83,7 @@ Avoid using :s[ubstitute] as it moves the cursor and prints error messages. Pref The meaning of the g flag depends upon the gdefault setting. If you do use :substitute you must save gdefault, set it to 0 or 1, perform the substitution, and then restore it. -For many vim commands, functions exist that do the same thing with fewer side effects. See :help functions() for a list of built-in functions. +For many Vim commands, functions exist that do the same thing with fewer side effects. See `:help functions` for a list of built-in functions. #### Fragile commands @@ -132,9 +132,9 @@ Use python only when it provides critical functionality, for example when writin #### Other Languages -**Use vimscript instead.** +**Use Vimscript instead.** -Avoid using other scripting languages such as ruby and lua. We can not guarantee that the end user's vim has been compiled with support for non-vimscript languages. +Avoid using other scripting languages such as ruby and lua. We cannot guarantee that the end user's Vim has been compiled with support for non-vimscript languages. #### Plugin layout @@ -198,8 +198,7 @@ Use :setlocal and &l: instead of :set and & unless you have explicit reason to d ### Style -Follow google style conventions. When in doubt, treat vimscript style like -python style. +Follow google style conventions. When in doubt, treat vimscript style like python style. #### Whitespace @@ -247,7 +246,7 @@ such as "noremap gf :grep -f ". When continuing a multi-line command a pipe can be substituted for this space as necessary, as follows: -```viml +```vim autocommand BufEnter \ if !empty(s:var) \| call some#function() @@ -288,11 +287,11 @@ Always prefix variables with their scope. ## Key notations -- use capital case and angle brackets for keyboard button: ``, `` -- use uppercase for custom leader: `SPC`, `WIN`, `UNITE`, `DENITE` -- use space as delimiter for key sequences: `SPC t w`, ` f f` -- use `/` for alternative sequences: `` / `` -- Use `Ctrl-e` instead of `` in documentation +- Use capital case and angle brackets for keyboard buttons: ``, ``. +- Use uppercase for custom leader: `SPC`, `WIN`, `UNITE`, `DENITE`. +- Use space as delimiter for key sequences: `SPC t w`, ` f f`. +- Use `/` for alternative sequences: `` / ``. +- Use `Ctrl-e` rather than `` in documentation. ## Thanks: diff --git a/docs/development.md b/docs/development.md index 3ec2bf387..dc754976c 100644 --- a/docs/development.md +++ b/docs/development.md @@ -30,10 +30,10 @@ description: "General contributing guidelines and changelog of SpaceVim, includi -SpaceVim is an effort of all the volunteers, we encourage you to pitch in. The community makes SpaceVim what it is. -We have a few guidelines, which we ask all contributors to follow. +SpaceVim is an effort of all the volunteers. We encourage you to pitch in. The community makes SpaceVim what it is. +We have a few guidelines which we need all contributors to follow. -Development happens in the GitHub repository. here is a throughput graph of the repository for the last few weeks: +Development happens in the GitHub repository. Here is a throughput graph of the repository for the last few weeks: [![Throughput Graph](https://graphs.waffle.io/SpaceVim/SpaceVim/throughput.svg)](https://waffle.io/SpaceVim/SpaceVim/metrics/throughput) @@ -52,9 +52,9 @@ If you want to ask an usage question, be sure to look first into some places as ## Reporting issues -Issues have to be reported on [issues tracker](https://github.com/SpaceVim/SpaceVim/issues), Please: +Issues have to be reported on [issues tracker](https://github.com/SpaceVim/SpaceVim/issues), please: -- Check that there is no duplicate issue in the issues tracker, you can search for keywords in the issues tracker. +- Check that no duplicate issue is in the issues tracker, you can search for keywords in the issues tracker. - Check that the issue has not been fixed in latest version of SpaceVim, please update your SpaceVim, and try to reproduce the bug here. - Use a clear title and follow the issue template. - Include details on how to reproduce it, just like a step by step guide. @@ -65,7 +65,7 @@ Code contributions are welcome. Please read the following sections carefully. In ### License -The license is GPLv3 for all the parts of SpaceVim. this includes: +The license is GPLv3 for all the parts of SpaceVim. This includes: - The initialization and core files. - All the layer files. @@ -91,32 +91,29 @@ Pull request titles should contain one of these prefix: - `Add:` Adding a new feature. - `Change:` Change default behaviors or the existing features. -- `Fixed:` Fix some bugs +- `Fixed:` Fix some bugs. - `Remove:` Remove any existing features. -- `Doc:` update the help file. +- `Doc:` Update the help file. - `Website:` Update the content of website. Here is an example: -`Website: update the lang#c layer page` +`Website: Update the lang#c layer page.` #### Rebase on top of upstream master -- fork SpaceVim repository -- clone your repository - +- Fork SpaceVim repository +- Clone your repository ```sh git clone ${YOUR_OWN_REPOSITORY_URL} ``` -- add upstream remote - +- Add upstream remote ```sh git remote add upstream https://github.com/SpaceVim/SpaceVim.git ``` -- fetch upstream and rebase on top of upstream master - +- Fetch upstream and rebase on top of upstream master ```sh git fetch upstream git rebase upstream/master @@ -132,7 +129,7 @@ git rebase upstream/master #### For complex PRs -Squash only the commits with uninteresting changes like typos, syntax fixes, etc… and keep the important and isolated steps in different commits. +Squash only the commits with uninteresting changes like typos, syntax fixes, etc. And keep the important and isolated steps in different commits. Those PRs are merged and explicitly not fast-forwarded. @@ -171,19 +168,19 @@ Further paragraphs come after blank lines. - Use a hanging indent ``` -[Gita] provide vim mode for Git commit messages, which helps you to comply to these guidelines. +[Gita] provide Vim mode for Git commit messages, which helps you to comply to these guidelines. ### Contributing a layer Please read the layers documentation first. -Layer with no associated configuration will be rejected. For instance a layer with just a package and a hook can be easily replaced by the usage of the variable `g:spacevim_custom_plugins`. +Layer with no associated configuration will be rejected. For instance a layer with just a package and a hook can be easily replaced by the usage of the variable `custom_plugins`. #### File header -The file header for vim script should look like the following template: +The file header for Vim script should look like the following template: -```viml +```vim "============================================================================= " FILENAME --- NAME layer file for SpaceVim " Copyright (c) 2012-2016 Shidong Wang & Contributors @@ -193,17 +190,17 @@ The file header for vim script should look like the following template: "============================================================================= ``` -You should replace FILENAME by the name of the file (e.g. foo.vim) and NAME by the name of the layer you are creating, don’t forget to replace **YOUR NAME** and **YOUR EMAIL** also. +You should replace FILENAME by the name of the file (e.g. foo.vim) and NAME by the name of the layer you are creating, don’t forget to replace **YOUR NAME** and **YOUR EMAIL** neighter. #### Author of a new layer -In the files header, change the default author name (Shidong Wang) to your name. +In the files header, replace the default author name (Shidong Wang) with your name. -Here is an example for creating a new layer names `foo`: +The following example shows how to create a new layer names `foo`: -1. fork SpaceVim repo -2. add a layer file `autoload/SpaceVim/layers/foo.vim` for `foo` layer. -3. edit layer file, check out the example below: +1. Fork SpaceVim repo. +2. Add a layer file `autoload/SpaceVim/layers/foo.vim` for `foo` layer. +3. Edit layer file, check out the example below: ```vim "============================================================================= @@ -260,28 +257,28 @@ endfunction 4. Add layer document `docs/layers/foo.md` for `foo` layer. 5. Open `docs/layers/index.md`, run `:call SpaceVim#dev#layers#update()` to update layer list. -6. send PR to SpaceVim. +6. Send PR to SpaceVim. #### Contributor to an existing layer -If you are contributing to an already existing layer, you should not modify any header file. +If you want to contribute to an already existing layer, you should not modify any header file. #### Contributing a keybinding Mappings are an important part of SpaceVim. -First if you want to have some personal mappings, This can be done in your `~/.SpaceVim.d/init.vim` file. +First if you want to have some personal mappings. This can be done in your bootstrap function. -If you think it worth contributing a new mappings then be sure to read the documentation to find the best mappings, then create a Pull-Request with your changes. +If you think it worth contributing new mappings, be sure to read the documentation to find the best mappings, then create a Pull-Request with your mappings. ALWAYS document your new mappings or mappings changes inside the relevant documentation file. -It should be the the layer file and the [documentation](../documentation/). +It should be the layername.md and the [documentation](../documentation/). ##### Language specified key bindings -All language specified key bindings are started with `SPC l` prefix. +All language specified key bindings prefix `SPC l`. -we recommended to keep same language specified key bindings for different languages: +We recommend to keep same language specified key bindings for different languages: | Key Binding | Description | | ----------- | ------------------------------------------------ | @@ -295,7 +292,7 @@ we recommended to keep same language specified key bindings for different langua | `SPC l s l` | send line and keep code buffer focused | | `SPC l s s` | send selection text and keep code buffer focused | -All of these above key bindings are just recommended as default, but it also base on the language layer itself. +All above key bindings are just recommended as default, but they also base on the language layer itself. #### Contributing a banner @@ -307,7 +304,7 @@ You are free to choose a reasonable height size but the width size should be aro ## Build with SpaceVim -SpaceVim provide a lot of public [APIs](../api/), you can create plugins base on this APIs. also you can add a badge to the README.md of your plugin. +SpaceVim provide a lot of public [APIs](../api/), you can create plugins base on this APIs. Also you can add a badge to the README.md of your plugin. ![](https://img.shields.io/badge/build%20with-SpaceVim-ff69b4.svg) diff --git a/docs/documentation.md b/docs/documentation.md index e0ac0c1c1..cdaadaf5a 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -26,7 +26,7 @@ description: "General documentation about how to using SpaceVim, including the q - [Font](#font) - [UI Toggles](#ui-toggles) - [Statusline](#statusline) - - [tabline](#tabline) + - [Tabline](#tabline) - [General Key bindings](#general-key-bindings) - [Window manager](#window-manager) - [File Operations](#file-operations) @@ -111,7 +111,7 @@ Innovative real-time display of available key bindings. Simple query system to q **Consistent** -Similar functionalities have the same key binding everywhere thanks to a clearly defined set of conventions. Documentation is mandatory for any layer that ships with SpaceVim. +Similar functionalities have the same key bindings everywhere thanks to a clearly defined set of conventions. Documentation is mandatory for any layer that ships with SpaceVim. **Crowd-Configured** @@ -144,11 +144,11 @@ Depicts a common frontend development scenario with JavaScript (jQuery), SASS, a Non-code buffers show a Neovim terminal, a TagBar window, a Vimfiler window and a TernJS definition window. -to get more screenshots, see: [issue #415](https://github.com/SpaceVim/SpaceVim/issues/415) +To get more screenshots, see: [issue #415](https://github.com/SpaceVim/SpaceVim/issues/415) ## Who can benefit from this? -- **Elementary** vim users. +- **Elementary** Vim users. - Vim users pursuing a beautiful appearance. - Vim users wanting to lower the [risk of RSI](http://en.wikipedia.org/wiki/Repetitive_strain_injury). - Vim users wanting to learn a different way to edit files. @@ -162,7 +162,7 @@ There are several methods of updating the core files of SpaceVim. It is recommen **Automatic Updates** -NOTE: By default, this feature is disabled, It will slow down the startup of Vim/neovim. If you like this feature, add `let g:spacevim_automatic_update = 1` to your custom configuration file. +NOTE: By default, this feature is disabled. It would slow down the startup of Vim/Neovim. If you like this feature, add `automatic_update = 1` to your custom configuration file. SpaceVim will automatically check for a new version every startup. You have restart Vim after updating. @@ -172,7 +172,7 @@ Use `:SPUpdate SpaceVim` in SpaceVim buffer. This command will open a new buffer **Updating Manually with git** -Yor can close Vim/neovim and update the git repository to update manually: +Yor can close Vim/Neovim and update the git repository to update manually: `git -C ~/.SpaceVim pull`. @@ -188,7 +188,7 @@ Use `:SPDebugInfo!` command to display the log of SpaceVim. You also can use `SP The very first time SpaceVim starts up, it will ask you to choose a mode, then it will create a `SpaceVim.d/init.toml` in your `HOME` directory. All User configurations can be stored in your `~/.SpaceVim.d` directory. -`~/.SpaceVim.d/` will be added to `&runtimepath` of vim. +`~/.SpaceVim.d/` will be added to `&runtimepath` of Vim. It is also possible to override the location of `~/.SpaceVim.d/` using the environment variable `SPACEVIMDIR`. Of course you can also use symlinks to change the location of @@ -198,7 +198,7 @@ SpaceVim also support local config file for project, the init file is `.SpaceVim in the root of your project. `.SpaceVim.d/` will also be added into runtimepath. All SpaceVim options can be found in `:h SpaceVim-config`, the key is same as -the option name(just remove `g:spacevim_` prefix). +the option name with the prefix `g:spacevim_` being removed. Comprehensive documentation is available for each layer by `:h SpaceVim`. @@ -210,14 +210,14 @@ If you want to add plugins from github, just add the repo name to the `custom_pl [[custom_plugins]] name = "lilydjwg/colorizer" on_cmd = ["ColorHighlight", "ColorToggle"] - merged = 0 + merged = false ``` -`on_cmd` option means this plugin will be loaded only when the following commands are called. for more options see `:h dein-options` +`on_cmd` option means this plugin will be loaded only when the following commands are called. For more options see `:h dein-options`. **disable existing plugins** -if you want to disable plugins which are added by SpaceVim, you can use SpaceVim `disabled_plugins` options: +If you want to disable plugins which are added by SpaceVim, you can use SpaceVim `disabled_plugins` options: ```toml [options] @@ -232,26 +232,26 @@ SpaceVim provides two kinds of bootstrap functions for custom configurations and The bootstrap functions should be placed to the `autoload` directory in `runtimepath`, please refer to `:h autoload-functions` for further instructions. In our case, create file `.SpaceVim.d/autoload/myspacevim.vim` with contents for example ```vim -func! myspacevim#before() abort +function! myspacevim#before() abort let g:neomake_enabled_c_makers = ['clang'] nnoremap jk -endf +endfunction -func! myspacevim#after() abort +function! myspacevim#after() abort iunmap jk -endf +endfunction ``` -the `bootstrap_before` will be called after custom configuration file is loaded. and the `bootstrap_after` will -be called after VimEnter autocmd. +The `bootstrap_before` will be called after custom configuration file is loaded. +And the `bootstrap_after` will be called after VimEnter autocmd. If you want to add custom `SPC` prefix key bindings, you can add them to bootstrap function, **be sure** the key bindings are not used in SpaceVim. ```vim -func! myspacevim#before() abort +function! myspacevim#before() abort call SpaceVim#custom#SPCGroupName(['G'], '+TestGroup') call SpaceVim#custom#SPC('nore', ['G', 't'], 'echom 1', 'echomessage 1', 1) -endf +endfunction ``` ### Vim compatible mode @@ -260,15 +260,15 @@ The different key bindings between SpaceVim and origin vim are shown as below. - 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 option is `g:spacevim_windows_leader`, default value is `s`. +The option is `windows_leader`, default value is `s`. - The `,` key does repeat last `f`, `F`, `t` and `T` in vim, but in SpaceVim it is the language specified Leader key. -The option is `g:spacevim_enable_language_specific_leader`, default value is `1`. +The option is `enable_language_specific_leader`, default value is `1`. - The `q` key does recording, but in SpaceVim it is used for closing window smart. If you still prefer the origin function of `q`, you can use an empty string to disable this feature. -The option is `g:spacevim_windows_smartclose`, default value is `q`. +The option is `windows_smartclose`, default value is `q`. - The `Ctrl-a` binding on the command line can auto-complete variable names, but in SpaceVim it moves to the cursor to the beginning of the command line. - `Ctrl-b` in command line mode is mapped to ``, which will move cursor to the left. @@ -305,21 +305,17 @@ In SpaceVim, a layer is a single file. In a layer, for example, `autocomplete` l ### Debug upstream plugins -If you found one of the built-in plugins has bugs, and you want to debug that plugin. you can follow these steps: +If you found one of the built-in plugins has bugs, and you want to debug that plugin. You can follow these steps: 1. Disable this plugin - -For example, disable neomake.vim: - +Take disabling neomake.vim for instance: ```toml -[option] +[options] disabled_plugins = ["neomake.vim"] ``` 2. Add a forked plugin or add a local plugin - Use toml file to add custom forked plugins: - ```toml [[custom_plugins]] name = "wsdjeg/neomake.vim" @@ -328,7 +324,6 @@ Use toml file to add custom forked plugins: ``` Use the `bootstrap_before` function to add local plugin: - ```vim function! myspacevim#before() abort set rtp+=~/path/to/your/localplugin @@ -372,7 +367,7 @@ the variable colorschemes. For instance, to specify `desert`: colorscheme_bg = "dark" ``` -| Mappings | Description | +| Mappings | Descriptions | | --------- | -------------------------------------------------------------- | | `SPC T n` | switch to next random colorscheme listed in colorscheme layer. | | `SPC T s` | select a theme using a unite buffer. | @@ -382,7 +377,7 @@ All the included colorschemes can be found in [colorscheme layer](../layers/colo **NOTE**: SpaceVim uses true colors by default, so you should make sure your terminal supports true colors. -for more information see: [Colours in terminal](https://gist.github.com/XVilka/8346728). +For more information see: [Colours in terminal](https://gist.github.com/XVilka/8346728). If your terminal does not support true colors, you can disable SpaceVim true colors feature in `[options]` section: @@ -392,8 +387,8 @@ If your terminal does not support true colors, you can disable SpaceVim true col ### Font -The default font used by SpaceVim is [SauceCodePro Nerd Font Mono](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/SourceCodePro.zip). It is recommended -to install it on your system if you wish to use it. +The default font used by SpaceVim is [SauceCodePro Nerd Font Mono](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/SourceCodePro.zip). +It is recommended to install it on your system if you wish to use it. To change the default font set the variable `guifont` in your `~/.SpaceVim.d/init.toml` file. By default its value is: @@ -408,24 +403,24 @@ Also note that changing this value has no effect if you are running Vim/Neovim i Some UI indicators can be toggled on and off (toggles start with t and T): -| Key Binding | Description | -| ----------- | -------------------------------------------------------- | -| `SPC t 8` | highlight any character past the 80th column | -| `SPC t f` | display the fill column (by default `max_column` is 120) | -| `SPC t h h` | toggle highlight of the current line | -| `SPC t h i` | toggle highlight indentation levels (TODO) | -| `SPC t h c` | toggle highlight indentation current column | -| `SPC t h s` | toggle syntax highlighting | -| `SPC t i` | toggle indentation guide at point | -| `SPC t n` | toggle line numbers | -| `SPC t b` | toggle background | -| `SPC t c` | toggle conceal | -| `SPC t t` | open tabs manager | -| `SPC T ~` | display ~ in the fringe on empty lines | -| `SPC T F` | toggle frame fullscreen | -| `SPC T f` | toggle display of the fringe | -| `SPC T m` | toggle menu bar | -| `SPC T t` | toggle tool bar | +| Key Bindings | Descriptions | +| ------------ | -------------------------------------------------------- | +| `SPC t 8` | highlight any character past the 80th column | +| `SPC t f` | display the fill column (by default `max_column` is 120) | +| `SPC t h h` | toggle highlight of the current line | +| `SPC t h i` | toggle highlight indentation levels (TODO) | +| `SPC t h c` | toggle highlight indentation current column | +| `SPC t h s` | toggle syntax highlighting | +| `SPC t i` | toggle indentation guide at point | +| `SPC t n` | toggle line numbers | +| `SPC t b` | toggle background | +| `SPC t c` | toggle conceal | +| `SPC t t` | open tabs manager | +| `SPC T ~` | display ~ in the fringe on empty lines | +| `SPC T F` | toggle frame fullscreen | +| `SPC T f` | toggle display of the fringe | +| `SPC T m` | toggle menu bar | +| `SPC T t` | toggle tool bar | ### Statusline @@ -440,7 +435,7 @@ The `core#statusline` layer provides a heavily customized powerline with the fol - toggle minor mode lighters - show VCS information (branch, hunk summary) (need `git` and `VersionControl` layer) -| Key bindings | Description | +| Key Bindings | Descriptions | | ------------ | -------------------------------------------- | | `SPC [1-9]` | jump to the windows with the specific number | @@ -457,18 +452,18 @@ All the colors based on the current colorscheme Some elements can be dynamically toggled: -| Key Binding | Description | -| ----------- | ------------------------------------------------------------------- | -| `SPC t m b` | toggle the battery status (need to install acpi) | -| `SPC t m c` | toggle the org task clock (available in org layer)(TODO) | -| `SPC t m m` | toggle the minor mode lighters | -| `SPC t m M` | toggle the major mode | -| `SPC t m n` | toggle the cat! (if colors layer is declared in your dotfile)(TODO) | -| `SPC t m p` | toggle the cursor position | -| `SPC t m t` | toggle the time | -| `SPC t m d` | toggle the date | -| `SPC t m T` | toggle the mode line itself | -| `SPC t m v` | toggle the version control info | +| Key Bindings | Descriptions | +| ------------ | ------------------------------------------------------------------- | +| `SPC t m b` | toggle the battery status (need to install acpi) | +| `SPC t m c` | toggle the org task clock (available in org layer)(TODO) | +| `SPC t m m` | toggle the minor mode lighters | +| `SPC t m M` | toggle the major mode | +| `SPC t m n` | toggle the cat! (If colors layer is declared in your dotfile)(TODO) | +| `SPC t m p` | toggle the cursor position | +| `SPC t m t` | toggle the time | +| `SPC t m d` | toggle the date | +| `SPC t m T` | toggle the mode line itself | +| `SPC t m v` | toggle the version control info | **nerd font installation:** @@ -506,7 +501,7 @@ It is possible to easily customize the statusline separator by setting the `stat statusline_separator = 'arrow' ``` -here is an exhaustive set of screenshots for all the available separator: +Here is an exhaustive set of screenshots for all the available separator: | Separator | Screenshot | | --------- | ------------------------------------------------------------------------------------------------------------------------- | @@ -518,24 +513,23 @@ here is an exhaustive set of screenshots for all the available separator: **Minor Modes:** -The minor mode area can be toggled on and off with `SPC t m m` +The minor mode area can be toggled on and off with `SPC t m m`. Unicode symbols are displayed by default. Add `statusline_unicode_symbols = false` to your custom configuration file, statusline will display ASCII characters instead (may be useful in terminal if you cannot set an appropriate font). The letters displayed in the statusline correspond to the key bindings used to toggle them. -| Key Binding | Unicode | ASCII | Mode | -| ----------- | ------- | ----- | --------------------------------------------- | -| `SPC t 8` | ⑧ | 8 | toggle highlight of characters for long lines | -| `SPC t f` | ⓕ | f | fill-column-indicator mode | -| `SPC t s` | ⓢ | s | syntax checking (neomake) | -| `SPC t S` | Ⓢ | S | enabled in spell checking | -| `SPC t w` | ⓦ | w | whitespace mode | +| Key Bindings | Unicode | ASCII | Mode | +| ------------ | ------- | ----- | --------------------------------------------- | +| `SPC t 8` | ⑧ | 8 | toggle highlight of characters for long lines | +| `SPC t f` | ⓕ | f | fill-column-indicator mode | +| `SPC t s` | ⓢ | s | syntax checking (neomake) | +| `SPC t S` | Ⓢ | S | enabled in spell checking | +| `SPC t w` | ⓦ | w | whitespace mode | **colorscheme of statusline:** -By default SpaceVim only support colorschemes which has -been included in [colorscheme layer](../layers/colorscheme/). +By default SpaceVim only support colorschemes which has been included in [colorscheme layer](../layers/colorscheme/). If you want to contribute theme please check the template of a statusline theme. @@ -576,8 +570,8 @@ endfunction ``` This example is the gruvbox colorscheme, if you want to use same colors when -switch between different colorschemes, you may need to set -`custom_color_palette` in your custom configuration file. for example: +switching between different colorschemes, you may need to set +`custom_color_palette` in your custom configuration file. For example: ```toml custom_color_palette = [ @@ -593,14 +587,14 @@ custom_color_palette = [ ] ``` -### tabline +### Tabline -Buffers will be listed on tabline if there is only one tab, each item contains +Buffers will be listed on the tabline if there is only one tab, each item contains the index, bufname and the filetype icon. If there are more than one tab, all -tabs will be listed on the tabline. each item can be quickly accessed using -` number`. default `` is `\`. +tabs will be listed on the tabline. Each item can be quickly accessed by using +` number`. Default `` is `\`. -| Key Binding | Description | +| Key Bindings | Descriptions | | ------------ | -------------------------- | | ` 1` | Jump to index 1 on tabline | | ` 2` | Jump to index 2 on tabline | @@ -614,9 +608,9 @@ tabs will be listed on the tabline. each item can be quickly accessed using SpaceVim tabline also supports mouse click, left mouse button will switch to buffer, while middle button will delete the buffer. -**NOTE:** This feature is only supported in neovim with `has('tablineat')`. +**NOTE:** This feature is only supported in Neovim with `has('tablineat')`. -| Key Binding | Description | +| Key Bindings | Descriptions | | ---------------- | ------------------ | | `` | Jump to the buffer | | `` | Delete the buffer | @@ -627,7 +621,7 @@ You can also use `SPC t t` to open the tab manager windows. Key bindings within tab manager windows: -| Key Binding | Description | +| Key Bindings | Descriptions | | ----------------- | ----------------------------------------- | | `o` | Close or expand tab windows. | | `r` | Rename the tab under the cursor. | @@ -642,7 +636,7 @@ Key bindings within tab manager windows: ### Window manager -Windows manager key bindings can only be used in normal mode. The default leader `[WIN]` is `s`, you +Window manager key bindings can only be used in normal mode. The default leader `[WIN]` is `s`, you can change it via `windows_leader` option: ```toml @@ -650,7 +644,7 @@ can change it via `windows_leader` option: windows_leader = "s" ``` -| Key bindings | Description | +| Key Bindings | Descriptions | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `q` | Smart buffer close | | `WIN p` | Split nicely | @@ -670,7 +664,7 @@ SpaceVim has mapped normal `q` as smart buffer close, the normal func of `q` can be get by ` q r`, if you want to disable this feature, you can use `vimcompatible` mode. | Key | Mode | Action | -| ----------------- | :-----------: | ------------------------------------------------------------------------------ | +| ----------------- | ------------- | ------------------------------------------------------------------------------ | | ` y` | visual | Copy selection to X11 clipboard ("+y) | | `Ctrl-c` | Normal | Copy full path of current buffer to X11 clipboard | | ` Ctrl-c` | Normal | Copy github.com url of current buffer to X11 clipboard(if it is a github repo) | @@ -696,7 +690,7 @@ can be get by ` q r`, if you want to disable this feature, you can use ` ### File Operations -| Key binding | Description | +| Key Bindings | Descriptions | | -------------- | ------------------------------------------ | | ` c d` | Switch to the directory of the open buffer | | `SPC f s` | Write (:w) | @@ -705,14 +699,14 @@ can be get by ` q r`, if you want to disable this feature, you can use ` ### Editor UI -| Key binding | Description | +| Key Bindings | Descriptions | | --------------------- | ---------------------------------------------------------------- | | `` | Toggle tagbar | | `` | Toggle Vimfiler | | ` [1-9]` | Jump to the buffer with the num index | -| `Alt-[1-9]` | Jump to the buffer with the num index, this only works in neovim | -| `Alt-h` / `Alt-Left` | Jump to left buffer in the tabline, this only works in neovim | -| `Alt-l` / `Alt-Right` | Jump to Right buffer in the tabline, this only works in neovim | +| `Alt-[1-9]` | Jump to the buffer with the num index, this only works in Neovim | +| `Alt-h` / `Alt-Left` | Jump to left buffer in the tabline, this only works in Neovim | +| `Alt-l` / `Alt-Right` | Jump to Right buffer in the tabline, this only works in Neovim | | `SPC t S` | Toggle spell checker | | `SPC t n` | Toggle line number and relativenumber | | `SPC t l` | Toggle hidden characters (:setlocal nolist!) | @@ -731,8 +725,8 @@ can be get by ` q r`, if you want to disable this feature, you can use ` ### Native functions -| Key | Mode | Action | -| ---------------- | :----: | --------------------------------- | +| Key bindings | Mode | Action | +| ---------------- | ------ | --------------------------------- | | ` q r` | Normal | Same as native `q` | | ` q r /` | Normal | Same as native `q /`, open cmdwin | | ` q r ?` | Normal | Same as native `q ?`, open cmdwin | @@ -740,21 +734,21 @@ can be get by ` q r`, if you want to disable this feature, you can use ` ### Bookmarks management -Bookmarks manager are included in `tools` layer, to use following key bindings, you need to enable +Bookmarks manager is included in `tools` layer, to use following key bindings, you need to enable `tools` layer: ```toml [[layers]] - name = "tools" + name = "tools" ``` -| Key binding | Description | -| ----------- | ------------------------------- | -| `m a` | Show list of all bookmarks | -| `m m` | Toggle bookmark in current line | -| `m n` | Jump to next bookmark | -| `m p` | Jump to previous bookmark | -| `m i` | Annotate bookmark | +| Key Bindings | Descriptions | +| ------------ | ------------------------------- | +| `m a` | Show list of all bookmarks | +| `m m` | Toggle bookmark in current line | +| `m n` | Jump to next bookmark | +| `m p` | Jump to previous bookmark | +| `m i` | Annotate bookmark | As SpaceVim use above bookmarks mappings, so you cannot use `a`, `m`, `n`, `p` or `i` registers to mark current position, but other registers should work well. If you really need to use these registers, you can add `nnoremap m m` to your custom configuration, then you can use `a` registers via `\ma`. @@ -798,7 +792,7 @@ But in current version of SpaceVim, leaderf/ctrlp and fzf layer have not be fini **Key bindings within fuzzy finder buffer** -| key bindings | description | +| Key Bindings | Descriptions | | ---------------------- | ----------------------------------------- | | `` / `Ctrl-j` | Select next line | | `Shift-Tab` / `Ctrl-k` | Select previous line | @@ -812,7 +806,7 @@ But in current version of SpaceVim, leaderf/ctrlp and fzf layer have not be fini **Denite/Unite normal mode key bindings** -| key bindings | Mode | description | +| Key Bindings | Mode | Descriptions | | -------------- | ------------- | ------------------------------------ | | `Ctrl-h/k/l/r` | Normal | Un-map | | `Ctrl-l` | Normal | Redraw | @@ -829,21 +823,21 @@ The above key bindings are only part of fuzzy finder layers, please read the lay **Mappings guide** -A guide buffer is displayed each time the prefix key is pressed in normal mode. It lists the available key bindings and their short description. +A guide buffer is displayed each time the prefix key is pressed in normal mode. It lists the available key bindings and their short descriptions. The prefix can be `[SPC]`, `[WIN]` and ``. -The default key of these prefixs are: +The default keys of these prefixs are: -| Prefix name | custom option and default value | description | -| ----------- | ------------------------------- | ----------------------------------- | -| `[SPC]` | NONE / `` | default mapping prefix of SpaceVim | -| `[WIN]` | `windows_leader` / `s` | window mapping prefix of SpaceVim | -| `` | default vim leader | default leader prefix of vim/neovim | +| Prefix name | Custom options and default values | Descriptions | +| ----------- | --------------------------------- | ----------------------------------- | +| `[SPC]` | NONE / `` | default mapping prefix of SpaceVim | +| `[WIN]` | `windows_leader` / `s` | window mapping prefix of SpaceVim | +| `` | default vim leader | default leader prefix of vim/Neovim | -By default the guide buffer will be displayed 1000ms after the key has been pressed. +By default the guide buffer will be displayed 1000ms after the keys being pressed. You can change the delay by setting `'timeoutlen'` option to your liking (the value is in milliseconds). -For example, after pressing `` in normal mode, you will see : +For example, after pressing `` in normal mode, you will see: ![mapping-guide](https://cloud.githubusercontent.com/assets/13142418/25778673/ae8c3168-3337-11e7-8536-ee78d59e5a9c.png) @@ -851,11 +845,11 @@ This guide shows you all the available key bindings begin with `[SPC]`, you can After pressing `Ctrl-h` in guide buffer, you will get paging and help info in the statusline. -| key | description | -| --- | ----------------------------- | -| `u` | undo pressing | -| `n` | next page of guide buffer | -| `p` | previous page of guide buffer | +| Keys | Descriptions | +| ---- | ----------------------------- | +| `u` | undo pressing | +| `n` | next page of guide buffer | +| `p` | previous page of guide buffer | Use `SpaceVim#custom#SPC()` to define custom SPC mappings. For instance: @@ -867,7 +861,7 @@ call SpaceVim#custom#SPC('nnoremap', ['f', 't'], 'echom "hello world"', 'test cu It is possible to search for specific key bindings by pressing `?` in the root of guide buffer. -To narrow the list, just insert the mapping keys or description of what mapping you want, Unite/Denite will fuzzy find the mappings, to find buffer related mappings: +To narrow the list, just insert the mapping keys or descriptions of what mappings you want, Unite/Denite will fuzzy find the mappings, to find buffer related mappings: ![unite-mapping](https://cloud.githubusercontent.com/assets/13142418/25779196/2f370b0a-3345-11e7-977c-a2377d23286e.png) @@ -875,22 +869,22 @@ Then use `` or `` and `` to select the mapping, press `` t #### Getting help -fuzzy finder layer is powerful tool to unite all interfaces. it was meant to be -like [Helm](https://github.com/emacs-helm/helm) for Vim. These mappings is for +Fuzzy finder layer is powerful tool to unite all interfaces. It is meant to be +like [Helm](https://github.com/emacs-helm/helm) for Vim. These mappings are for getting help info about functions, variables etc: -| Mappings | Description | -| ----------- | ----------------------------------------------------------------------------- | -| `SPC h SPC` | discover SpaceVim documentation, layers and packages using fuzzy finder layer | -| `SPC h i` | get help with the symbol at point | -| `SPC h k` | show top-level bindings with which-key | -| `SPC h m` | search available man pages | +| Key Bindings | Descriptions | +| ------------ | ----------------------------------------------------------------------------- | +| `SPC h SPC` | discover SpaceVim documentation, layers and packages using fuzzy finder layer | +| `SPC h i` | get help with the symbol at point | +| `SPC h k` | show top-level bindings with which-key | +| `SPC h m` | search available man pages | Reporting an issue: -| Mappings | Description | -| --------- | ----------------------------------------------------------- | -| `SPC h I` | Open SpaceVim GitHub issue page with pre-filled information | +| Key Bindings | Descriptions | +| ------------ | ----------------------------------------------------------- | +| `SPC h I` | Open SpaceVim GitHub issue page with pre-filled information | #### Available layers @@ -910,17 +904,17 @@ Both the toggles mappings start with `[SPC] t` or `[SPC] T`. You can find them i Navigation is performed using the Vi key bindings `hjkl`. -| Key Binding | Description | -| ----------- | --------------------------------------------------------------------------------- | -| `h` | move cursor left (origin vim key, no mappings) | -| `j` | move cursor down (origin vim key, no mappings) | -| `k` | move cursor up (origin vim key, no mappings) | -| `l` | move cursor right (origin vim key, no mappings) | -| `H` | move cursor to the top of the screen (origin vim key, no mappings) | -| `L` | move cursor to the bottom of the screen (origin vim key, no mappings) | -| `SPC j 0` | go to the beginning of line (and set a mark at the previous location in the line) | -| `SPC j $` | go to the end of line (and set a mark at the previous location in the line) | -| `SPC t -` | lock the cursor at the center of the screen | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------------------------------------------------- | +| `h` | move cursor left (origin Vim key, no mappings) | +| `j` | move cursor down (origin Vim key, no mappings) | +| `k` | move cursor up (origin Vim key, no mappings) | +| `l` | move cursor right (origin Vim key, no mappings) | +| `H` | move cursor to the top of the screen (origin Vim key, no mappings) | +| `L` | move cursor to the bottom of the screen (origin Vim key, no mappings) | +| `SPC j 0` | go to the beginning of line (and set a mark at the previous location in the line) | +| `SPC j $` | go to the end of line (and set a mark at the previous location in the line) | +| `SPC t -` | lock the cursor at the center of the screen | #### Vim motions with vim-easymotion @@ -930,13 +924,13 @@ Navigation is performed using the Vi key bindings `hjkl`. Similar to easymotion or `f` in vimperator for firefox, this mode allows one to jump to any link in help file with two key strokes. -| mapping | description | -| ------- | -------------------------------------------- | -| `o` | initiate quick jump link mode in help buffer | +| Mappings | Descriptions | +| -------- | -------------------------------------------- | +| `o` | initiate quick jump link mode in help buffer | #### Unimpaired bindings -| Mappings | Description | +| Mappings | Descriptions | | -------- | ------------------------------------------------------- | | `[ SPC` | Insert space above | | `] SPC` | Insert space below | @@ -966,35 +960,35 @@ The `SPC j` prefix is for jumping, joining and splitting. ##### Jumping -| Key Binding | Description | -| ----------- | --------------------------------------------------------------------------------- | -| `SPC j 0` | go to the beginning of line (and set a mark at the previous location in the line) | -| `SPC j $` | go to the end of line (and set a mark at the previous location in the line) | -| `SPC j b` | jump backward | -| `SPC j f` | jump forward | -| `SPC j d` | jump to a listing of the current directory | -| `SPC j D` | jump to a listing of the current directory (other window) | -| `SPC j i` | jump to a definition in buffer (denite outline) | -| `SPC j I` | jump to a definition in any buffer (denite outline) | -| `SPC j j` | jump to a character in the buffer (easymotion) | -| `SPC j J` | jump to a suite of two characters in the buffer (easymotion) | -| `SPC j k` | jump to next line and indent it using auto-indent rules | -| `SPC j l` | jump to a line with avy (easymotion) | -| `SPC j q` | show the dumb-jump quick look tooltip (TODO) | -| `SPC j u` | jump to a URL in the current window | -| `SPC j v` | jump to the definition/declaration of an Emacs Lisp variable (TODO) | -| `SPC j w` | jump to a word in the current buffer (easymotion) | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------------------------------------------------- | +| `SPC j 0` | go to the beginning of line (and set a mark at the previous location in the line) | +| `SPC j $` | go to the end of line (and set a mark at the previous location in the line) | +| `SPC j b` | jump backward | +| `SPC j f` | jump forward | +| `SPC j d` | jump to a listing of the current directory | +| `SPC j D` | jump to a listing of the current directory (other window) | +| `SPC j i` | jump to a definition in buffer (denite outline) | +| `SPC j I` | jump to a definition in any buffer (denite outline) | +| `SPC j j` | jump to a character in the buffer (easymotion) | +| `SPC j J` | jump to a suite of two characters in the buffer (easymotion) | +| `SPC j k` | jump to next line and indent it using auto-indent rules | +| `SPC j l` | jump to a line with avy (easymotion) | +| `SPC j q` | show the dumb-jump quick look tooltip (TODO) | +| `SPC j u` | jump to a URL in the current window | +| `SPC j v` | jump to the definition/declaration of an Emacs Lisp variable (TODO) | +| `SPC j w` | jump to a word in the current buffer (easymotion) | ##### Joining and splitting -| Key Binding | Description | -| ----------- | ------------------------------------------------------------------------ | -| `J` | join the current line with the next line | -| `SPC j k` | go to next line and indent it using auto-indent rules | -| `SPC j n` | split the current line at point, insert a new line and auto-indent | -| `SPC j o` | split the current line at point but let point on current line | -| `SPC j s` | split a quoted string or s-expression in place | -| `SPC j S` | split a quoted string or s-expression, insert a new line and auto-indent | +| Key Bindings | Descriptions | +| ------------ | ------------------------------------------------------------------------ | +| `J` | join the current line with the next line | +| `SPC j k` | go to next line and indent it using auto-indent rules | +| `SPC j n` | split the current line at point, insert a new line and auto-indent | +| `SPC j o` | split the current line at point but let point on current line | +| `SPC j s` | split a quoted string or s-expression in place | +| `SPC j S` | split a quoted string or s-expression, insert a new line and auto-indent | #### Window manipulation @@ -1002,21 +996,21 @@ The `SPC j` prefix is for jumping, joining and splitting. Every window has a number displayed at the start of the statusline and can be quickly accessed using `SPC number`. -| Key Binding | Description | -| ----------- | --------------------- | -| `SPC 1` | go to window number 1 | -| `SPC 2` | go to window number 2 | -| `SPC 3` | go to window number 3 | -| `SPC 4` | go to window number 4 | -| `SPC 5` | go to window number 5 | -| `SPC 6` | go to window number 6 | -| `SPC 7` | go to window number 7 | -| `SPC 8` | go to window number 8 | -| `SPC 9` | go to window number 9 | +| Key Bindings | Descriptions | +| ------------ | --------------------- | +| `SPC 1` | go to window number 1 | +| `SPC 2` | go to window number 2 | +| `SPC 3` | go to window number 3 | +| `SPC 4` | go to window number 4 | +| `SPC 5` | go to window number 5 | +| `SPC 6` | go to window number 6 | +| `SPC 7` | go to window number 7 | +| `SPC 8` | go to window number 8 | +| `SPC 9` | go to window number 9 | Windows manipulation commands (start with `w`): -| Key Binding | Description | +| Key Bindings | Descriptions | | -------------------- | ------------------------------------------------------------------------------------------------------------- | | `SPC w TAB` | switch to alternate window in the current frame (switch back and forth) | | `SPC w =` | balance split windows | @@ -1060,7 +1054,7 @@ Windows manipulation commands (start with `w`): Buffer manipulation commands (start with `b`): -| Key Binding | Description | +| Key Bindings | Descriptions | | --------------- | ------------------------------------------------------------------------------ | | `SPC TAB` | switch to alternate buffer in the current window (switch back and forth) | | `SPC b .` | buffer transient state | @@ -1086,13 +1080,13 @@ Buffer manipulation commands (start with `b`): ##### Create a new empty buffer -| Key Binding | Description | -| ----------- | ----------------------------------------------------- | -| `SPC b N h` | create new empty buffer in a new window on the left | -| `SPC b N j` | create new empty buffer in a new window at the bottom | -| `SPC b N k` | create new empty buffer in a new window above | -| `SPC b N l` | create new empty buffer in a new window below | -| `SPC b N n` | create new empty buffer in current window | +| Key Bindings | Descriptions | +| ------------ | ----------------------------------------------------- | +| `SPC b N h` | create new empty buffer in a new window on the left | +| `SPC b N j` | create new empty buffer in a new window at the bottom | +| `SPC b N k` | create new empty buffer in a new window above | +| `SPC b N l` | create new empty buffer in a new window below | +| `SPC b N n` | create new empty buffer in current window | ##### Special Buffers @@ -1102,35 +1096,35 @@ In SpaceVim, there are many special buffers, these buffers are created by plugin Files manipulation commands (start with f): -| Key Binding | Description | -| ----------- | -------------------------------------------------------------- | -| `SPC f /` | Find files with `find` command | -| `SPC f b` | go to file bookmarks | -| `SPC f c` | copy current file to a different location(TODO) | -| `SPC f C d` | convert file from unix to dos encoding | -| `SPC f C u` | convert file from dos to unix encoding | -| `SPC f D` | delete a file and the associated buffer (ask for confirmation) | -| `SPC f E` | open a file with elevated privileges (sudo layer) (TODO) | -| `SPC f W` | save a file with elevated privileges (sudo layer) | -| `SPC f f` | open file | -| `SPC f F` | try to open the file under point | -| `SPC f o` | open a file using the default external program(TODO) | -| `SPC f R` | rename the current file(TODO) | -| `SPC f s` | save a file | -| `SPC f S` | save all files | -| `SPC f r` | open a recent file | -| `SPC f t` | toggle file tree side bar | -| `SPC f T` | show file tree side bar | -| `SPC f y` | show and copy current file absolute path in the cmdline | +| Key Bindings | Descriptions | +| ------------ | -------------------------------------------------------------- | +| `SPC f /` | Find files with `find` command | +| `SPC f b` | go to file bookmarks | +| `SPC f c` | copy current file to a different location(TODO) | +| `SPC f C d` | convert file from unix to dos encoding | +| `SPC f C u` | convert file from dos to unix encoding | +| `SPC f D` | delete a file and the associated buffer (ask for confirmation) | +| `SPC f E` | open a file with elevated privileges (sudo layer) (TODO) | +| `SPC f W` | save a file with elevated privileges (sudo layer) | +| `SPC f f` | open file | +| `SPC f F` | try to open the file under point | +| `SPC f o` | open a file using the default external program(TODO) | +| `SPC f R` | rename the current file(TODO) | +| `SPC f s` | save a file | +| `SPC f S` | save all files | +| `SPC f r` | open a recent file | +| `SPC f t` | toggle file tree side bar | +| `SPC f T` | show file tree side bar | +| `SPC f y` | show and copy current file absolute path in the cmdline | ##### Vim and SpaceVim files Convenient key bindings are located under the prefix `SPC f v` to quickly navigate between Vim and SpaceVim specific files. -| Key Binding | Description | -| ----------- | --------------------------------------- | -| `SPC f v v` | display and copy SpaceVim version | -| `SPC f v d` | open SpaceVim custom configuration file | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------- | +| `SPC f v v` | display and copy SpaceVim version | +| `SPC f v d` | open SpaceVim custom configuration file | #### File tree @@ -1139,8 +1133,9 @@ And SpaceVim also provides `SPC f t` and `SPC f T` to open the file tree. To replace the file explorer to nerdtree: ```toml -# the default value is vimfiler -filemanager = "nerdtree" +[options] + # The default value is vimfiler. + filemanager = "nerdtree" ``` VCS integration is supported, there will be a column status, this feature maybe make vimfiler slow, so it is not enabled by default. @@ -1153,7 +1148,7 @@ Here is a picture for this feature: Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): -| Key Binding | Description | +| Key Bindings | Descriptions | | ------------------ | ------------------------------------------------- | | `` / `SPC f t` | Toggle file explorer | | `` / `h` | go to parent node and collapse expanded directory | @@ -1179,7 +1174,7 @@ Navigation is centered on the `hjkl` keys with the hope of providing a fast navi If there is only one file buffer opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. -| Key Binding | Description | +| Key Bindings | Descriptions | | -------------- | ----------------------------------------- | | `l` or `Enter` | open file in one window | | `sg` | open file in an vertically split window | @@ -1190,104 +1185,104 @@ If there is only one file buffer opened, a file is opened in the active window, After pressing prefix `g` in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with `g`. -| Key Binding | Description | -| ----------- | ----------------------------------------------- | -| `g #` | search under cursor backward | -| `g $` | go to rightmost character | -| `g &` | repeat last ":s" on all lines | -| `g '` | jump to mark | -| `g *` | search under cursor forward | -| `g +` | newer text state | -| `g ,` | newer position in change list | -| `g -` | older text state | -| `g /` | stay incsearch | -| `g 0` | go to leftmost character | -| `g ;` | older position in change list | -| `g <` | last page of previous command output | -| `g ` | go to leftmost character | -| `g E` | end of previous word | -| `g F` | edit file under cursor(jump to line after name) | -| `g H` | select line mode | -| `g I` | insert text in column 1 | -| `g J` | join lines without space | -| `g N` | visually select previous match | -| `g Q` | switch to Ex mode | -| `g R` | enter VREPLACE mode | -| `g T` | previous tag page | -| `g U` | make motion text uppercase | -| `g ]` | tselect cursor tag | -| `g ^` | go to leftmost no-white character | -| `g _` | go to last char | -| `` g ` `` | jump to mark | -| `g a` | print ascii value of cursor character | -| `g d` | goto definition | -| `g e` | go to end of previous word | -| `g f` | edit file under cursor | -| `g g` | go to line N | -| `g h` | select mode | -| `g i` | insert text after '^ mark | -| `g j` | move cursor down screen line | -| `g k` | move cursor up screen line | -| `g m` | go to middle of screenline | -| `g n` | visually select next match | -| `g o` | goto byte N in the buffer | -| `g s` | sleep N seconds | -| `g t` | next tag page | -| `g u` | make motion text lowercase | -| `g ~` | swap case for Nmove text | -| `g ` | go to rightmost character | -| `g Ctrl-g` | show cursor info | +| Key Bindings | Descriptions | +| ------------ | ----------------------------------------------- | +| `g #` | search under cursor backward | +| `g $` | go to rightmost character | +| `g &` | repeat last ":s" on all lines | +| `g '` | jump to mark | +| `g *` | search under cursor forward | +| `g +` | newer text state | +| `g ,` | newer position in change list | +| `g -` | older text state | +| `g /` | stay incsearch | +| `g 0` | go to leftmost character | +| `g ;` | older position in change list | +| `g <` | last page of previous command output | +| `g ` | go to leftmost character | +| `g E` | end of previous word | +| `g F` | edit file under cursor(jump to line after name) | +| `g H` | select line mode | +| `g I` | insert text in column 1 | +| `g J` | join lines without space | +| `g N` | visually select previous match | +| `g Q` | switch to Ex mode | +| `g R` | enter VREPLACE mode | +| `g T` | previous tag page | +| `g U` | make motion text uppercase | +| `g ]` | tselect cursor tag | +| `g ^` | go to leftmost no-white character | +| `g _` | go to last char | +| `` g ` `` | jump to mark | +| `g a` | print ascii value of cursor character | +| `g d` | goto definition | +| `g e` | go to end of previous word | +| `g f` | edit file under cursor | +| `g g` | go to line N | +| `g h` | select mode | +| `g i` | insert text after '^ mark | +| `g j` | move cursor down screen line | +| `g k` | move cursor up screen line | +| `g m` | go to middle of screenline | +| `g n` | visually select next match | +| `g o` | goto byte N in the buffer | +| `g s` | sleep N seconds | +| `g t` | next tag page | +| `g u` | make motion text lowercase | +| `g ~` | swap case for Nmove text | +| `g ` | go to rightmost character | +| `g Ctrl-g` | show cursor info | ### Commands starting with `z` After pressing prefix `z` in normal mode, if you do not remember the mappings, you will see the guide which will tell you the functional of all mappings starting with `z`. -| Key Binding | Description | -| ----------- | -------------------------------------------- | -| `z ` | scroll screen N characters to left | -| `z +` | cursor to screen top line N | -| `z -` | cursor to screen bottom line N | -| `z .` | cursor line to center | -| `z ` | cursor line to top | -| `z =` | spelling suggestions | -| `z A` | toggle folds recursively | -| `z C` | close folds recursively | -| `z D` | delete folds recursively | -| `z E` | eliminate all folds | -| `z F` | create a fold for N lines | -| `z G` | mark good spelled(update internal-wordlist) | -| `z H` | scroll half a screenwidth to the right | -| `z L` | scroll half a screenwidth to the left | -| `z M` | set `foldlevel` to zero | -| `z N` | set `foldenable` | -| `z O` | open folds recursively | -| `z R` | set `foldlevel` to deepest fold | -| `z W` | mark wrong spelled | -| `z X` | re-apply `foldlevel` | -| `z ^` | cursor to screen bottom line N | -| `z a` | toggle a fold | -| `z b` | redraw, cursor line at bottom | -| `z c` | close a fold | -| `z d` | delete a fold | -| `z e` | right scroll horizontally to cursor position | -| `z f` | create a fold for motion | -| `z g` | mark good spelled | -| `z h` | scroll screen N characters to right | -| `z i` | toggle foldenable | -| `z j` | mode to start of next fold | -| `z k` | mode to end of previous fold | -| `z l` | scroll screen N characters to left | -| `z m` | subtract one from `foldlevel` | -| `z n` | reset `foldenable` | -| `z o` | open fold | -| `z r` | add one to `foldlevel` | -| `z s` | left scroll horizontally to cursor position | -| `z t` | cursor line at top of window | -| `z v` | open enough folds to view cursor line | -| `z x` | re-apply foldlevel and do "zV" | -| `z z` | smart scroll | -| `z ` | scroll screen N characters to right | +| Key Bindings | Descriptions | +| ------------ | -------------------------------------------- | +| `z ` | scroll screen N characters to left | +| `z +` | cursor to screen top line N | +| `z -` | cursor to screen bottom line N | +| `z .` | cursor line to center | +| `z ` | cursor line to top | +| `z =` | spelling suggestions | +| `z A` | toggle folds recursively | +| `z C` | close folds recursively | +| `z D` | delete folds recursively | +| `z E` | eliminate all folds | +| `z F` | create a fold for N lines | +| `z G` | mark good spelled(update internal-wordlist) | +| `z H` | scroll half a screenwidth to the right | +| `z L` | scroll half a screenwidth to the left | +| `z M` | set `foldlevel` to zero | +| `z N` | set `foldenable` | +| `z O` | open folds recursively | +| `z R` | set `foldlevel` to deepest fold | +| `z W` | mark wrong spelled | +| `z X` | re-apply `foldlevel` | +| `z ^` | cursor to screen bottom line N | +| `z a` | toggle a fold | +| `z b` | redraw, cursor line at bottom | +| `z c` | close a fold | +| `z d` | delete a fold | +| `z e` | right scroll horizontally to cursor position | +| `z f` | create a fold for motion | +| `z g` | mark good spelled | +| `z h` | scroll screen N characters to right | +| `z i` | toggle foldenable | +| `z j` | mode to start of next fold | +| `z k` | mode to end of previous fold | +| `z l` | scroll screen N characters to left | +| `z m` | subtract one from `foldlevel` | +| `z n` | reset `foldenable` | +| `z o` | open fold | +| `z r` | add one to `foldlevel` | +| `z s` | left scroll horizontally to cursor position | +| `z t` | cursor line at top of window | +| `z v` | open enough folds to view cursor line | +| `z x` | re-apply foldlevel and do "zV" | +| `z z` | smart scroll | +| `z ` | scroll screen N characters to right | ### Searching @@ -1305,7 +1300,7 @@ The search commands in SpaceVim are organized under the `SPC s` prefix with the If the last key (determining the scope) is uppercase then the current word under the cursor is used as default input for the search. For instance, `SPC s a B` will search the word under cursor. -If the tool key is omitted then a default tool will be automatically selected for the search. This tool corresponds to the first tool found on the system of the list `g:spacevim_search_tools`, the default order is `rg`, `ag`, `pt`, `ack` then `grep`. For instance `SPC s b` will search in the opened buffers using `pt` if `rg` and `ag` have not been found on the system. +If the tool key is omitted then a default tool will be automatically selected for the search. This tool corresponds to the first tool found on the system of the list `search_tools`, the default order is `rg`, `ag`, `pt`, `ack` then `grep`. For instance `SPC s b` will search in the opened buffers using `pt` if `rg` and `ag` have not been found on the system. The tool keys are: @@ -1337,8 +1332,8 @@ Notes: ##### Custom searching tool -To change the options of a search tool, you need to use bootstrap function. Here is an example -how to change the default option of searching tool `rg`. +To change the options of a search tool, you need to use the bootstrap function. +The following example shows how to change the default option of searching tool `rg`. ```vim function! myspacevim#before() abort @@ -1366,7 +1361,7 @@ The structure of searching tool profile is: ##### Useful key bindings -| Key Binding | Description | +| Key Bindings | Descriptions | | --------------- | ----------------------------------------- | | `SPC r l` | resume the last completion buffer | | `` SPC s ` `` | go back to the previous place before jump | @@ -1374,71 +1369,71 @@ The structure of searching tool profile is: ##### Searching in current file -| Key Binding | Description | -| ----------- | --------------------------------------------------- | -| `SPC s s` | search with the first found tool | -| `SPC s S` | search with the first found tool with default input | -| `SPC s a a` | ag | -| `SPC s a A` | ag with default input | -| `SPC s g g` | grep | -| `SPC s g G` | grep with default input | -| `SPC s r r` | rg | -| `SPC s r R` | rg with default input | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------------------- | +| `SPC s s` | search with the first found tool | +| `SPC s S` | search with the first found tool with default input | +| `SPC s a a` | ag | +| `SPC s a A` | ag with default input | +| `SPC s g g` | grep | +| `SPC s g G` | grep with default input | +| `SPC s r r` | rg | +| `SPC s r R` | rg with default input | ##### Searching in buffer directory -| Key Binding | Description | -| ----------- | ----------------------------------------------------------- | -| `SPC s d` | searching in buffer directory with default tool | -| `SPC s D` | searching in buffer directory cursor word with default tool | -| `SPC s a d` | searching in buffer directory with ag | -| `SPC s a D` | searching in buffer directory cursor word with ag | -| `SPC s g d` | searching in buffer directory with grep | -| `SPC s g D` | searching in buffer directory cursor word with grep | -| `SPC s k d` | searching in buffer directory with ack | -| `SPC s k D` | searching in buffer directory cursor word with ack | -| `SPC s r d` | searching in buffer directory with rg | -| `SPC s r D` | searching in buffer directory cursor word with rg | -| `SPC s t d` | searching in buffer directory with pt | -| `SPC s t D` | searching in buffer directory cursor word with pt | +| Key Bindings | Descriptions | +| ------------ | ----------------------------------------------------------- | +| `SPC s d` | searching in buffer directory with default tool | +| `SPC s D` | searching in buffer directory cursor word with default tool | +| `SPC s a d` | searching in buffer directory with ag | +| `SPC s a D` | searching in buffer directory cursor word with ag | +| `SPC s g d` | searching in buffer directory with grep | +| `SPC s g D` | searching in buffer directory cursor word with grep | +| `SPC s k d` | searching in buffer directory with ack | +| `SPC s k D` | searching in buffer directory cursor word with ack | +| `SPC s r d` | searching in buffer directory with rg | +| `SPC s r D` | searching in buffer directory cursor word with rg | +| `SPC s t d` | searching in buffer directory with pt | +| `SPC s t D` | searching in buffer directory cursor word with pt | ##### Searching in all loaded buffers -| Key Binding | Description | -| ----------- | --------------------------------------------------- | -| `SPC s b` | search with the first found tool | -| `SPC s B` | search with the first found tool with default input | -| `SPC s a b` | ag | -| `SPC s a B` | ag with default input | -| `SPC s g b` | grep | -| `SPC s g B` | grep with default input | -| `SPC s k b` | ack | -| `SPC s k B` | ack with default input | -| `SPC s r b` | rg | -| `SPC s r B` | rg with default input | -| `SPC s t b` | pt | -| `SPC s t B` | pt with default input | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------------------- | +| `SPC s b` | search with the first found tool | +| `SPC s B` | search with the first found tool with default input | +| `SPC s a b` | ag | +| `SPC s a B` | ag with default input | +| `SPC s g b` | grep | +| `SPC s g B` | grep with default input | +| `SPC s k b` | ack | +| `SPC s k B` | ack with default input | +| `SPC s r b` | rg | +| `SPC s r B` | rg with default input | +| `SPC s t b` | pt | +| `SPC s t B` | pt with default input | ##### Searching in an arbitrary directory -| Key Binding | Description | -| ----------- | --------------------------------------------------- | -| `SPC s f` | search with the first found tool | -| `SPC s F` | search with the first found tool with default input | -| `SPC s a f` | ag | -| `SPC s a F` | ag with default text | -| `SPC s g f` | grep | -| `SPC s g F` | grep with default text | -| `SPC s k f` | ack | -| `SPC s k F` | ack with default text | -| `SPC s r f` | rg | -| `SPC s r F` | rg with default text | -| `SPC s t f` | pt | -| `SPC s t F` | pt with default text | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------------------- | +| `SPC s f` | search with the first found tool | +| `SPC s F` | search with the first found tool with default input | +| `SPC s a f` | ag | +| `SPC s a F` | ag with default text | +| `SPC s g f` | grep | +| `SPC s g F` | grep with default text | +| `SPC s k f` | ack | +| `SPC s k F` | ack with default text | +| `SPC s r f` | rg | +| `SPC s r F` | rg with default text | +| `SPC s t f` | pt | +| `SPC s t F` | pt with default text | ##### Searching in a project -| Key Binding | Description | +| Key Bindings | Descriptions | | -------------------- | --------------------------------------------------- | | `SPC /` or `SPC s p` | search with the first found tool | | `SPC *` or `SPC s P` | search with the first found tool with default input | @@ -1459,40 +1454,40 @@ The structure of searching tool profile is: Background search keyword in a project, when searching done, the count will be shown on the statusline. -| Key Binding | Description | -| ----------- | ---------------------------------------------------------- | -| `SPC s j` | searching input expr background with the first found tool | -| `SPC s J` | searching cursor word background with the first found tool | -| `SPC s l` | List all searching result in quickfix buffer | -| `SPC s a j` | ag | -| `SPC s a J` | ag with default text | -| `SPC s g j` | grep | -| `SPC s g J` | grep with default text | -| `SPC s k j` | ack | -| `SPC s k J` | ack with default text | -| `SPC s t j` | pt | -| `SPC s t J` | pt with default text | -| `SPC s r j` | rg | -| `SPC s r J` | rg with default text | +| Key Bindings | Descriptions | +| ------------ | ---------------------------------------------------------- | +| `SPC s j` | searching input expr background with the first found tool | +| `SPC s J` | searching cursor word background with the first found tool | +| `SPC s l` | List all searching result in quickfix buffer | +| `SPC s a j` | ag | +| `SPC s a J` | ag with default text | +| `SPC s g j` | grep | +| `SPC s g J` | grep with default text | +| `SPC s k j` | ack | +| `SPC s k J` | ack with default text | +| `SPC s t j` | pt | +| `SPC s t J` | pt with default text | +| `SPC s r j` | rg | +| `SPC s r J` | rg with default text | ##### Searching the web -| Key Binding | Description | -| ----------- | ------------------------------------------------------------------------ | -| `SPC s w g` | Get Google suggestions in vim. Opens Google results in Browser. | -| `SPC s w w` | Get Wikipedia suggestions in vim. Opens Wikipedia page in Browser.(TODO) | +| Key Bindings | Descriptions | +| ------------ | ------------------------------------------------------------------------ | +| `SPC s w g` | Get Google suggestions in Vim. Opens Google results in Browser. | +| `SPC s w w` | Get Wikipedia suggestions in Vim. Opens Wikipedia page in Browser.(TODO) | -**Note**: to enable google suggestions in vim, you need to add `let g:spacevim_enable_googlesuggest = 1` to your custom Configuration file. +**Note**: to enable google suggestions in Vim, you need to add `enable_googlesuggest = 1` to your custom Configuration file. #### Searching on the fly -| Key Binding | Description | -| ----------- | -------------------------------------------------- | -| `SPC s g G` | Searching in project on the fly with default tools | +| Key Bindings | Descriptions | +| ------------ | -------------------------------------------------- | +| `SPC s g G` | Searching in project on the fly with default tools | -key binding in FlyGrep buffer: +Key bindings in FlyGrep buffer: -| Key Binding | Description | +| Key Bindings | Descriptions | | ------------------- | --------------------------------- | | `` | close FlyGrep buffer | | `` | open file at the cursor line | @@ -1507,7 +1502,7 @@ key binding in FlyGrep buffer: #### Persistent highlighting -SpaceVim uses `g:spacevim_search_highlight_persist` to keep the searched expression highlighted until the next search. It is also possible to clear the highlighting by pressing `SPC s c` or executing the ex command `:noh`. +SpaceVim uses `search_highlight_persist` to keep the searched expression highlighted until the next search. It is also possible to clear the highlighting by pressing `SPC s c` or executing the ex command `:noh`. #### Highlight current symbol @@ -1523,17 +1518,17 @@ To Highlight the current symbol under point press `SPC s h`. Navigation between the highlighted symbols can be done with the commands: -| Key Binding | Description | -| ----------- | ---------------------------------------------------------------------------- | -| `*` | initiate navigation transient state on current symbol and jump forwards | -| `#` | initiate navigation transient state on current symbol and jump backwards | -| `SPC s e` | edit all occurrences of the current symbol | -| `SPC s h` | highlight the current symbol and all its occurrence within the current range | -| `SPC s H` | go to the last searched occurrence of the last highlighted symbol | +| Key Bindings | Descriptions | +| ------------ | ---------------------------------------------------------------------------- | +| `*` | initiate navigation transient state on current symbol and jump forwards | +| `#` | initiate navigation transient state on current symbol and jump backwards | +| `SPC s e` | edit all occurrences of the current symbol | +| `SPC s h` | highlight the current symbol and all its occurrence within the current range | +| `SPC s H` | go to the last searched occurrence of the last highlighted symbol | In highlight symbol transient state: -| Key Binding | Description | +| Key Bindings | Descriptions | | ------------- | ------------------------------------------------------------- | | `e` | edit occurrences (`*`) | | `n` | go to next occurrence | @@ -1555,7 +1550,7 @@ In highlight symbol transient state: Text related commands (start with `x`): -| Key Binding | Description | +| Key Bindings | Descriptions | | ------------- | -------------------------------------------------------------------- | | `SPC x a &` | align region at & | | `SPC x a (` | align region at ( | @@ -1616,31 +1611,31 @@ Text related commands (start with `x`): Text insertion commands (start with `i`): -| Key binding | Description | -| ----------- | --------------------------------------------------------------------- | -| `SPC i l l` | insert lorem-ipsum list | -| `SPC i l p` | insert lorem-ipsum paragraph | -| `SPC i l s` | insert lorem-ipsum sentence | -| `SPC i p 1` | insert simple password | -| `SPC i p 2` | insert stronger password | -| `SPC i p 3` | insert password for paranoids | -| `SPC i p p` | insert a phonetically easy password | -| `SPC i p n` | insert a numerical password | -| `SPC i u` | Search for Unicode characters and insert them into the active buffer. | -| `SPC i U 1` | insert UUIDv1 (use universal argument to insert with CID format) | -| `SPC i U 4` | insert UUIDv4 (use universal argument to insert with CID format) | -| `SPC i U U` | insert UUIDv4 (use universal argument to insert with CID format) | +| Key bindings | Descriptions | +| ------------ | --------------------------------------------------------------------- | +| `SPC i l l` | insert lorem-ipsum list | +| `SPC i l p` | insert lorem-ipsum paragraph | +| `SPC i l s` | insert lorem-ipsum sentence | +| `SPC i p 1` | insert simple password | +| `SPC i p 2` | insert stronger password | +| `SPC i p 3` | insert password for paranoids | +| `SPC i p p` | insert a phonetically easy password | +| `SPC i p n` | insert a numerical password | +| `SPC i u` | Search for Unicode characters and insert them into the active buffer. | +| `SPC i U 1` | insert UUIDv1 (use universal argument to insert with CID format) | +| `SPC i U 4` | insert UUIDv4 (use universal argument to insert with CID format) | +| `SPC i U U` | insert UUIDv4 (use universal argument to insert with CID format) | #### Increase/Decrease numbers -| Key Binding | Description | -| ----------- | ------------------------------------------------------------------- | -| `SPC n +` | increase the number under point by one and initiate transient state | -| `SPC n -` | decrease the number under point by one and initiate transient state | +| Key Bindings | Descriptions | +| ------------ | ------------------------------------------------------------------- | +| `SPC n +` | increase the number under point by one and initiate transient state | +| `SPC n -` | decrease the number under point by one and initiate transient state | In transient state: -| Key Binding | Description | +| Key Bindings | Descriptions | | ------------- | -------------------------------------- | | `+` | increase the number under point by one | | `-` | decrease the number under point by one | @@ -1660,15 +1655,15 @@ The default color for iedit is `red`/`green` which is based on the current color **State transitions:** -| Key Binding | From | to | -| ----------- | ---------------- | ------------ | -| `SPC s e` | normal or visual | iedit-Normal | +| Key Bindings | From | to | +| ------------ | ---------------- | ------------ | +| `SPC s e` | normal or visual | iedit-Normal | **In iedit-Normal mode:** `iedit-Normal` mode inherits from `Normal` mode, the following key bindings are specific to `iedit-Normal` mode. -| Key Binding | Description | +| Key Binding | Descriptions | | ------------- | ------------------------------------------------------------------------------- | | `Esc` | go back to `Normal` mode | | `i` | switch to `iedit-Insert` mode, same as `i` | @@ -1690,13 +1685,13 @@ The default color for iedit is `red`/`green` which is based on the current color **In iedit-Insert mode:** -| Key Binding | Description | -| ----------- | ------------------------------ | -| `` | go back to `iedit-Normal` mode | -| `` | Move cursor to left | -| `` | Move cursor to right | -| `Ctrl-w` | delete words before cursor | -| `Ctrl-k` | delete words after cursor | +| Key Bindings | Descriptions | +| ------------ | ------------------------------ | +| `` | go back to `iedit-Normal` mode | +| `` | Move cursor to left | +| `` | Move cursor to right | +| `Ctrl-w` | delete words before cursor | +| `Ctrl-k` | delete words after cursor | ##### Examples @@ -1704,19 +1699,19 @@ The default color for iedit is `red`/`green` which is based on the current color Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), it’s bound to the following keys. -| Key Binding | Description | -| ----------- | -------------------------- | -| `SPC ;` | comment operator | -| `SPC c h` | hide/show comments | -| `SPC c l` | comment lines | -| `SPC c L` | invert comment lines | -| `SPC c p` | comment paragraphs | -| `SPC c P` | invert comment paragraphs | -| `SPC c s` | comment with pretty layout | -| `SPC c t` | comment to line | -| `SPC c T` | invert comment to line | -| `SPC c y` | comment and yank | -| `SPC c Y` | invert comment and yank | +| Key Bindings | Descriptions | +| ------------ | -------------------------- | +| `SPC ;` | comment operator | +| `SPC c h` | hide/show comments | +| `SPC c l` | comment lines | +| `SPC c L` | invert comment lines | +| `SPC c p` | comment paragraphs | +| `SPC c P` | invert comment paragraphs | +| `SPC c s` | comment with pretty layout | +| `SPC c t` | comment to line | +| `SPC c T` | invert comment to line | +| `SPC c y` | comment and yank | +| `SPC c Y` | invert comment and yank | **Tips:** `SPC ;` will start operator mode, in this mode, you can use motion command to comment lines. For example, `SPC ; 4 j` will comment current line and the following 4 lines. @@ -1728,7 +1723,7 @@ SpaceVim uses utf-8 as default encoding. There are four options for these case: - fileencodings (fencs): ucs-bom,utf-8,default,latin1 - fileencoding (fenc): utf-8 - encoding (enc): utf-8 -- termencoding (tenc): utf-8 (only supported in vim) +- termencoding (tenc): utf-8 (only supported in Vim) To fix messy display: `SPC e a` is the mapping for auto detect the file encoding. After detecting file encoding, you can run the command below to fix the encoding: @@ -1741,10 +1736,10 @@ write SpaceVim provides an asynchronously code runner plugin. In most language layer, we have defined a key bidning `SPC l r` for running current buffer. -If you need to add new commands, you can use bootstrap func. for example: +If you need to add new commands, you can use the bootstrap function. For example: Use `F5` to build project asynchronously. -```viml +```vim nnoremap :call SpaceVim#plugins#runner#open('make') ``` @@ -1767,7 +1762,7 @@ The checks are only performed at save time by default. Errors management mappings (start with e): -| Mappings | Description | +| Mappings | Descriptions | | --------- | --------------------------------------------------------------------------- | | `SPC t s` | toggle syntax checker | | `SPC e c` | clear all errors | @@ -1778,39 +1773,39 @@ Errors management mappings (start with e): | `SPC e v` | verify syntax checker setup (useful to debug 3rd party tools configuration) | | `SPC e .` | error transient state | -The next/previous error mappings and the error transient state can be used to browse errors from syntax checkers as well as errors from location list buffers, and indeed anything that supports vim's location list. This includes for example search results that have been saved to a location list buffer. +The next/previous error mappings and the error transient state can be used to browse errors from syntax checkers as well as errors from location list buffers, and indeed anything that supports Vim's location list. This includes for example search results that have been saved to a location list buffer. Custom sign symbol: -| Symbol | Description | Custom option | -| ------ | ----------- | --------------------------- | -| `✖` | Error | `g:spacevim_error_symbol` | -| `➤` | warning | `g:spacevim_warning_symbol` | -| `🛈` | Info | `g:spacevim_info_symbol` | +| Symbol | Descriptions | Custom options | +| ------ | ----------- | --------------------------- | +| `✖` | Error | `error_symbol` | +| `➤` | warning | `warning_symbol` | +| `🛈` | Info | `info_symbol` | ### Managing projects SpaceVim will find the root of the project when a `.git` directory or a `.project_alt.json` file is encountered in the file tree. -project manager commands start with `p`: +Project manager commands start with `p`: -| Key Binding | Description | -| ----------- | ----------------------------------------------------- | -| `SPC p '` | open a shell in project’s root (with the shell layer) | +| Key Bindings | Descriptions | +| ------------ | ----------------------------------------------------- | +| `SPC p '` | open a shell in project’s root (need the shell layer) | #### Searching files in project -| Key Binding | Description | -| ----------- | ---------------------------------------- | -| `SPC p f` | find files in current project | -| `SPC p /` | fuzzy search for text in current project | -| `SPC p k` | kill all buffers of current project | -| `SPC p t` | find project root | -| `SPC p p` | list all projects | +| Key Bindings | Descriptions | +| ------------ | ---------------------------------------- | +| `SPC p f` | find files in current project | +| `SPC p /` | fuzzy search for text in current project | +| `SPC p k` | kill all buffers of current project | +| `SPC p t` | find project root | +| `SPC p p` | list all projects | ## EditorConfig -SpaceVim has support for [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.” +SpaceVim has support [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.” To customize your editorconfig experience, read the [editorconfig-vim package’s documentation](https://github.com/editorconfig/editorconfig-vim/blob/master/README.md). @@ -1820,11 +1815,13 @@ SpaceVim starts a server at launch. This server is killed whenever you close you **Connecting to the Vim server** -If you are using neovim, you need to install [neovim-remote](https://github.com/mhinz/neovim-remote), then add this to your bashrc. +If you are using Neovim, you need to install [neovim-remote](https://github.com/mhinz/neovim-remote), then add this to your bashrc. - export PATH=$PATH:$HOME/.SpaceVim/bin +```sh +export PATH=$PATH:$HOME/.SpaceVim/bin +``` -Use `svc` to open a file in the existing Vim server, or using `nsvc` to open a file in the existing neovim server. +Use `svc` to open a file in the existing Vim server, or use `nsvc` to open a file in the existing Neovim server. ![server-and-client](https://user-images.githubusercontent.com/13142418/32554968-7164fe9c-c4d6-11e7-95f7-f6a6ea75e05b.gif) diff --git a/docs/faq.md b/docs/faq.md index 3dd4d272d..c43da9d24 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -5,7 +5,7 @@ description: "A list of questions and answers relating to SpaceVim, especially t # SpaceVim FAQ -This is a list of the most asked questions about SpaceVim. +This is a list of the frequently asked questions about SpaceVim. @@ -15,31 +15,31 @@ This is a list of the most asked questions about SpaceVim. - [E492: Not an editor command: ^M](#e492-not-an-editor-command-m) - [Why SpaceVim can not display default colorscheme?](#why-spacevim-can-not-display-default-colorscheme) - [Why can't I update plugins?](#why-cant-i-update-plugins) -- [how to enable +py and +py3 in neovim?](#how-to-enable-py-and-py3-in-neovim) -- [Why does vim freeze after pressing Ctrl-s?](#why-does-vim-freeze-after-pressing-ctrl-s) +- [How to enable +py and +py3 in Neovim?](#how-to-enable-py-and-py3-in-neovim) +- [Why does Vim freeze after pressing Ctrl-s?](#why-does-vim-freeze-after-pressing-ctrl-s) ### Can I try SpaceVim without overwriting my vimrc? The SpaceVim install script will move your `~/.vimrc` to `~/.vimrc_back`. If you want to have a try SpaceVim without -overwriting your own vim configuration you can: +overwriting your own Vim configuration you can: -clone SpaceVim manually. +Clone SpaceVim manually. ```sh git clone https://github.com/SpaceVim/SpaceVim.git ~/.SpaceVim ``` -then, start vim via `vim -u ~/.SpaceVim/vimrc`. You can also put this alias into your bashrc. +Then, start Vim via `vim -u ~/.SpaceVim/vimrc`. You can also put this alias into your bashrc. ```sh alias svim='vim -u ~/.SpaceVim/vimrc' ``` ### Why use toml as the default configuration file format? -In the old version of SpaceVim, we used a vim file (`init.vim`) for configuration. This introduced a lot of problems. -When loading a vim file the file content is executed line by line. This means that when there was an error the content +In the old version of SpaceVim, we used a Vim file (`init.vim`) for configuration. This introduced a lot of problems. +When loading a Vim file the file content is executed line by line. This means that when there was an error the content before the error was still executed. This led to unforeseen problems. We decided going forward to use a more robust configuration mechanism in SpaceVim. SpaceVim must be able to load the @@ -78,9 +78,9 @@ directory is dirty (has changes that haven't been committed to git) you can not issue, just move your cursor to the error line, and press `gf`, then run `git reset --hard HEAD` or `git checkout .`. For more info please read git documentation. -### How to enable +py and +py3 in neovim? +### How to enable +py and +py3 in Neovim? -In neovim we can use `g:python_host_prog` and `g:python3_host_prog` to config python prog. In SpaceVim +In Neovim we can use `g:python_host_prog` and `g:python3_host_prog` to config python prog. In SpaceVim the custom configuration file is loaded after SpaceVim core code. So in SpaceVim itself, if we using `:py` command, it may cause errors. So we introduce two new environment variables: `PYTHON_HOST_PROG` and `PYTHON3_HOST_PROG`. @@ -91,9 +91,9 @@ export PYTHON_HOST_PROG='/home/q/envs/neovim2/bin/python' export PYTHON3_HOST_PROG='/home/q/envs/neovim3/bin/python' ``` -### Why does vim freeze after pressing Ctrl-s? +### Why does Vim freeze after pressing Ctrl-s? -This is a [feature of terminal emulators](https://unix.stackexchange.com/a/137846). You can use `Ctrl-q` to unfreeze vim. To disable +This is a [feature of terminal emulators](https://unix.stackexchange.com/a/137846). You can use `Ctrl-q` to unfreeze Vim. To disable this feature you need the following in either `~/.bash_profile` or `~/.bashrc`: ```sh diff --git a/docs/index.md b/docs/index.md index 42302f8de..459fb27a0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,17 +12,17 @@ description: "SpaceVim is a community-driven vim distribution that seeks to prov ![welcome-page](https://user-images.githubusercontent.com/13142418/50423286-5b33a400-088e-11e9-830c-792ce1c7c126.png) -# SpaceVim - Modern vim distribution +# SpaceVim - Modern Vim distribution -SpaceVim is a distribution of the vim editor that's inspired by spacemacs. -It manages collections of plugins in layers, which help collect related +SpaceVim is a distribution of the Vim editor that's inspired by spacemacs. +It manages collections of plugins in layers, which help collecting related packages together to provide features. For example, the python layer collects deoplete.nvim, neomake and jedi-vim together to provide autocompletion, -syntax checking, and documentation lookup. This approach helps keep +syntax checking, and documentation lookup. This approach helps keeping configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install. -If you like SpaceVim, feel free to star the project on github. It is a great way to show your +If you like SpaceVim, please feel free to star the project on github. It is a great way to show your appreciation while providing us motivation to continue working on this project. @@ -64,12 +64,12 @@ for development progress and the [roadmap](roadmap/) for high-level plans. - Is SpaceVim trying to turn Vim/Neovim into an IDE? -With layers feature, this version of vim distribution try to turn vim/neovim into an IDE for many languages. +With layers feature, this version of Vim distribution try to turn Vim/Neovim into an IDE for many languages. -- Which version of vim/neovim is needed? +- Which version of Vim/Neovim is needed? -vim 7.4/neovim v0.1.7, and `+lua` or `+python3` is needed. +Vim 7.4/Neovim v0.1.7, and `+lua` or `+python3` is needed. -For more general questions, please read [SpaceVim FAQ](faq/) +For more general questions, please read [SpaceVim FAQ](faq/). diff --git a/docs/layers.md b/docs/layers.md index 22e309292..0a354ddee 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -16,8 +16,8 @@ description: "A guide for managing SpaceVim with layers, tell you how to enable ## Introduction -SpaceVim is a community-driven vim distribution that seeks to provide layer feature. -Layers help collect related packages together to provide features. +SpaceVim is a community-driven Vim distribution that seeks to provide layer feature. +Layers help collecting related packages together to provide features. This approach helps keep configuration organized and reduces overhead for the user by keeping them from having to think about what packages to install. @@ -38,105 +38,105 @@ By default SpaceVim enable these layers: To enable a specific layer you need to edit SpaceVim configuration file. The key binding for opening SpaceVim configuration file is `SPC f v d`. -here is an example for loading `shell` layer with some specified options: +The following example shows how to load `shell` layer with some specified options: ```toml [[layers]] -name = "shell" -default_position = "top" -default_height = 30 + name = "shell" + default_position = "top" + default_height = 30 ``` ### Disable layers -Some layers are enabled by default, here is an example for disable `shell` layer: +Some layers are enabled by default. The following example shows how to disable `shell` layer: ```toml [[layers]] -name = "shell" -enable = false + name = "shell" + enable = false ``` ## Available layers -| Name | Description | -| ---------- | ------------ | -| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… | -| [autocomplete](autocomplete/) | Autocomplete code within SpaceVim, fuzzy find the candidates from multiple completion sources, expand snippet before cursor automatically | -| [chat](chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. | -| [checkers](checkers/) | Syntax checking automatically within SpaceVim, display error on the sign column and statusline. | -| [chinese](chinese/) | Layer for chinese users, include chinese docs and runtime messages | -| [colorscheme](colorscheme/) | colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme. | -| [core#banner](core/banner/) | This layer provides many default banner on welcome page. | -| [core#statusline](core/statusline/) | This layer provides default statusline for SpaceVim | -| [core#tabline](core/tabline/) | SpaceVim core#tabline layer provides a better tabline for SpaceVim | -| [core](core/) | SpaceVim core layer provides many default key bindings and features. | -| [cscope](cscope/) | cscope layer provides a smart cscope and pycscope helper for SpaceVim, help users win at cscope | -| [ctrlp](ctrlp/) | This layers provide a heavily customized ctrlp centric work-flow | -| [debug](debug/) | This layer provide debug workflow support in SpaceVim | -| [default](default/) | SpaceVim default layer contains no plugins, but It provides some better default config for SpaceVim. | -| [denite](denite/) | This layers provide a heavily customized Denite centric work-flow | -| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. | -| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. | -| [format](format/) | Code formatting support for SpaceVim | -| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow | -| [git](git/) | This layers adds extensive support for git | -| [github](github/) | This layer provides GitHub integration for SpaceVim | -| [japanese](japanese/) | Layer for japanese users, include japanese docs and runtime messages | -| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim | -| [lang#agda](lang/agda/) | This layer adds agda language support to SpaceVim | -| [lang#asciidoc](lang/asciidoc/) | Edit asciidoc within vim, autopreview asciidoc in the default browser, with this layer you can also format asciidoc file. | -| [lang#autohotkey](lang/autohotkey/) | This layer adds autohotkey language support to SpaceVim | -| [lang#c](lang/c/) | c/c++/object-c language support for SpaceVim, include code completion, jump to definition, quick runner. | -| [lang#clojure](lang/clojure/) | This layer is for clojure development, provide autocompletion, syntax checking, code format for clojure file. | -| [lang#csharp](lang/csharp/) | This layer is for csharp development | -| [lang#dart](lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. | -| [lang#dockerfile](lang/dockerfile/) | This layer adds DockerFile to SpaceVim | -| [lang#elixir](lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. | -| [lang#elm](lang/elm/) | This layer is for elm development, provide autocompletion, syntax checking, code format for elm file. | -| [lang#erlang](lang/erlang/) | This layer is for erlang development, provide autocompletion, syntax checking, code format for erlang file. | -| [lang#extra](lang/extra/) | This layer adds extra language support to SpaceVim | -| [lang#fsharp](lang/fsharp/) | This layer adds fsharp language support to SpaceVim | -| [lang#go](lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. | -| [lang#haskell](lang/haskell/) | haskell language support for SpaceVim, includes code completion, syntax checking, jumping to definition, also provides language server protocol support for haskell | -| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. | -| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. | -| [lang#javascript](lang/javascript/) | This layer is for JavaScript development | -| [lang#julia](lang/julia/) | This layer is for julia development, provide autocompletion, syntax checking and code formatting | -| [lang#kotlin](lang/kotlin/) | This layer adds kotlin language support to SpaceVim | -| [lang#latex](lang/latex/) | This layer provides support for writing LaTeX documents, including syntax highlighting, code completion, formatting etc. | -| [lang#lisp](lang/lisp/) | This layer is for lisp development, provide autocompletion, syntax checking, code format for lisp file. | -| [lang#lua](lang/lua/) | This layer is for lua development, provide autocompletion, syntax checking, code format for lua file. | -| [lang#markdown](lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. | -| [lang#nim](lang/nim/) | This layer adds nim language support to SpaceVim | -| [lang#ocaml](lang/ocaml/) | This layer is for ocaml development, provide autocompletion, syntax checking, code format for ocaml file. | -| [lang#perl](lang/perl/) | This layer is for perl development, provide autocompletion, syntax checking, code format for perl file. | -| [lang#php](lang/php/) | This layer adds PHP language support to SpaceVim | -| [lang#plantuml](lang/plantuml/) | This layer is for plantuml development, syntax highlighting for plantuml file. | -| [lang#puppet](lang/puppet/) | This layer adds puppet language support to SpaceVim | -| [lang#purescript](lang/purescript/) | This layer is for purescript development, provide autocompletion, syntax checking, code format for purescript file. | -| [lang#python](lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for python file. | -| [lang#ruby](lang/ruby/) | This layer is for ruby development, provide autocompletion, syntax checking, code format for ruby file. | -| [lang#rust](lang/rust/) | This layer is for rust development, provide autocompletion, syntax checking, code format for rust file. | -| [lang#scala](lang/scala/) | This layer adds scala language support to SpaceVim | -| [lang#scheme](lang/scheme/) | This layer adds scheme language support to SpaceVim | -| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. | -| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion, syntax highlighting | -| [lang#typescript](lang/typescript/) | This layer is for TypeScript development | -| [lang#vim](lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting | -| [lang#vue](lang/vue/) | This layer adds vue language support to SpaceVim | -| [lsp](language-server-protocol/) | This layers provides language server protocol for vim and neovim | -| [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow | -| [shell](shell/) | This layer provide shell support in SpaceVim | -| [sudo](sudo/) | sudo layer provides ability to read and write file elevated privileges in SpaceVim | -| [tags](tags/) | This layer provide tags manager for project | -| [tests](tests/) | This layer allows to run tests directly on SpaceVim | -| [tmux](tmux/) | This layers adds extensive support for tmux | -| [tools#dash](tools/dash/) | This layer provides Dash integration for SpaceVim | -| [tools](tools/) | This layer provides some tools for vim | -| [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI | +| Name | Description | +| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [autocomplete](autocomplete/) | Autocomplete code within SpaceVim, fuzzy find the candidates from multiple completion sources, expand snippet before cursor automatically | +| [chat](chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. | +| [checkers](checkers/) | Syntax checking automatically within SpaceVim, display error on the sign column and statusline. | +| [chinese](chinese/) | Layer for chinese users, include chinese docs and runtime messages | +| [colorscheme](colorscheme/) | colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme. | +| [core#banner](core/banner/) | This layer provides many default banner on welcome page. | +| [core#statusline](core/statusline/) | This layer provides default statusline for SpaceVim | +| [core#tabline](core/tabline/) | SpaceVim core#tabline layer provides a better tabline for SpaceVim | +| [core](core/) | SpaceVim core layer provides many default key bindings and features. | +| [cscope](cscope/) | cscope layer provides a smart cscope and pycscope helper for SpaceVim, help users win at cscope | +| [ctrlp](ctrlp/) | This layers provide a heavily customized ctrlp centric work-flow | +| [debug](debug/) | This layer provide debug workflow support in SpaceVim | +| [default](default/) | SpaceVim default layer contains no plugins, but It provides some better default config for SpaceVim. | +| [denite](denite/) | This layers provide a heavily customized Denite centric work-flow | +| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. | +| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. | +| [format](format/) | Code formatting support for SpaceVim | +| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow | +| [git](git/) | This layers adds extensive support for git | +| [github](github/) | This layer provides GitHub integration for SpaceVim | +| [japanese](japanese/) | Layer for japanese users, include japanese docs and runtime messages | +| [lang#agda](lang/agda/) | This layer adds agda language support to SpaceVim | +| [lang#asciidoc](lang/asciidoc/) | Edit asciidoc within vim, autopreview asciidoc in the default browser, with this layer you can also format asciidoc file. | +| [lang#autohotkey](lang/autohotkey/) | This layer adds autohotkey language support to SpaceVim | +| [lang#c](lang/c/) | c/c++/object-c language support for SpaceVim, include code completion, jump to definition, quick runner. | +| [lang#clojure](lang/clojure/) | This layer is for clojure development, provide autocompletion, syntax checking, code format for clojure file. | +| [lang#csharp](lang/csharp/) | This layer is for csharp development | +| [lang#dart](lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. | +| [lang#dockerfile](lang/dockerfile/) | This layer adds DockerFile to SpaceVim | +| [lang#elixir](lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. | +| [lang#elm](lang/elm/) | This layer is for elm development, provide autocompletion, syntax checking, code format for elm file. | +| [lang#erlang](lang/erlang/) | This layer is for erlang development, provide autocompletion, syntax checking, code format for erlang file. | +| [lang#extra](lang/extra/) | This layer adds extra language support to SpaceVim | +| [lang#fsharp](lang/fsharp/) | This layer adds fsharp language support to SpaceVim | +| [lang#go](lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. | +| [lang#haskell](lang/haskell/) | haskell language support for SpaceVim, includes code completion, syntax checking, jumping to definition, also provides language server protocol support for haskell | +| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. | +| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. | +| [lang#javascript](lang/javascript/) | This layer is for JavaScript development | +| [lang#julia](lang/julia/) | This layer is for julia development, provide autocompletion, syntax checking and code formatting | +| [lang#kotlin](lang/kotlin/) | This layer adds kotlin language support to SpaceVim | +| [lang#latex](lang/latex/) | This layer provides support for writing LaTeX documents, including syntax highlighting, code completion, formatting etc. | +| [lang#lisp](lang/lisp/) | This layer is for lisp development, provide autocompletion, syntax checking, code format for lisp file. | +| [lang#lua](lang/lua/) | This layer is for lua development, provide autocompletion, syntax checking, code format for lua file. | +| [lang#markdown](lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. | +| [lang#nim](lang/nim/) | This layer adds nim language support to SpaceVim | +| [lang#ocaml](lang/ocaml/) | This layer is for ocaml development, provide autocompletion, syntax checking, code format for ocaml file. | +| [lang#perl](lang/perl/) | This layer is for perl development, provide autocompletion, syntax checking, code format for perl file. | +| [lang#php](lang/php/) | This layer adds PHP language support to SpaceVim | +| [lang#plantuml](lang/plantuml/) | This layer is for plantuml development, syntax highlighting for plantuml file. | +| [lang#puppet](lang/puppet/) | This layer adds puppet language support to SpaceVim | +| [lang#purescript](lang/purescript/) | This layer is for purescript development, provide autocompletion, syntax checking, code format for purescript file. | +| [lang#python](lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for python file. | +| [lang#ruby](lang/ruby/) | This layer is for ruby development, provide autocompletion, syntax checking, code format for ruby file. | +| [lang#rust](lang/rust/) | This layer is for rust development, provide autocompletion, syntax checking, code format for rust file. | +| [lang#scala](lang/scala/) | This layer adds scala language support to SpaceVim | +| [lang#scheme](lang/scheme/) | This layer adds scheme language support to SpaceVim | +| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. | +| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion, syntax highlighting | +| [lang#typescript](lang/typescript/) | This layer is for TypeScript development | +| [lang#vim](lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting | +| [lang#vue](lang/vue/) | This layer adds vue language support to SpaceVim | +| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim | +| [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow | +| [lsp](language-server-protocol/) | This layers provides language server protocol for vim and neovim | +| [shell](shell/) | This layer provide shell support in SpaceVim | +| [sudo](sudo/) | sudo layer provides ability to read and write file elevated privileges in SpaceVim | +| [tags](tags/) | This layer provide tags manager for project | +| [tests](tests/) | This layer allows to run tests directly on SpaceVim | +| [tmux](tmux/) | This layers adds extensive support for tmux | +| [tools#dash](tools/dash/) | This layer provides Dash integration for SpaceVim | +| [tools](tools/) | This layer provides some tools for vim | +| [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI | +| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… | diff --git a/docs/quick-start-guide.md b/docs/quick-start-guide.md index 7c3a2e379..f34cfc8a3 100644 --- a/docs/quick-start-guide.md +++ b/docs/quick-start-guide.md @@ -23,10 +23,10 @@ show you how to install it, how to config it, and explain its features. ## Install -At a minimum, SpaceVim requires `git` and `curl` to be installed. These tools +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 terminal, you also need to set the font of your terminal. +If you are using Vim/Neovim in terminal, you also need to set the font of your terminal. ### Linux and macOS @@ -34,7 +34,7 @@ If you are using vim/neovim in terminal, you also need to set the font of your t curl -sLf https://spacevim.org/install.sh | bash ``` -After SpaceVim is installed, launch `vim` and SpaceVim will **automatically** install plugins. +After SpaceVim being installed, launch `vim` and SpaceVim will **automatically** install plugins. For more info about the install script, please check: @@ -53,7 +53,7 @@ docker pull spacevim/spacevim docker run -it --rm spacevim/spacevim nvim ``` -you can also load local config: +You can also load local config: ```sh docker run -it -v ~/.SpaceVim.d:/home/spacevim/.SpaceVim.d --rm spacevim/spacevim nvim @@ -66,9 +66,9 @@ an example for basic usage of SpaceVim. For more info, please checkout SpaceVim documentation. ```toml -# This is basic configuration example for SpaceVim +# This is a basic configuration example for SpaceVim -# All SpaceVim options are below [options] section +# All SpaceVim options are below [options] snippet [options] # set spacevim theme. by default colorscheme layer is not loaded, # if you want to use more colorscheme, please load the colorscheme @@ -92,19 +92,19 @@ documentation. # Enable autocomplete layer [[layers]] -name = "autocomplete" -auto-completion-return-key-behavior = "complete" -auto-completion-tab-key-behavior = "cycle" + name = "autocomplete" + auto-completion-return-key-behavior = "complete" + auto-completion-tab-key-behavior = "cycle" [[layers]] -name = "shell" -default_position = "top" -default_height = 30 + name = "shell" + default_position = "top" + default_height = 30 # This is an example for adding custom plugins lilydjwg/colorizer [[custom_plugins]] -name = "lilydjwg/colorizer" -merged = 0 + name = "lilydjwg/colorizer" + merged = false ``` ## Online tutor @@ -113,7 +113,7 @@ This is a list of online tutor for using SpaceVim as general IDE and programming - [use vim as general IDE](../use-vim-as-ide/): a general guide for using SpaceVim as IDE -a list of guide for programming language support: +A list of guide for programming language support:
      diff --git a/docs/sponsors.md b/docs/sponsors.md index 39391d7c5..798760cf3 100644 --- a/docs/sponsors.md +++ b/docs/sponsors.md @@ -1,6 +1,6 @@ --- title: "Sponsors" -description: "the companies or individuals contributing a monthly amount to help sustain SpaceVim's development." +description: "The companies or individuals contributing a monthly amount to help sustain SpaceVim's development." --- # Sponsors @@ -25,77 +25,77 @@ Bitcoin: 1DtuVeg81c2L9NEhDaVTAAbrCR3pN5xPFv These are the companies or individuals contributing a monthly amount to help sustain SpaceVim's development. See the [Bountysource campaign](https://www.bountysource.com/teams/spacevim) for more details. -| date     | Amount | Description                                   | -| ------------ | ------- | --------------------------------------------- | -| 2016-09-26 | ¥ 100 | *好 | -| 2016-09-26 | ¥ 300 | *好 | -| 2016-11-22 | ¥ 20 | *续 | -| 2017-02-23 | ¥ 40 | *拔 | -| 2017-02-14 | ¥ 100 | *洁 | -| 2017-03-18 | ¥ 20 | z*t | -| 2017-03-30 | ¥ 20 | l*n | -| 2017-04-07 | ¥ 20 | *酱 | -| 2017-06-20 | $ 2.57 | Шепелев Григорий | -| 2017-06-24 | $ 14.04 | Vowell Jason | -| 2017-06-24 | $ 2.57 | Senaud Nicolas | -| 2017-09-16 | $ 2.57 | D'Avezac Mayeul | -| 2017-09-24 | ¥ 0.99 | 1*5 | -| 2017-11-02 | ¥ 10 | *下 | -| 2017-11-02 | ¥ 10 | *下 | -| 2017-11-20 | ¥ 1.6 | *瑞 | -| 2017-11-26 | $ 14.04 | Hermans Tim | -| 2017-12-13 | $ 5.44 | Ma Fei | -| 2017-12-27 | $ 8.30 | Módolo Marcelo | -| 2017-12-28 | ¥ 20 | s*n | -| 2017-12-28   | ¥ 10.24 | bts | -| 2017-12-29 | ¥ 10 | *哥 | -| 2018-01-22 | ¥ 10 | *强 | -| 2018-01-24 | ¥ 20 | unlockingc | -| 2018-02-05 | $ 2.57 | Samuel Mitchell | -| 2018-02-13 | $ 45 | talktopete | -| 2018-02-14 | ¥ 20 | *川 | -| 2018-02-14 | ¥ 188 | *黑8 | -| 2018-02-18 | ¥ 66.6 | *谨 | -| 2018-02-22 | $ 9 | sei40kr | -| 2018-02-24 | $ 6 | kapkabnh | -| 2018-03-14 | ¥ 1 | *目 | -| 2018-03-20 | $ 10 | kovaski | -| 2018-03-26 | ¥ 0.01 | *丰 | -| 2018-03-28 | $ 2.57 | 小林 | -| 2018-03-30 | ¥ 10 | 林* | -| 2018-03-31 | ¥ 18.88 | s*n | -| 2018-04-04 | ¥ 10 | 童* | -| 2018-04-06 | ¥ 9.99 | Galaxy | -| 2018-04-20 | ¥ 5 | 可*) | -| 2018-04-29 | ¥ 5 | *中 | -| 2018-05-07 | ¥ 6.6 | *浪 | -| 2018-05-09 | ¥ 10 | S*R | -| 2018-05-16 | $ 2.57 | Daniel Beste | -| 2018-06-18 | $ 11.17 | Charalambos | -| 2018-06-20 | $ 2.57 | Jingpeng Wu | -| 2018-06-24 | ¥ 50 | 青* | -| 2018-06-25 | $ 14.04 | Core Enable, LLC | -| 2018-07-16 | ¥ 5 | L_Collection | -| 2018-07-26 | $ 5.44 | John Femiani | -| 2018-07-31 | ¥ 10 | w*d | -| 2018-08-04 | ¥ 50 | *建 | -| 2018-08-12 | ¥ 20 | leo陶 | -| 2018-08-15 | ¥ 300 | 睿 | -| 2018-09-12 | ¥ 50 | 鉴*o | -| 2018-09-21 | $ 200 | chvanikoff | -| 2018-10-23 | $ 2.57 | Hongjun Fu | -| 2018-10-26 | $ 2.57 | Vladimir Kravtsov | -| 2018-10-23 | $ 2.57 | Hongjun Fu | -| 2018-11-13 | ¥ 8.8 | 开源 | -| 2018-11-14 | $ 14.04 | Mateusz | -| 2018-12-04 | ¥ 30 | 兵焦 | -| 2018-12-17 | ¥ 1 | *歌 | -| 2018-12-17 | ¥ 100 | 涛 | -| 2018-12-20 | ¥ 20.19 | *尘 | +| Date     | Amount | Description       | +| ------------ | ------- | ----------------- | +| 2016-09-26 | ¥ 100 | *好 | +| 2016-09-26 | ¥ 300 | *好 | +| 2016-11-22 | ¥ 20 | *续 | +| 2017-02-23 | ¥ 40 | *拔 | +| 2017-02-14 | ¥ 100 | *洁 | +| 2017-03-18 | ¥ 20 | z*t | +| 2017-03-30 | ¥ 20 | l*n | +| 2017-04-07 | ¥ 20 | *酱 | +| 2017-06-20 | $ 2.57 | Шепелев Григорий | +| 2017-06-24 | $ 14.04 | Vowell Jason | +| 2017-06-24 | $ 2.57 | Senaud Nicolas | +| 2017-09-16 | $ 2.57 | D'Avezac Mayeul | +| 2017-09-24 | ¥ 0.99 | 1*5 | +| 2017-11-02 | ¥ 10 | *下 | +| 2017-11-02 | ¥ 10 | *下 | +| 2017-11-20 | ¥ 1.6 | *瑞 | +| 2017-11-26 | $ 14.04 | Hermans Tim | +| 2017-12-13 | $ 5.44 | Ma Fei | +| 2017-12-27 | $ 8.30 | Módolo Marcelo | +| 2017-12-28 | ¥ 20 | s*n | +| 2017-12-28   | ¥ 10.24 | bts | +| 2017-12-29 | ¥ 10 | *哥 | +| 2018-01-22 | ¥ 10 | *强 | +| 2018-01-24 | ¥ 20 | unlockingc | +| 2018-02-05 | $ 2.57 | Samuel Mitchell | +| 2018-02-13 | $ 45 | talktopete | +| 2018-02-14 | ¥ 20 | *川 | +| 2018-02-14 | ¥ 188 | *黑8 | +| 2018-02-18 | ¥ 66.6 | *谨 | +| 2018-02-22 | $ 9 | sei40kr | +| 2018-02-24 | $ 6 | kapkabnh | +| 2018-03-14 | ¥ 1 | *目 | +| 2018-03-20 | $ 10 | kovaski | +| 2018-03-26 | ¥ 0.01 | *丰 | +| 2018-03-28 | $ 2.57 | 小林 | +| 2018-03-30 | ¥ 10 | 林* | +| 2018-03-31 | ¥ 18.88 | s*n | +| 2018-04-04 | ¥ 10 | 童* | +| 2018-04-06 | ¥ 9.99 | Galaxy | +| 2018-04-20 | ¥ 5 | 可*) | +| 2018-04-29 | ¥ 5 | *中 | +| 2018-05-07 | ¥ 6.6 | *浪 | +| 2018-05-09 | ¥ 10 | S*R | +| 2018-05-16 | $ 2.57 | Daniel Beste | +| 2018-06-18 | $ 11.17 | Charalambos | +| 2018-06-20 | $ 2.57 | Jingpeng Wu | +| 2018-06-24 | ¥ 50 | 青* | +| 2018-06-25 | $ 14.04 | Core Enable, LLC | +| 2018-07-16 | ¥ 5 | L_Collection | +| 2018-07-26 | $ 5.44 | John Femiani | +| 2018-07-31 | ¥ 10 | w*d | +| 2018-08-04 | ¥ 50 | *建 | +| 2018-08-12 | ¥ 20 | leo陶 | +| 2018-08-15 | ¥ 300 | 睿 | +| 2018-09-12 | ¥ 50 | 鉴*o | +| 2018-09-21 | $ 200 | chvanikoff | +| 2018-10-23 | $ 2.57 | Hongjun Fu | +| 2018-10-26 | $ 2.57 | Vladimir Kravtsov | +| 2018-10-23 | $ 2.57 | Hongjun Fu | +| 2018-11-13 | ¥ 8.8 | 开源 | +| 2018-11-14 | $ 14.04 | Mateusz | +| 2018-12-04 | ¥ 30 | 兵焦 | +| 2018-12-17 | ¥ 1 | *歌 | +| 2018-12-17 | ¥ 100 | 涛 | +| 2018-12-20 | ¥ 20.19 | *尘 | -## Historical spending +## Historical Spending -| date     | Amount | Description                                   | -| ---------- | ------- | --------------------------------------------- | -| 2017-06-10 | - $ 5 | Host | -| 2017-01-03 | - ¥ 225 | Domain | +| Date     | Amount | Description | +| ---------- | ------- | ----------- | +| 2017-06-10 | - $ 5 | Host | +| 2017-01-03 | - ¥ 225 | Domain | From 38bf9583c0113fed7b9a81ae56a9da17afb49846 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Tue, 22 Jan 2019 14:07:48 +0800 Subject: [PATCH 015/179] Doc: fix typos. (#2483) * Doc: fix typos. * Doc: fix typos. * Doc: set ff=unix. * Doc: set ff=unix. --- README.md | 22 +++++++++++----------- docs/cn/documentation.md | 7 ++++--- docs/documentation.md | 10 +++++----- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 534cb0d91..f178ab74c 100644 --- a/README.md +++ b/README.md @@ -59,13 +59,13 @@ This is a list of latest features implemented in SpaceVim: Here is an example for using toml as SpaceVim config: ```toml -# This is basic configuration example for SpaceVim +# This is basic configuration example for SpaceVim. -# All SpaceVim options below [option] section +# All SpaceVim options below [options] snippet. [options] - # set spacevim theme. by default colorscheme layer is not loaded, - # if you want to use more colorschemes, please load the colorscheme - # layer + # Set SpaceVim theme. By default colorscheme layer is not loaded. + # If you want to use more colorschemes, please load the colorscheme + # layer. colorscheme = "gruvbox" colorscheme_bg = "dark" # Disable guicolors in basic mode, many terminal do not support 24bit @@ -85,14 +85,14 @@ Here is an example for using toml as SpaceVim config: # Enable autocomplete layer [[layers]] -name = 'autocomplete' -auto-completion-return-key-behavior = "complete" -auto-completion-tab-key-behavior = "cycle" + name = 'autocomplete' + auto-completion-return-key-behavior = "complete" + auto-completion-tab-key-behavior = "cycle" [[layers]] -name = 'shell' -default_position = 'top' -default_height = 30 + name = 'shell' + default_position = 'top' + default_height = 30 ``` **Iedit mode** diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index ee59dea55..bb0ad643e 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -857,8 +857,8 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的 ```toml [[custom_plugins]] -name = 'lilydjwg/colorizer' -merged = false + name = 'lilydjwg/colorizer' + merged = false ``` #### 界面元素显示切换 @@ -1440,9 +1440,10 @@ endfunction | `SPC s w g` | Get Google suggestions in Vim. Opens Google results in Browser. | | `SPC s w w` | Get Wikipedia suggestions in Vim. Opens Wikipedia page in Browser.(TODO) | -**注意**: 为了在 Vim 中使用谷歌 suggestions,需要在 `~/.SpaceVim.d/init.toml` 的`[[options]]`片段中加入如下配置: +**注意**: 为了在 Vim 中使用谷歌 suggestions,需要在 `~/.SpaceVim.d/init.toml` 的`[options]`片段中加入如下配置: ```toml +[options] enable_googlesuggest = true ``` diff --git a/docs/documentation.md b/docs/documentation.md index cdaadaf5a..8f314cb94 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1172,7 +1172,7 @@ Navigation is centered on the `hjkl` keys with the hope of providing a fast navi ##### Open file with file tree. -If there is only one file buffer opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. +If only one file buffer is opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. | Key Bindings | Descriptions | | -------------- | ----------------------------------------- | @@ -1641,11 +1641,11 @@ In transient state: | `-` | decrease the number under point by one | | Any other key | leave the transient state | -**Tips:** You can increase or decrease a value by more that once by using a prefix argument (i.e. `10 SPC n +` will add 10 to the number under point). +**Tips:** You can increase or decrease a number by more than once by using a prefix argument (i.e. `10 SPC n +` will add 10 to the number under cursor). #### Replace text with iedit -SpaceVim uses powerful iedit mode to quick edit multiple occurrences of a symbol or selection. +SpaceVim uses a powerful iedit mode to quick edit multiple occurrences of a symbol or selection. **Two new modes:** `iedit-Normal`/`iedit-Insert` @@ -1757,7 +1757,7 @@ These following features have been added to runner and repl plugin: ### Errors handling -SpaceVim uses [neomake](https://github.com/neomake/neomake) to gives error feedback on the fly. +SpaceVim uses [neomake](https://github.com/neomake/neomake) to give error feedback on the fly. The checks are only performed at save time by default. Errors management mappings (start with e): @@ -1805,7 +1805,7 @@ Project manager commands start with `p`: ## EditorConfig -SpaceVim has support [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.” +SpaceVim has supported [EditorConfig](http://editorconfig.org/), a configuration file to “define and maintain consistent coding styles between different editors and IDEs.” To customize your editorconfig experience, read the [editorconfig-vim package’s documentation](https://github.com/editorconfig/editorconfig-vim/blob/master/README.md). From 8608b42634075b8bac241ee420f9e1310e353f4e Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Tue, 22 Jan 2019 22:18:34 +0800 Subject: [PATCH 016/179] Move jsp autocmd to java layer --- autoload/SpaceVim/autocmds.vim | 1 - autoload/SpaceVim/layers/lang/java.vim | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index 0b656f888..e3b600ad1 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -20,7 +20,6 @@ function! SpaceVim#autocmds#init() abort autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) | \ bd| \ q | endif - autocmd FileType jsp call JspFileTypeInit() autocmd QuitPre * call SpaceVim#plugins#windowsmanager#UpdateRestoreWinInfo() autocmd WinEnter * call SpaceVim#plugins#windowsmanager#MarkBaseWin() autocmd BufRead,BufNewFile *.pp setfiletype puppet diff --git a/autoload/SpaceVim/layers/lang/java.vim b/autoload/SpaceVim/layers/lang/java.vim index 83dbf493d..17d232db4 100644 --- a/autoload/SpaceVim/layers/lang/java.vim +++ b/autoload/SpaceVim/layers/lang/java.vim @@ -98,6 +98,7 @@ function! SpaceVim#layers#lang#java#config() abort au! autocmd FileType java setlocal omnifunc=javacomplete#Complete autocmd FileType java call s:java_mappings() + autocmd FileType jsp call JspFileTypeInit() augroup END let g:neoformat_enabled_java = ['googlefmt'] let g:neoformat_java_googlefmt = { From 6234d7379aaccabcf274a1b820f4a92f67125bc2 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Tue, 22 Jan 2019 22:20:07 +0800 Subject: [PATCH 017/179] Use private var --- autoload/SpaceVim/autocmds.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index e3b600ad1..dabfef856 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -36,8 +36,8 @@ function! SpaceVim#autocmds#init() abort \ exe "normal! g`\"" | \ endif autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file - autocmd BufLeave * let b:winview = winsaveview() - autocmd BufEnter * if(exists('b:winview')) | call winrestview(b:winview) | endif + autocmd BufLeave * let b:_winview = winsaveview() + autocmd BufEnter * if(exists('b:_winview')) | call winrestview(b:_winview) | endif autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full) autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file. autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// From 413ef72c6f81b1c92e969669ccd9c635fca8e93b Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Tue, 22 Jan 2019 22:24:05 +0800 Subject: [PATCH 018/179] Move xml lua html autocmd to lang layer --- autoload/SpaceVim/autocmds.vim | 4 ---- autoload/SpaceVim/layers/lang/html.vim | 1 + autoload/SpaceVim/layers/lang/lua.vim | 4 ++++ autoload/SpaceVim/layers/lang/xml.vim | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index dabfef856..48b164430 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -43,10 +43,6 @@ function! SpaceVim#autocmds#init() abort autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,:// autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" - autocmd FileType lua set comments=f:-- - autocmd FileType xml call XmlFileTypeInit() - autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags - autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd Filetype qf setlocal nobuflisted autocmd FileType python,coffee call zvim#util#check_if_expand_tab() au StdinReadPost * call s:disable_welcome() diff --git a/autoload/SpaceVim/layers/lang/html.vim b/autoload/SpaceVim/layers/lang/html.vim index 87f687b78..b0988f334 100644 --- a/autoload/SpaceVim/layers/lang/html.vim +++ b/autoload/SpaceVim/layers/lang/html.vim @@ -25,6 +25,7 @@ function! SpaceVim#layers#lang#html#config() abort autocmd! autocmd FileType html,css,scss,sass,less,javascript,jsp,vue,eex call s:install_emmet() autocmd Filetype html setlocal omnifunc=htmlcomplete#CompleteTags + autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS augroup END endfunction diff --git a/autoload/SpaceVim/layers/lang/lua.vim b/autoload/SpaceVim/layers/lang/lua.vim index d5549ed57..aaa362502 100644 --- a/autoload/SpaceVim/layers/lang/lua.vim +++ b/autoload/SpaceVim/layers/lang/lua.vim @@ -30,6 +30,10 @@ let s:lua_repl_command = '' function! SpaceVim#layers#lang#lua#config() abort + augroup spacevim_lang_lua + autocmd! + autocmd FileType lua set comments=f:-- + augroup END call SpaceVim#mapping#space#regesit_lang_mappings('lua', function('s:language_specified_mappings')) let luaexe = filter(['lua53', 'lua52', 'lua51'], 'executable(v:val)') if !empty(luaexe) diff --git a/autoload/SpaceVim/layers/lang/xml.vim b/autoload/SpaceVim/layers/lang/xml.vim index 3080f13b2..9e97e5bc8 100644 --- a/autoload/SpaceVim/layers/lang/xml.vim +++ b/autoload/SpaceVim/layers/lang/xml.vim @@ -23,5 +23,9 @@ function! SpaceVim#layers#lang#xml#plugins() abort endfunction function! SpaceVim#layers#lang#xml#config() abort - + augroup spacevim_lang_xml + autocmd! + autocmd FileType xml call XmlFileTypeInit() + autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags + augroup END endfunction From 0346191b8800f7f503554cac4a9caa0a54126600 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 23 Jan 2019 01:00:47 +0800 Subject: [PATCH 019/179] Improve lang#r layer and doc (#2485) * Improve lang#r layer and doc * add config file * Add doc * Add key bindings --- autoload/SpaceVim/layers/lang/r.vim | 33 +++++++++++++++++ docs/cn/layers/lang/r.md | 52 +++++++++++++++++++++++++++ docs/layers/lang/r.md | 56 +++++++++++++++++++++++++++++ docs/layers/lang/ruby.md | 1 + 4 files changed, 142 insertions(+) create mode 100644 docs/cn/layers/lang/r.md create mode 100644 docs/layers/lang/r.md diff --git a/autoload/SpaceVim/layers/lang/r.vim b/autoload/SpaceVim/layers/lang/r.vim index 7e14bb9f5..9ba7038a4 100644 --- a/autoload/SpaceVim/layers/lang/r.vim +++ b/autoload/SpaceVim/layers/lang/r.vim @@ -11,3 +11,36 @@ function! SpaceVim#layers#lang#r#plugins() abort call add(plugins, ['wsdjeg/Nvim-R', {'merged' : 0}]) return plugins endfunction + +let s:r_repl_command = '' +function! SpaceVim#layers#lang#r#set_variable(var) abort + let s:r_repl_command = get(a:var, 'repl_command', '') +endfunction + +function! SpaceVim#layers#lang#r#config() abort + call SpaceVim#plugins#runner#reg_runner('r', 'r %s') + call SpaceVim#mapping#space#regesit_lang_mappings('r', function('s:language_specified_mappings')) + if !empty(s:r_repl_command) + call SpaceVim#plugins#repl#reg('r',s:r_repl_command) + else + call SpaceVim#plugins#repl#reg('r', 'r') + endif + +endfunction + +function! s:language_specified_mappings() abort + call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) + let g:_spacevim_mappings_space.l.s = {'name' : '+Send'} + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'], + \ 'call SpaceVim#plugins#repl#start("r")', + \ 'start REPL process', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'], + \ 'call SpaceVim#plugins#repl#send("line")', + \ 'send line and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'], + \ 'call SpaceVim#plugins#repl#send("buffer")', + \ 'send buffer and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'], + \ 'call SpaceVim#plugins#repl#send("selection")', + \ 'send selection and keep code buffer focused', 1) +endfunction diff --git a/docs/cn/layers/lang/r.md b/docs/cn/layers/lang/r.md new file mode 100644 index 000000000..09aee9b7f --- /dev/null +++ b/docs/cn/layers/lang/r.md @@ -0,0 +1,52 @@ +--- +title: "SpaceVim lang#r 模块" +description: "这一模块为 R 开发提供支持,包括代码补全、语法检查、代码格式化等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#r + + + +- [模块描述](#模块描述) +- [依赖安装及启用模块](#依赖安装及启用模块) + - [启用模块](#启用模块) +- [快捷键](#快捷键) + - [交互式编程](#交互式编程) + - [运行当前脚本](#运行当前脚本) + + + +## 模块描述 + +这一模块为 SpaceVim 提供了 R 开发支持,包括代码补全、语法检查、以及代码格式化等特性。 + +## 依赖安装及启用模块 + +### 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#r" +``` + +## 快捷键 + +### 交互式编程 + +启动 `r` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | + +### 运行当前脚本 + +在编辑 ruby 文件是,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + diff --git a/docs/layers/lang/r.md b/docs/layers/lang/r.md new file mode 100644 index 000000000..ffd6d6b99 --- /dev/null +++ b/docs/layers/lang/r.md @@ -0,0 +1,56 @@ +--- +title: "SpaceVim lang#r layer" +description: "This layer is for R development, provide autocompletion, syntax checking and code format." +--- + +# [Available Layers](../../) >> lang#r + + + +- [Description](#description) +- [Install](#install) + - [Layer](#layer) +- [Key bindings](#key-bindings) + - [Inferior REPL process](#inferior-repl-process) + - [Running current script](#running-current-script) + + + +## Description + +This layer is for R development. + +## Install + +### Layer + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#r" +``` + +## Key bindings + +### Inferior REPL process + +Start a `R` inferior REPL process with `SPC l s i`. You may change the REPL command by layer option `repl_command`. For example, if you want to use `pry`, load this layer via: + +```toml +[[layers]] + name = "lang#r" + repl_command = "R" +``` + +Send code to inferior process commands: + +| Key Binding | Description | +| ----------- | ------------------------------------------------ | +| `SPC l s b` | send buffer and keep code buffer focused | +| `SPC l s l` | send line and keep code buffer focused | +| `SPC l s s` | send selection text and keep code buffer focused | + +### Running current script + +To running a ruby script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. diff --git a/docs/layers/lang/ruby.md b/docs/layers/lang/ruby.md index a992c0096..7677984a5 100644 --- a/docs/layers/lang/ruby.md +++ b/docs/layers/lang/ruby.md @@ -61,6 +61,7 @@ however, if the executable is not on your $PATH, then you need to specify a comp name = "lang#ruby" repl_command = "/NOT/IN/YOUR/PATH/rubocop" ``` + Send code to inferior process commands: | Key Binding | Description | From 7386553d8953e266d0231fe0c6662d980e0edd3d Mon Sep 17 00:00:00 2001 From: Nikolaus Sucher Date: Tue, 22 Jan 2019 16:27:56 -0500 Subject: [PATCH 020/179] Update init.vim Changed language for OSX and Darwin to en_US.UTF-8. Without this change, unicode characters don't show. --- config/init.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/init.vim b/config/init.vim index fd1e4610f..44b83833b 100644 --- a/config/init.vim +++ b/config/init.vim @@ -13,12 +13,12 @@ try if s:SYSTEM.isWindows silent exec 'lan mes en_US.UTF-8' elseif s:SYSTEM.isOSX - silent exec 'language en_US' + silent exec 'language en_US.UTF-8' else let s:uname = system('uname -s') if s:uname ==# "Darwin\n" " in mac-terminal - silent exec 'language en_US' + silent exec 'language en_US.UTF-8' elseif s:uname ==# "SunOS\n" " in Sun-OS terminal silent exec 'lan en_US.UTF-8' From 7bbb69e3513775732c5f59a28efc518e3ddefeea Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 23 Jan 2019 11:23:12 +0800 Subject: [PATCH 021/179] add lang#red layer (#2486) * add lang#red layer * add code runner and repl support * Add red doc && fix r doc * Improve layers dev script * autodoc --- .SpaceVim.d/autoload/SpaceVim/dev/api.vim | 10 +- .SpaceVim.d/autoload/SpaceVim/dev/layers.vim | 74 +++++---- autoload/SpaceVim/layers/lang/red.vim | 38 +++++ docs/cn/layers.md | 156 +++++++++--------- docs/cn/layers/lang/r.md | 2 +- docs/cn/layers/lang/red.md | 53 ++++++ docs/layers.md | 161 ++++++++++--------- docs/layers/lang/r.md | 2 +- docs/layers/lang/red.md | 57 +++++++ 9 files changed, 354 insertions(+), 199 deletions(-) create mode 100644 autoload/SpaceVim/layers/lang/red.vim create mode 100644 docs/cn/layers/lang/red.md create mode 100644 docs/layers/lang/red.md diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/api.vim b/.SpaceVim.d/autoload/SpaceVim/dev/api.vim index 7cb7b1b2c..d54032bad 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/api.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/api.vim @@ -32,19 +32,19 @@ endfunction function! s:generate_content_cn() abort let content = ['', '## 可用 APIs', ''] - let content += s:layer_list_cn() + let content += s:api_list_cn() let content += [''] return content endfunction function! s:generate_content() abort - let content = ['', '## Available APIs', '', 'here is the list of all available APIs, and welcome to contribute to SpaceVim.', ''] - let content += s:layer_list() + let content = ['', '## Available APIs', '', 'Here is the list of all available APIs, and welcome to contribute to SpaceVim.', ''] + let content += s:api_list() let content += [''] return content endfunction -function! s:layer_list() abort +function! s:api_list() abort let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/api/**/*.md') let list = [ \ '| Name | Description |', @@ -69,7 +69,7 @@ function! s:layer_list() abort return list endfunction -function! s:layer_list_cn() abort +function! s:api_list_cn() abort let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/cn/api/**/*.md') let list = [ \ '| 名称 | 描述 |', diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim b/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim index fae40485e..4876474e3 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/layers.vim @@ -8,17 +8,26 @@ scriptencoding utf-8 +let s:FILE = SpaceVim#api#import('file') +let s:SYS = SpaceVim#api#import('system') + + + +let s:AUTODOC = SpaceVim#api#import('dev#autodoc') +let s:AUTODOC.autoformat = 1 + function! SpaceVim#dev#layers#update() abort + let s:AUTODOC.begin = '^$' + let s:AUTODOC.end = '^$' + let s:AUTODOC.content_func = function('s:generate_content') + call s:AUTODOC.update() +endfunction - let [start, end] = s:find_position() - if start != 0 && end != 0 - if end - start > 1 - exe (start + 1) . ',' . (end - 1) . 'delete' - endif - call append(start, s:generate_content()) - silent! Neoformat - endif - +function! SpaceVim#dev#layers#updateCn() abort + let s:AUTODOC.begin = '^$' + let s:AUTODOC.end = '^$' + let s:AUTODOC.content_func = function('s:generate_content_cn') + call s:AUTODOC.update() endfunction function! SpaceVim#dev#layers#updatedocker() abort @@ -31,19 +40,6 @@ function! SpaceVim#dev#layers#updatedocker() abort endif endfunction -function! SpaceVim#dev#layers#updateCn() abort - - let [start, end] = s:find_position_cn() - if start != 0 && end != 0 - if end - start > 1 - exe (start + 1) . ',' . (end - 1) . 'delete' - endif - call append(start, s:generate_content_cn()) - silent! Neoformat - endif - -endfunction - function! s:find_position() abort let start = search('^$','bwnc') let end = search('^$','bnwc') @@ -99,18 +95,19 @@ function! s:layer_list() abort \ '| Name | Description |', \ '| ---------- | ------------ |' \ ] - call remove(layers, index(layers, '/home/wsdjeg/.SpaceVim/docs/layers/index.md')) + if s:SYS.isWindows + let pattern = join(['', 'docs', 'layers', ''], s:FILE.separator . s:FILE.separator) + else + let pattern = join(['', 'docs', 'layers', ''], s:FILE.separator) + endif for layer in layers - let name = split(layer, '/docs/layers/')[1][:-4] . '/' - let url = name - if name ==# 'language-server-protocol/' - let name = 'lsp' - endif + let name = split(layer, pattern)[1][:-4] . s:FILE.separator + let url = join(split(name, s:FILE.separator), '/') . '/' let content = readfile(layer) if len(content) > 3 - let line = '| [' . join(split(name, '/'), '#') . '](' . url . ') | ' . content[2][14:-2] . ' | ' + let line = '| [' . join(split(name, s:FILE.separator), '#') . '](' . url . ') | ' . content[2][14:-2] . ' | ' else - let line = '| [' . join(split(name, '/'), '#') . '](' . url . ') | can not find Description |' + let line = '| [' . join(split(name, s:FILE.separator), '#') . '](' . url . ') | can not find Description |' endif call add(list, line) endfor @@ -123,18 +120,19 @@ function! s:layer_list_cn() abort \ '| 名称 | 描述 |', \ '| ---------- | ------------ |' \ ] - call remove(layers, index(layers, '/home/wsdjeg/.SpaceVim/docs/cn/layers/index.md')) + if s:SYS.isWindows + let pattern = join(['', 'docs', 'cn', 'layers', ''], s:FILE.separator . s:FILE.separator) + else + let pattern = join(['', 'docs', 'cn', 'layers', ''], s:FILE.separator) + endif for layer in layers - let name = split(layer, '/docs/cn/layers/')[1][:-4] . '/' - let url = name - if name ==# 'language-server-protocol/' - let name = 'lsp' - endif + let name = split(layer, pattern)[1][:-4] . s:FILE.separator + let url = join(split(name, s:FILE.separator), '/') . '/' let content = readfile(layer) if len(content) > 3 - let line = '| [' . join(split(name, '/'), '#') . '](' . url . ') | ' . content[2][14:-2] . ' | ' + let line = '| [' . join(split(name, s:FILE.separator), '#') . '](' . url . ') | ' . content[2][14:-2] . ' | ' else - let line = '| [' . join(split(name, '/'), '#') . '](' . url . ') | can not find Description |' + let line = '| [' . join(split(name, s:FILE.separator), '#') . '](' . url . ') | can not find Description |' endif call add(list, line) endfor diff --git a/autoload/SpaceVim/layers/lang/red.vim b/autoload/SpaceVim/layers/lang/red.vim new file mode 100644 index 000000000..eac213a57 --- /dev/null +++ b/autoload/SpaceVim/layers/lang/red.vim @@ -0,0 +1,38 @@ +"============================================================================= +" red.vim --- red language layer +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +function! SpaceVim#layers#lang#red#plugins() abort + let plugins = [] + call add(plugins, ['DavidFeng/vim-red', {'merged' : 0}]) + return plugins +endfunction + + +function! SpaceVim#layers#lang#red#config() abort + call SpaceVim#plugins#runner#reg_runner('red', 'red --cli %s') + call SpaceVim#mapping#space#regesit_lang_mappings('red', function('s:language_specified_mappings')) + call SpaceVim#plugins#repl#reg('red', 'red --cli') +endfunction + +function! s:language_specified_mappings() abort + call SpaceVim#mapping#space#langSPC('nmap', ['l', 'r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) + let g:_spacevim_mappings_space.l.s = {'name' : '+Send'} + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'], + \ 'call SpaceVim#plugins#repl#start("red")', + \ 'start REPL process', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'], + \ 'call SpaceVim#plugins#repl#send("line")', + \ 'send line and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'], + \ 'call SpaceVim#plugins#repl#send("buffer")', + \ 'send buffer and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'], + \ 'call SpaceVim#plugins#repl#send("selection")', + \ 'send selection and keep code buffer focused', 1) +endfunction diff --git a/docs/cn/layers.md b/docs/cn/layers.md index 571e1027c..47358fae6 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -51,88 +51,90 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 enable = false ``` - + ## 可用模块 -| 名称 | 描述 | -| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| [autocomplete](autocomplete/) | 这一模块为 SpaceVim 提供了自动补全的框架,包括语法补全等多种补全来源,同时提供了代码块自动完成等特性。 | -| [chat](chat/) | 这一模块为 SpaceVim 提供了一个聊天框架,目前支持微信聊天和 QQ 聊天,同时支持自定义聊天服务器。 | -| [checkers](checkers/) | 这一模块为 SpaceVim 提供了代码语法检查的特性,同时提供代码实时检查,并列出语法错误的位置。 | -| [chinese](chinese/) | 这一模块为 SpaceVim 的中文用户提供了中文的 Vim 帮助文档,同时提供部分插件的中文帮助文档。 | -| [colorscheme](colorscheme/) | 这一模块为 SpaceVim 提供了一系列的常用颜色主题,默认情况下使用深色 gruvbox 作为默认主题。该模块提供了快速切换主题、随机主题等特性。 | -| [core#banner](core/banner/) | 这一模块为 SpaceVim 提供了许多可以默认显示在首页的 Logo。 | -| [core#statusline](core/statusline/) | 这一模块为 SpaceVim 提供了默认的模式化的状态栏支持。 | -| [core#tabline](core/tabline/) | 这一模块为 SpaceVim 提供了一个更好的标签栏。 | -| [core](core/) | 这一模块为 SpaceVim 提供了启动及基本操作所必须的插件及配置。 | -| [cscope](cscope/) | 这一模块为 SpaceVim 提供了一个智能的 cscope 和 pycscope 辅助工具,可以快速调用 cscope 常用命令。 | -| [ctrlp](ctrlp/) | 这一模块为 SpaceVim 提供以 ctrlp 为核心的模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | -| [debug](debug/) | 这一模块为 SpaceVim 提供了 debug 的常用功能,采用 vebugger 作为后台框架,支持多种 debug 工具。 | -| [default](default/) | 这一模块未为 SpaceVim 提供任何插件,但提供了一些更好的默认设置。 | -| [denite](denite/) | 这一模块为 SpaceVim 提供了以 denite 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | -| [edit](edit/) | 这一模块为 SpaceVim 提供了更好的文本编辑体验,提供更多种文本对象。 | -| [floobits](floobits/) | 这一模块为 SpaceVim 提供了 floobits 协作工具的支持,实现多人协作编辑等功能。 | -| [format](format/) | 这一模块为 SpaceVim 提供了代码异步格式化功能,支持高度自定义配置和多种语言。 | -| [fzf](fzf/) | 这一模块为 SpaceVim 提供了以 fzf 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | -| [git](git/) | 这一模块为 SpaceVim 提供了 Git 支持,根据当前 Vim 版本特性,选择 gina 或者 gita 作为默认的后台 Git 插件。 | -| [github](github/) | 这一模块为 SpaceVim 提供了 Github 数据管理功能,包括问题列表、动态等管理。 | -| [japanese](japanese/) | 这一模块为 SpaceVim 的日文用户提供了日文的 Vim 帮助文档,同时提供部分插件的日文帮助文档。 | -| [lang#agda](lang/agda/) | 这一模块为 SpaceVim 提供了 Agda 的开发支持,主要包括语法高亮及一键运行。 | -| [lang#asciidoc](lang/asciidoc/) | 这一模块为 SpaceVim 提供了 AsciiDoc 的编辑支持,包括格式化、自动生成文章目录、代码块等特性。 | -| [lang#autohotkey](lang/autohotkey/) | 这一模块为 SpaceVim 提供了 Autohotkey 的开发支持,包括语法高亮和自动补全等功能。 | -| [lang#c](lang/c/) | 这一模块为 SpaceVim 提供了 C/C++/Object-C 的开发支持,包括代码补全、语法检查等特性。 | -| [lang#clojure](lang/clojure/) | 这一模块为 SpaceVim 提供了 Clojure 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#csharp](lang/csharp/) | 这一模块为 SpaceVim 提供了 CSharp 的开发支持,包括代码高亮、对齐、补全等特性。 | -| [lang#dart](lang/dart/) | 这一模块为 SpaceVim 提供了 Dart 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#dockerfile](lang/dockerfile/) | 这一模块为 SpaceVim 提供了 Dockerfile 编辑的部分功能支持,包括语法高亮和自动补全。 | -| [lang#elixir](lang/elixir/) | 这一模块为 SpaceVim 提供了 Elixir 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#elm](lang/elm/) | 这一模块为 SpaceVim 提供了 Elm 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#erlang](lang/erlang/) | 这一模块为 SpaceVim 提供了 Erlang 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#extra](lang/extra/) | 这一模块为 SpaceVim 提供了一些不常见的语言的语法支持,主要包括语法高亮、对齐等特性。 | -| [lang#fsharp](lang/fsharp/) | 这一模块为 SpaceVim 提供了 FSharp 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#go](lang/go/) | 这一模块为 SpaceVim 提供了 Go 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#haskell](lang/haskell/) | 这一模块为 SpaceVim 提供了 Haskell 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#html](lang/html/) | 这一模块为 SpaceVim 提供了 HTML 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#java](lang/java/) | 这一模块为 SpaceVim 提供了 Java 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#javascript](lang/javascript/) | 这一模块为 SpaceVim 提供了 JavaScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#julia](lang/julia/) | 这一模块为 SpaceVim 提供了 Julia 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#kotlin](lang/kotlin/) | 这一模块为 SpaceVim 提供了 kotlin 的开发支持,包括语法高亮、语言服务器支持。 | -| [lang#latex](lang/latex/) | 这一模块为 SpaceVim 提供了 LaTeX 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#lisp](lang/lisp/) | 这一模块为 SpaceVim 提供了 LISP 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#lua](lang/lua/) | 这一模块为 SpaceVim 提供了 Lua 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#markdown](lang/markdown/) | 这一模块为 SpaceVim 提供了 Markdown 编辑支持,包括格式化、自动生成文档目录、代码块等特性。 | -| [lang#nim](lang/nim/) | 这一模块为 SpaceVim 提供了 Nim 的开发支持,包括语法高亮、代码补全、编译运行以及交互式编程等功能。 | -| [lang#ocaml](lang/ocaml/) | 这一模块为 SpaceVim 提供了 OCaml 开发提供了支持,包括语法高亮、代码补全、以及定义处跳转等功能。 | -| [lang#perl](lang/perl/) | 这一模块为 SpaceVim 提供了 Perl 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#php](lang/php/) | 这一模块为 SpaceVim 提供了 PHP 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#plantuml](lang/plantuml/) | 这一模块为 SpaceVim 提供了 PlantUML 的开发支持,包括语法高亮、实时预览等特性。 | -| [lang#puppet](lang/puppet/) | 这一模块为 SpaceVim 提供了 Puppet 的开发支持,包括语法高亮、语言服务器支持。 | -| [lang#purescript](lang/purescript/) | 这一模块为 SpaceVim 提供了 PureScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#python](lang/python/) | 这一模块为 SpaceVim 提供了 Python 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#ruby](lang/ruby/) | 这一模块为 SpaceVim 提供了 Ruby 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#rust](lang/rust/) | 这一模块为 SpaceVim 提供了 Rust 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#scala](lang/scala/) | 这一模块为 SpaceVim 提供了 Scala 的开发支持,包括语法高亮,函数列表等特性 | -| [lang#scheme](lang/scheme/) | 这一模块为 SpaceVim 提供了 Scheme 语言开发支持,包括语法高亮、语言服务器支持。 | -| [lang#sh](lang/sh/) | 这一模块为 SpaceVim 提供了 Shell Script 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#swift](lang/swift/) | 这一模块为 SpaceVim 提供了 Swift 的开发支持,包括语法高亮、语法检查等特性。 | -| [lang#typescript](lang/typescript/) | 这一模块为 SpaceVim 提供了 Typescript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#vim](lang/vim/) | 这一模块为 SpaceVim 提供了 Vimscript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#vue](lang/vue/) | 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#WebAssembly](lang/WebAssembly/) | 这一模块为 SpaceVim 提供了 WebAssembly 的开发支持。 | -| [leaderf](leaderf/) | 这一模块为 SpaceVim 提供了以 leaderf 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | -| [lsp](language-server-protocol/) | 这一模块为 SpaceVim 提供了 language server protocol 的支持,提供更多语言相关服务。 | -| [shell](shell/) | 这一模块为 SpaceVim 提供了终端集成特性,优化内置终端的使用体验。 | -| [sudo](sudo/) | 这一模块为 SpaceVim 提供了以管理员身份读写文件的功能。 | -| [tags](tags/) | 这一模块为 SpaceVim 提供了全局的 tags 索引管理,提供快速检索定义和引用的功能。 | -| [tmux](tmux/) | 这一模块为 SpaceVim 提供了一些在 Vim 内操作 tmux 的功能,使得在 tmux 窗口之间跳转更加便捷。 | -| [tools#dash](tools/dash/) | 这一模块为 SpaceVim 提供了 Dash 支持,可快速查找光标位置的单词。 | -| [tools](tools/) | 这一模块为 SpaceVim 提供了多种常用工具,包括日历、计算器等多种工具类插件,并针对 Vim8 以及 Neovim 提供了更好的插件选择。 | -| [ui](ui/) | 这一模块为 SpaceVim 提供了 IDE-like 的界面,包括状态栏、文件树、语法树等等特性。 | -| [VersionControl](VersionControl/) | 这一模块为 SpaceVim 提供了通用的代码版本控制支持,该模块支持 Git、Mercurial、Bazaar、SVN 等等多种后台工具。 | - +| 名称 | 描述 | +| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| [autocomplete](autocomplete/) | 这一模块为 SpaceVim 提供了自动补全的框架,包括语法补全等多种补全来源,同时提供了代码块自动完成等特性。 | +| [chat](chat/) | 这一模块为 SpaceVim 提供了一个聊天框架,目前支持微信聊天和 QQ 聊天,同时支持自定义聊天服务器。 | +| [checkers](checkers/) | 这一模块为 SpaceVim 提供了代码语法检查的特性,同时提供代码实时检查,并列出语法错误的位置。 | +| [chinese](chinese/) | 这一模块为 SpaceVim 的中文用户提供了中文的 Vim 帮助文档,同时提供部分插件的中文帮助文档。 | +| [colorscheme](colorscheme/) | im colorscheme 模块 | +| [core#banner](core/banner/) | 这一模块为 SpaceVim 提供了许多显示在启动界面的 Logo。 | +| [core#statusline](core/statusline/) | 这一模块为 SpaceVim 提供了默认的模式化的状态栏支持。 | +| [core#tabline](core/tabline/) | 这一模块为 SpaceVim 提供了更好的标签栏。 | +| [core](core/) | 这一模块为 SpaceVim 提供了启动及基本操作所必须的插件及配置。 | +| [cscope](cscope/) | 这一模块为 SpaceVim 提供了一个智能的 cscope 和 pycscope 辅助工具,可以快速调用 cscope 常用命令。 | +| [ctrlp](ctrlp/) | 这一模块为 SpaceVim 提供以 ctrlp 为核心的模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | +| [debug](debug/) | 这一模块为 SpaceVim 提供了 Debug 的常用功能,采用 vebugger 作为后台框架,支持多种 Debug 工具。 | +| [default](default/) | 这一模块未为 SpaceVim 提供任何插件,但提供了一些更好的默认设置。 | +| [denite](denite/) | 这一模块为 SpaceVim 提供了以 denite 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | +| [edit](edit/) | 这一模块为 SpaceVim 提供了更好的文本编辑体验,提供更多种文本对象。 | +| [floobits](floobits/) | 这一模块为 SpaceVim 提供了 floobits 协作工具的支持,实现多人协作编辑等功能。 | +| [format](format/) | 这一模块为 SpaceVim 提供了代码异步格式化功能,支持高度自定义配置和多种语言。 | +| [fzf](fzf/) | 这一模块为 SpaceVim 提供了以 fzf 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | +| [git](git/) | 这一模块为 SpaceVim 提供了 Git 支持,根据当前 Vim 版本特性,选择 gina 或者 gita 作为默认的后台 Git 插件。 | +| [github](github/) | 这一模块为 SpaceVim 提供了 Github 数据管理功能,包括问题列表、动态等管理。 | +| [japanese](japanese/) | 这一模块为 SpaceVim 的日文用户提供了日文的 Vim 帮助文档,同时提供部分插件的日文帮助文档。 | +| [lang#agda](lang/agda/) | 这一模块为 SpaceVim 提供了 Agda 的开发支持,主要包括语法高亮及一键运行。 | +| [lang#asciidoc](lang/asciidoc/) | 这一模块为 SpaceVim 提供了 AsciiDoc 的编辑支持,包括格式化、自动生成文章目录、代码块等特性。 | +| [lang#autohotkey](lang/autohotkey/) | 这一模块为 SpaceVim 提供了 Autohotkey 的开发支持,包括语法高亮和自动补全等功能。 | +| [lang#c](lang/c/) | 这一模块为 SpaceVim 提供了 C/C++/Object-C 的开发支持,包括代码补全、语法检查等特性。 | +| [lang#clojure](lang/clojure/) | 这一模块为 SpaceVim 提供了 Clojure 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#csharp](lang/csharp/) | 这一模块为 SpaceVim 提供了 CSharp 的开发支持,包括代码高亮、对齐、补全等特性。 | +| [lang#dart](lang/dart/) | 这一模块为 SpaceVim 提供了 Dart 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#dockerfile](lang/dockerfile/) | 这一模块为 SpaceVim 提供了 Dockerfile 编辑的部分功能支持,包括语法高亮和自动补全。 | +| [lang#elixir](lang/elixir/) | 这一模块为 SpaceVim 提供了 Elixir 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#elm](lang/elm/) | 这一模块为 SpaceVim 提供了 Elm 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#erlang](lang/erlang/) | 这一模块为 erlang 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#extra](lang/extra/) | 这一模块为 SpaceVim 提供了一些不常见的语言添加语法支持,主要包括语法高亮、对齐等特性。 | +| [lang#fsharp](lang/fsharp/) | 这一模块为 SpaceVim 提供了 FSharp 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#go](lang/go/) | 这一模块为 SpaceVim 提供了 Go 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#haskell](lang/haskell/) | 这一模块为 SpaceVim 提供了 Haskell 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#html](lang/html/) | 这一模块为 SpaceVim 提供了 HTML 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#java](lang/java/) | 这一模块为 java 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#javascript](lang/javascript/) | 这一模块为 javascript 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#julia](lang/julia/) | 这一模块为 julia 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#kotlin](lang/kotlin/) | 该模块为 SpaceVim 提供了 kotlin 语言开发支持,包括语法高亮、语言服务器支持。 | +| [lang#latex](lang/latex/) | 这一模块为 latex 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#lisp](lang/lisp/) | 这一模块为 lisp 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#lua](lang/lua/) | 这一模块为 lua 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#markdown](lang/markdown/) | 这一模块为 markdown 编辑提供支持,包括格式化、自动生成文章目录、代码块等特性。 | +| [lang#nim](lang/nim/) | 该模块为 SpaceVim 提供 nim 开发支持,包括语法高亮、代码补全、编译运行以及交互式编程等功能。 | +| [lang#ocaml](lang/ocaml/) | 这一模块为 ocaml 开发提供了支持,包括语法高亮、代码补全、以及定义处跳转等功能。 | +| [lang#perl](lang/perl/) | 这一模块为 perl 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#php](lang/php/) | 这一模块为 SpaceVim 提供了 PHP 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#plantuml](lang/plantuml/) | 这一模块为 SpaceVim 提供了 PlantUML 的开发支持,包括语法高亮、实时预览等特性。 | +| [lang#puppet](lang/puppet/) | 这一模块为 SpaceVim 提供了 Puppet 的开发支持,包括语法高亮、语言服务器支持。 | +| [lang#purescript](lang/purescript/) | 这一模块为 SpaceVim 提供了 PureScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#python](lang/python/) | 这一模块为 python 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#r](lang/r/) | 这一模块为 R 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#red](lang/red/) | 这一模块为 red 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#ruby](lang/ruby/) | 这一模块为 ruby 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#rust](lang/rust/) | 这一模块为 rust 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#scala](lang/scala/) | 这一模块为 scala 开发提供支持,包括语法高亮,函数列表等特性 | +| [lang#scheme](lang/scheme/) | 这一模块为 SpaceVim 提供了 Scheme 语言开发支持,包括语法高亮、语言服务器支持。 | +| [lang#sh](lang/sh/) | 这一模块为 SpaceVim 提供了 Shell Script 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#swift](lang/swift/) | 这一模块为 SpaceVim 提供了 Swift 的开发支持,包括语法高亮、语法检查等特性。 | +| [lang#typescript](lang/typescript/) | 这一模块为 SpaceVim 提供了 Typescript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#vim](lang/vim/) | 这一模块为 SpaceVim 提供了 Vimscript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#vue](lang/vue/) | 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#WebAssembly](lang/WebAssembly/) | 这一模块为 SpaceVim 提供了 WebAssembly 的开发支持。 | +| [language-server-protocol](language-server-protocol/) | 这一模块为 SpaceVim 提供了 language server protocol 的支持,提供更多语言相关服务。 | +| [leaderf](leaderf/) | 这一模块为 SpaceVim 提供了以 leaderf 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | +| [shell](shell/) | 这一模块为 SpaceVim 提供了终端集成特性,优化内置终端的使用体验。 | +| [sudo](sudo/) | 这一模块为 SpaceVim 提供了以管理员身份读写文件的功能。 | +| [tags](tags/) | 这一模块为 SpaceVim 提供了全局的 tags 索引管理,提供快速检索定义和引用的功能。 | +| [tmux](tmux/) | 这一模块为 SpaceVim 提供了一些在 Vim 内操作 tmux 的功能,使得在 tmux 窗口之间跳转更加便捷。 | +| [tools#dash](tools/dash/) | 这一模块为 SpaceVim 提供了 Dash 支持,可快速查找光标位置的单词。 | +| [tools](tools/) | 这一模块为 SpaceVim 提供了多种常用工具,包括日历、计算器等多种工具类插件,并针对 Vim8 以及 Neovim 提供了更好的插件选择。 | +| [ui](ui/) | 这一模块为 SpaceVim 提供了 IDE-like 的界面,包括状态栏、文件树、语法树等等特性。 | +| [unite](unite/) | 这一模块为 SpaceVim 提供以 unite 为核心的模糊查找机制,支持模糊搜索文件、历史纪录、函数列表等。 | +| [VersionControl](VersionControl/) | 这一模块为 SpaceVim 提供了通用的代码版本控制支持,该模块支持 Git、Mercurial、Bazaar、SVN 等等多种后台工具。 | diff --git a/docs/cn/layers/lang/r.md b/docs/cn/layers/lang/r.md index 09aee9b7f..18bb4cdbd 100644 --- a/docs/cn/layers/lang/r.md +++ b/docs/cn/layers/lang/r.md @@ -48,5 +48,5 @@ lang: cn ### 运行当前脚本 -在编辑 ruby 文件是,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 +在编辑 R 文件是,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 diff --git a/docs/cn/layers/lang/red.md b/docs/cn/layers/lang/red.md new file mode 100644 index 000000000..fe385eb5e --- /dev/null +++ b/docs/cn/layers/lang/red.md @@ -0,0 +1,53 @@ +--- +title: "SpaceVim lang#red 模块" +description: "这一模块为 red 开发提供支持,包括代码补全、语法检查、代码格式化等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#red + + + +- [模块描述](#模块描述) +- [依赖安装及启用模块](#依赖安装及启用模块) + - [启用模块](#启用模块) +- [快捷键](#快捷键) + - [交互式编程](#交互式编程) + - [运行当前脚本](#运行当前脚本) + + + +## 模块描述 + +这一模块为 SpaceVim 提供了 red 开发支持,包括代码补全、语法检查、以及代码格式化等特性。 + +## 依赖安装及启用模块 + +### 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#red" +``` + +## 快捷键 + +### 交互式编程 + +启动 `red --cli` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | + +### 运行当前脚本 + +在编辑 ruby 文件是,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + + diff --git a/docs/layers.md b/docs/layers.md index 0a354ddee..cd20ce5d3 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -1,5 +1,5 @@ --- -title: Available layers +title: Available layers description: "A guide for managing SpaceVim with layers, tell you how to enable and disable a layer, also list all available layers in SpaceVim" --- @@ -57,86 +57,93 @@ Some layers are enabled by default. The following example shows how to disable ` enable = false ``` + + ## Available layers -| Name | Description | -| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [autocomplete](autocomplete/) | Autocomplete code within SpaceVim, fuzzy find the candidates from multiple completion sources, expand snippet before cursor automatically | -| [chat](chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. | -| [checkers](checkers/) | Syntax checking automatically within SpaceVim, display error on the sign column and statusline. | -| [chinese](chinese/) | Layer for chinese users, include chinese docs and runtime messages | -| [colorscheme](colorscheme/) | colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme. | -| [core#banner](core/banner/) | This layer provides many default banner on welcome page. | -| [core#statusline](core/statusline/) | This layer provides default statusline for SpaceVim | -| [core#tabline](core/tabline/) | SpaceVim core#tabline layer provides a better tabline for SpaceVim | -| [core](core/) | SpaceVim core layer provides many default key bindings and features. | -| [cscope](cscope/) | cscope layer provides a smart cscope and pycscope helper for SpaceVim, help users win at cscope | -| [ctrlp](ctrlp/) | This layers provide a heavily customized ctrlp centric work-flow | -| [debug](debug/) | This layer provide debug workflow support in SpaceVim | -| [default](default/) | SpaceVim default layer contains no plugins, but It provides some better default config for SpaceVim. | -| [denite](denite/) | This layers provide a heavily customized Denite centric work-flow | -| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. | -| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. | -| [format](format/) | Code formatting support for SpaceVim | -| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow | -| [git](git/) | This layers adds extensive support for git | -| [github](github/) | This layer provides GitHub integration for SpaceVim | -| [japanese](japanese/) | Layer for japanese users, include japanese docs and runtime messages | -| [lang#agda](lang/agda/) | This layer adds agda language support to SpaceVim | -| [lang#asciidoc](lang/asciidoc/) | Edit asciidoc within vim, autopreview asciidoc in the default browser, with this layer you can also format asciidoc file. | -| [lang#autohotkey](lang/autohotkey/) | This layer adds autohotkey language support to SpaceVim | -| [lang#c](lang/c/) | c/c++/object-c language support for SpaceVim, include code completion, jump to definition, quick runner. | -| [lang#clojure](lang/clojure/) | This layer is for clojure development, provide autocompletion, syntax checking, code format for clojure file. | -| [lang#csharp](lang/csharp/) | This layer is for csharp development | -| [lang#dart](lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. | -| [lang#dockerfile](lang/dockerfile/) | This layer adds DockerFile to SpaceVim | -| [lang#elixir](lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. | -| [lang#elm](lang/elm/) | This layer is for elm development, provide autocompletion, syntax checking, code format for elm file. | -| [lang#erlang](lang/erlang/) | This layer is for erlang development, provide autocompletion, syntax checking, code format for erlang file. | -| [lang#extra](lang/extra/) | This layer adds extra language support to SpaceVim | -| [lang#fsharp](lang/fsharp/) | This layer adds fsharp language support to SpaceVim | -| [lang#go](lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. | -| [lang#haskell](lang/haskell/) | haskell language support for SpaceVim, includes code completion, syntax checking, jumping to definition, also provides language server protocol support for haskell | -| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. | -| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. | -| [lang#javascript](lang/javascript/) | This layer is for JavaScript development | -| [lang#julia](lang/julia/) | This layer is for julia development, provide autocompletion, syntax checking and code formatting | -| [lang#kotlin](lang/kotlin/) | This layer adds kotlin language support to SpaceVim | -| [lang#latex](lang/latex/) | This layer provides support for writing LaTeX documents, including syntax highlighting, code completion, formatting etc. | -| [lang#lisp](lang/lisp/) | This layer is for lisp development, provide autocompletion, syntax checking, code format for lisp file. | -| [lang#lua](lang/lua/) | This layer is for lua development, provide autocompletion, syntax checking, code format for lua file. | -| [lang#markdown](lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. | -| [lang#nim](lang/nim/) | This layer adds nim language support to SpaceVim | -| [lang#ocaml](lang/ocaml/) | This layer is for ocaml development, provide autocompletion, syntax checking, code format for ocaml file. | -| [lang#perl](lang/perl/) | This layer is for perl development, provide autocompletion, syntax checking, code format for perl file. | -| [lang#php](lang/php/) | This layer adds PHP language support to SpaceVim | -| [lang#plantuml](lang/plantuml/) | This layer is for plantuml development, syntax highlighting for plantuml file. | -| [lang#puppet](lang/puppet/) | This layer adds puppet language support to SpaceVim | -| [lang#purescript](lang/purescript/) | This layer is for purescript development, provide autocompletion, syntax checking, code format for purescript file. | -| [lang#python](lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for python file. | -| [lang#ruby](lang/ruby/) | This layer is for ruby development, provide autocompletion, syntax checking, code format for ruby file. | -| [lang#rust](lang/rust/) | This layer is for rust development, provide autocompletion, syntax checking, code format for rust file. | -| [lang#scala](lang/scala/) | This layer adds scala language support to SpaceVim | -| [lang#scheme](lang/scheme/) | This layer adds scheme language support to SpaceVim | -| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. | -| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion, syntax highlighting | -| [lang#typescript](lang/typescript/) | This layer is for TypeScript development | -| [lang#vim](lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting | -| [lang#vue](lang/vue/) | This layer adds vue language support to SpaceVim | -| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim | -| [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow | -| [lsp](language-server-protocol/) | This layers provides language server protocol for vim and neovim | -| [shell](shell/) | This layer provide shell support in SpaceVim | -| [sudo](sudo/) | sudo layer provides ability to read and write file elevated privileges in SpaceVim | -| [tags](tags/) | This layer provide tags manager for project | -| [tests](tests/) | This layer allows to run tests directly on SpaceVim | -| [tmux](tmux/) | This layers adds extensive support for tmux | -| [tools#dash](tools/dash/) | This layer provides Dash integration for SpaceVim | -| [tools](tools/) | This layer provides some tools for vim | -| [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI | -| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… | +| Name | Description | +| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [autocomplete](autocomplete/) | Autocomplete code within SpaceVim, fuzzy find the candidates from multiple completion sources, expand snippet before cursor automatically | +| [chat](chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. | +| [checkers](checkers/) | Syntax checking automatically within SpaceVim, display error on the sign column and statusline. | +| [chinese](chinese/) | Layer for chinese users, include chinese docs and runtime messages | +| [colorscheme](colorscheme/) | colorscheme provides a list of colorscheme for SpaceVim, default colorscheme is gruvbox with dark theme. | +| [core#banner](core/banner/) | This layer provides many default banner on welcome page. | +| [core#statusline](core/statusline/) | This layer provides default statusline for SpaceVim | +| [core#tabline](core/tabline/) | SpaceVim core#tabline layer provides a better tabline for SpaceVim | +| [core](core/) | SpaceVim core layer provides many default key bindings and features. | +| [cscope](cscope/) | cscope layer provides a smart cscope and pycscope helper for SpaceVim, help users win at cscope | +| [ctrlp](ctrlp/) | This layers provide a heavily customized ctrlp centric work-flow | +| [debug](debug/) | This layer provide debug workflow support in SpaceVim | +| [default](default/) | SpaceVim default layer contains no plugins, but It provides some better default config for SpaceVim. | +| [denite](denite/) | This layers provide a heavily customized Denite centric work-flow | +| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. | +| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. | +| [format](format/) | Code formatting support for SpaceVim | +| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow | +| [git](git/) | This layers adds extensive support for git | +| [github](github/) | This layer provides GitHub integration for SpaceVim | +| [japanese](japanese/) | Layer for japanese users, include japanese docs and runtime messages | +| [lang#agda](lang/agda/) | This layer adds agda language support to SpaceVim | +| [lang#asciidoc](lang/asciidoc/) | Edit asciidoc within vim, autopreview asciidoc in the default browser, with this layer you can also format asciidoc file. | +| [lang#autohotkey](lang/autohotkey/) | This layer adds autohotkey language support to SpaceVim | +| [lang#c](lang/c/) | c/c++/object-c language support for SpaceVim, include code completion, jump to definition, quick runner. | +| [lang#clojure](lang/clojure/) | This layer is for clojure development, provide autocompletion, syntax checking, code format for clojure file. | +| [lang#csharp](lang/csharp/) | This layer is for csharp development | +| [lang#dart](lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. | +| [lang#dockerfile](lang/dockerfile/) | This layer adds DockerFile to SpaceVim | +| [lang#elixir](lang/elixir/) | This layer is for elixir development, provide autocompletion, syntax checking, code format for elixir file. | +| [lang#elm](lang/elm/) | This layer is for elm development, provide autocompletion, syntax checking, code format for elm file. | +| [lang#erlang](lang/erlang/) | This layer is for erlang development, provide autocompletion, syntax checking, code format for erlang file. | +| [lang#extra](lang/extra/) | This layer adds extra language support to SpaceVim | +| [lang#fsharp](lang/fsharp/) | This layer adds fsharp language support to SpaceVim | +| [lang#go](lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. | +| [lang#graphql](lang/graphql/) | This layer adds graphql file support to SpaceVim | +| [lang#haskell](lang/haskell/) | haskell language support for SpaceVim, includes code completion, syntax checking, jumping to definition, also provides language server protocol support for haskell | +| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. | +| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. | +| [lang#javascript](lang/javascript/) | This layer is for JaveScript development | +| [lang#julia](lang/julia/) | This layer is for julia development, provide autocompletion, syntax checking and code formatting | +| [lang#kotlin](lang/kotlin/) | This layer adds kotlin language support to SpaceVim | +| [lang#latex](lang/latex/) | This layer provides support for writing LaTeX documents, including syntax highlighting, code completion, formatting etc. | +| [lang#lisp](lang/lisp/) | This layer is for lisp development, provide autocompletion, syntax checking, code format for lisp file. | +| [lang#lua](lang/lua/) | This layer is for lua development, provide autocompletion, syntax checking, code format for lua file. | +| [lang#markdown](lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. | +| [lang#nim](lang/nim/) | This layer adds nim language support to SpaceVim | +| [lang#ocaml](lang/ocaml/) | This layer is for ocaml development, provide autocompletion, syntax checking, code format for ocaml file. | +| [lang#perl](lang/perl/) | This layer is for perl development, provide autocompletion, syntax checking, code format for perl file. | +| [lang#php](lang/php/) | This layer adds PHP language support to SpaceVim | +| [lang#plantuml](lang/plantuml/) | This layer is for plantuml development, syntax highlighting for plantuml file. | +| [lang#puppet](lang/puppet/) | This layer adds puppet language support to SpaceVim | +| [lang#purescript](lang/purescript/) | This layer is for purescript development, provide autocompletion, syntax checking, code format for purescript file. | +| [lang#python](lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for python file. | +| [lang#r](lang/r/) | This layer is for R development, provide autocompletion, syntax checking and code format. | +| [lang#red](lang/red/) | This layer is for red development, provide autocompletion, syntax checking and code format. | +| [lang#ruby](lang/ruby/) | This layer is for ruby development, provide autocompletion, syntax checking, code format for ruby file. | +| [lang#rust](lang/rust/) | This layer is for rust development, provide autocompletion, syntax checking, code format for rust file. | +| [lang#scala](lang/scala/) | This layer adds scala language support to SpaceVim | +| [lang#scheme](lang/scheme/) | This layer adds scheme language support to SpaceVim | +| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. | +| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion, syntax highlighting | +| [lang#typescript](lang/typescript/) | This layer is for TypeScript development | +| [lang#vim](lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting | +| [lang#vue](lang/vue/) | This layer adds vue language support to SpaceVim | +| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim | +| [language-server-protocol](language-server-protocol/) | This layers provides language server protocol for vim and neovim | +| [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow | +| [shell](shell/) | This layer provide shell support in SpaceVim | +| [sudo](sudo/) | sudo layer provides ability to read and write file elevated privileges in SpaceVim | +| [tags](tags/) | This layer provide tags manager for project | +| [test](test/) | This layer allows to run tests directly on SpaceVim | +| [tmux](tmux/) | This layers adds extensive support for tmux | +| [tools#dash](tools/dash/) | This layer provides Dash integration for SpaceVim | +| [tools#zeal](tools/zeal/) | This layer provides Zeal integration for SpaceVim | +| [tools](tools/) | This layer provides some tools for vim | +| [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI | +| [unite](unite/) | This layers provide a heavily customized Unite centric work-flow | +| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… | diff --git a/docs/layers/lang/r.md b/docs/layers/lang/r.md index ffd6d6b99..ee4031fc7 100644 --- a/docs/layers/lang/r.md +++ b/docs/layers/lang/r.md @@ -53,4 +53,4 @@ Send code to inferior process commands: ### Running current script -To running a ruby script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. +To running a r script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. diff --git a/docs/layers/lang/red.md b/docs/layers/lang/red.md new file mode 100644 index 000000000..a0d7db6d9 --- /dev/null +++ b/docs/layers/lang/red.md @@ -0,0 +1,57 @@ +--- +title: "SpaceVim lang#red layer" +description: "This layer is for red development, provide autocompletion, syntax checking and code format." +--- + +# [Available Layers](../../) >> lang#red + + + +- [Description](#description) +- [Install](#install) + - [Layer](#layer) +- [Key bindings](#key-bindings) + - [Inferior REPL process](#inferior-repl-process) + - [Running current script](#running-current-script) + + + +## Description + +This layer is for red development. + +## Install + +### Layer + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#red" +``` + +## Key bindings + +### Inferior REPL process + +Start a `red` inferior REPL process with `SPC l s i`. You may change the REPL command by layer option `repl_command`. For example, if you want to use `pry`, load this layer via: + +```toml +[[layers]] + name = "lang#red" + repl_command = "red --cli" +``` + +Send code to inferior process commands: + +| Key Binding | Description | +| ----------- | ------------------------------------------------ | +| `SPC l s b` | send buffer and keep code buffer focused | +| `SPC l s l` | send line and keep code buffer focused | +| `SPC l s s` | send selection text and keep code buffer focused | + +### Running current script + +To running a ruby script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. + From c8392c1757e0a3380844ff290ae9ca533f7954da Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Wed, 23 Jan 2019 11:25:28 +0800 Subject: [PATCH 022/179] Fix 404 page in about --- docs/about.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/about.md b/docs/about.md index a1707cef8..9becded7e 100644 --- a/docs/about.md +++ b/docs/about.md @@ -16,7 +16,7 @@ language or feature by grouping all the related plugins together. It got inspire ### Credits & Thanks -This project exists to thank all the people who have [contributed](CONTRIBUTING.md): +This project exists to thank all the people who have contributed: From c3d1dabc12466ec630d84f9b60d1dca4e932c0d4 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Wed, 23 Jan 2019 12:29:57 +0800 Subject: [PATCH 023/179] Disable codecov comment --- codecov.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/codecov.yml b/codecov.yml index 047f95d5a..bbe54f763 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,6 +1,4 @@ -comment: - layout: "header, diff, changes, uncovered" - behavior: default # update if exists else create new +comment: off codecov: branch: master coverage: From 1538d54a7eacef057662735fe606dc65bf1a9fb2 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Wed, 23 Jan 2019 12:32:13 +0800 Subject: [PATCH 024/179] Disable code owner message --- .github/CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 688cc7f15..c85f0334e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -2,7 +2,8 @@ # the repo. Unless a later match takes precedence, # @wsdjeg will be requested for review when someone opens a # pull request. -* @wsdjeg +# Just watching this repo, disable duplicate message +# * @wsdjeg # lang#julia layer autoload/SpaceVim/layers/lang/julia.vim @jingpengw From f38ee34c00df1ee88051ba0cc3e94658912e9d00 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Wed, 23 Jan 2019 13:14:27 +0800 Subject: [PATCH 025/179] Remove doc about Leader f f file searching key bindings: - SPC f f: searching files in the directory of current file - SPC p f: searching files in current project --- docs/cn/documentation.md | 1 - docs/conventions.md | 2 +- docs/documentation.md | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index bb0ad643e..8cd8fc8f1 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -731,7 +731,6 @@ features. | -------------------- | ----------------------------- | | ` f ` | Fuzzy find menu:CustomKeyMaps | | ` f e` | Fuzzy find register | -| ` f f` | Fuzzy find file | | ` f h` | Fuzzy find history/yank | | ` f j` | Fuzzy find jump, change | | ` f l` | Fuzzy find location list | diff --git a/docs/conventions.md b/docs/conventions.md index c2148fb72..b2b526587 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -289,7 +289,7 @@ Always prefix variables with their scope. - Use capital case and angle brackets for keyboard buttons: ``, ``. - Use uppercase for custom leader: `SPC`, `WIN`, `UNITE`, `DENITE`. -- Use space as delimiter for key sequences: `SPC t w`, ` f f`. +- Use space as delimiter for key sequences: `SPC t w`, ` f o`. - Use `/` for alternative sequences: `` / ``. - Use `Ctrl-e` rather than `` in documentation. diff --git a/docs/documentation.md b/docs/documentation.md index 8f314cb94..6c45c1c2f 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -766,7 +766,6 @@ Users only need to load one of these layers, they will be able to get these feat | -------------------- | ----------------------------- | | ` f ` | Fuzzy find menu:CustomKeyMaps | | ` f e` | Fuzzy find register | -| ` f f` | Fuzzy find file | | ` f h` | Fuzzy find history/yank | | ` f j` | Fuzzy find jump, change | | ` f l` | Fuzzy find location list | From 871dded7eaf34990f489b7e5d197ead5a39ff548 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Wed, 23 Jan 2019 22:48:09 +0800 Subject: [PATCH 026/179] Doc: add a new name rule: hints-like-this (#2493) * Doc: add a new name rule: hints-like-this * Doc: fix typos. * Doc: fix typos. * Doc: add (TODO) to the unimplemented functions. --- docs/cn/conventions.md | 18 ++++++++++++----- docs/cn/documentation.md | 43 ++++++++++++++++++++-------------------- docs/conventions.md | 8 ++++---- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/docs/cn/conventions.md b/docs/cn/conventions.md index 5f955fb74..034baca7f 100644 --- a/docs/cn/conventions.md +++ b/docs/cn/conventions.md @@ -212,8 +212,10 @@ Excluding [!] prevents your plugin from silently clobbering existing commands. C 不要以参数列表(arguments)的形式来使用命令。 +```vim let s:variable = "concatenated " . "strings" command -range=% MyCommand +``` - 不要在空白行处留下空白字符 @@ -260,18 +262,24 @@ autocommand BufEnter #### 命名 -总的来说,使用像这样的插件名 plugin-names-like-this,像这样的函数名 FunctionNamesLikeThis,像这样的命令名 CommandNamesLikeThis,像这样的参数组 augroup_names_like_this,像这样的变量名 variable_names_like_this。 +总的来说,使用 +- 像这样的插件名 `plugin-names-like-this` +- 像这样的函数名 `FunctionNamesLikeThis` +- 像这样的命令名 `CommandNamesLikeThis` +- 像这样的参数组 `augroup_names_like_this` +- 像这样的变量名 `variable_names_like_this` +- 像这样的提示 `hints-like-this` 总是在变量名前加上它们的范围前缀 -- plugin-names-like-this +- `plugin-names-like-this` 保持简单易于理解 -- FunctionNamesLikeThis +- `FunctionNamesLikeThis` - 本地脚本函数的前缀为`s:` - 自动运行函数(autoload functions)可以没有范围前缀。 - 不要编写(creat)全局函数。用自动运行函数(autoloaded functions)来替代全局函数。 -- CommandNamesLikeThis +- `CommandNamesLikeThis` 通用命令优先于一般的前缀 -- variable_names_like_this +- `variable_names_like_this` Augroup names count as variables for naming purposes. 参数组(augroup)名字计数作为变量的命名方向。 - 所有的变量据需要加上它们的范围前缀。 diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 8cd8fc8f1..cdaf8b2b8 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1054,7 +1054,7 @@ Buffer 操作相关快捷键都是以 `SPC b` 为前缀的: ##### 特殊 buffer -在 SpaceVim 中,有很多特殊的 buffer,这些 buffer 是由插件或者 SpaceVim 自身新建的,并不会被列出。 +在 SpaceVim 中,有很多特殊的 buffer,这些 buffer 是由插件或者 SpaceVim 自身建立的,并不会被列出。 ##### 文件操作相关快捷键 @@ -1596,8 +1596,8 @@ In highlight symbol transient state: #### 增加或减小数字 -| 快捷键 | 描述 | -| --------- | --------------------------------------------------- | +| 快捷键 | 描述 | +| --------- | -------------------------------------------------- | | `SPC n +` | 为光标下的数字加 1 并进入 initiate transient state | | `SPC n -` | 为光标下的数字减 1 并进入 initiate transient state | @@ -1667,22 +1667,23 @@ The default color for iedit is `red`/`green` which is based on the current color 注释(comment)通过工具 [nerdcommenter](https://github.com/scrooloose/nerdcommenter) 来处理,它用下面的按键来界定范围。 -| 快捷键 | 描述 | -| ----------- | ------------------------- | -| `SPC ;` | comment operator | -| `SPC c h` | hide/show comments | -| `SPC c l` | comment lines | -| `SPC c L` | invert comment lines | -| `SPC c p` | comment paragraphs | -| `SPC c P` | invert comment paragraphs | -| `SPC c t` | comment to line | -| `SPC c T` | invert comment to line | -| `SPC c y` | comment and yank | -| `SPC c Y` | invert comment and yank | +| 快捷键 | 描述 | +| ----------- | ------------------------------- | +| `SPC ;` | enter comment operator mode | +| `SPC c h` | hide/show comments(TODO) | +| `SPC c l` | comment lines | +| `SPC c L` | invert comment lines | +| `SPC c p` | comment paragraphs | +| `SPC c P` | invert comment paragraphs | +| `SPC c s` | comment with sexy/pretty layout | +| `SPC c t` | comment to line | +| `SPC c T` | invert comment to line | +| `SPC c y` | comment and yank(TODO) | +| `SPC c Y` | invert comment and yank(TODO) | 小提示: -用 `SPC ;` 可以启动一个 operator 模式,在该模式下,可以使用移动命令确认注释的范围, +用 `SPC ;` 可以启动一个 comment operator 模式,在该模式下,可以使用移动命令确认注释的范围, 比如 `SPC ; 4 j`,这个组合键会注释当前行以及下方的 4 行。这个数字即为相对行号,可在左侧看到。 #### 多方式编码 @@ -1744,11 +1745,11 @@ SpaceVim 通过 [neomake](https://github.com/neomake/neomake) fly 工具来进 甚至可检查 Vim 位置列表的所有错误。这包括下面的例子:在已被保存的位置列表缓冲区进行搜索。 默认提示符: -| 提示符 | 描述 | 自定义选项 | -| ------ | ----------- | --------------------------- | -| `✖` | Error | `error_symbol` | -| `➤` | warning | `warning_symbol` | -| `🛈` | Info | `info_symbol` | +| 提示符 | 描述 | 自定义选项 | +| ------ | ------- | ---------------- | +| `✖` | Error | `error_symbol` | +| `➤` | warning | `warning_symbol` | +| `🛈` | Info | `info_symbol` | ### 工程管理 diff --git a/docs/conventions.md b/docs/conventions.md index b2b526587..1dfd1461a 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -264,15 +264,15 @@ In general, use `plugin-names-like-this`, `FunctionNamesLikeThis`, Always prefix variables with their scope. -- plugin-names-like-this +- `plugin-names-like-this` Keep them short and sweet. -- FunctionNamesLikeThis +- `FunctionNamesLikeThis` - Prefix script-local functions with s: - Autoloaded functions may not have a scope prefix. - Do not create global functions. Use autoloaded functions instead. -- CommandNamesLikeThis +- `CommandNamesLikeThis` Prefer succinct command names over common command prefixes. -- variable_names_like_this +- `variable_names_like_this` Augroup names count as variables for naming purposes. - Prefix all variables with their scope. - Global variables with g: From 122e80655ac90c2bd527cc1d38937688416ee1b2 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 23 Jan 2019 23:02:03 +0800 Subject: [PATCH 027/179] Fix delete file (#2490) --- autoload/SpaceVim/api/vim/message.vim | 2 ++ autoload/SpaceVim/layers/core.vim | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/autoload/SpaceVim/api/vim/message.vim b/autoload/SpaceVim/api/vim/message.vim index f3b7adc72..46165edda 100644 --- a/autoload/SpaceVim/api/vim/message.vim +++ b/autoload/SpaceVim/api/vim/message.vim @@ -46,6 +46,8 @@ function! s:self.confirm(msg) abort echon a:msg . '? (y or n) ' echohl NONE let rst = nr2char(getchar()) + " clear the cmdline + redraw! if rst =~? 'y' || rst == nr2char(13) return 1 else diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 695e248cc..671779f58 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -434,14 +434,14 @@ endfunction function! s:delete_current_buffer_file() abort if s:MESSAGE.confirm('Are you sure you want to delete this file') - let f = fnameescape(expand('%:p')) - call SpaceVim#mapping#close_current_buffer() + let f = expand('%') if delete(f) == 0 - echo "File '" . f . "' successfully removed" + call SpaceVim#mapping#close_current_buffer() + echo "File '" . f . "' successfully deleted!" + else + call s:MESSAGE.warn('Failed to delete file:' . f) endif endif - redraw! - endfunction function! s:swap_buffer_with_nth_win(nr) abort From c3a04d4ebc05424e16595874a7cf7fae2444b0f2 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Thu, 24 Jan 2019 21:08:41 +0800 Subject: [PATCH 028/179] Change: modify the function of SPC c L is function. (#2492) * Change: SPC c L is function exactly the same as SPC c l, so modify it to 'comment lines' and update the corresponding documentation. * Doc: add (TODO) to the functions that have not been implemented. * Fixed: fix the hint for 'SPC c v'. --- autoload/SpaceVim/layers/core.vim | 6 +++--- docs/cn/documentation.md | 25 ++++++++++++------------- docs/documentation.md | 26 +++++++++++++------------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index 671779f58..f0da11217 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -236,9 +236,9 @@ function! SpaceVim#layers#core#config() abort " " Toggles the comment state of the selected line(s). If the topmost selected " line is commented, all selected lines are uncommented and vice versa. - call SpaceVim#mapping#space#def('nmap', ['c', 'l'], 'NERDCommenterInvert', 'comment or uncomment lines', 0, 1) - call SpaceVim#mapping#space#def('nmap', ['c', 'L'], 'NERDCommenterInvert', 'comment or uncomment lines invert', 0, 1) - call SpaceVim#mapping#space#def('nmap', ['c', 'v'], 'NERDCommenterInvertgv', 'comment or uncomment lines and keep visual', 0, 1) + call SpaceVim#mapping#space#def('nmap', ['c', 'l'], 'NERDCommenterInvert', 'toggle comment lines', 0, 1) + call SpaceVim#mapping#space#def('nmap', ['c', 'L'], 'NERDCommenterComment', 'comment lines', 0, 1) + call SpaceVim#mapping#space#def('nmap', ['c', 'v'], 'NERDCommenterInvertgv', 'toggle comment lines and keep visual', 0, 1) call SpaceVim#mapping#space#def('nmap', ['c', 's'], 'NERDCommenterSexy', 'comment with sexy/pretty layout', 0, 1) nnoremap CommentToLine :call comment_to_line(0) diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index cdaf8b2b8..47fa49b7c 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1667,19 +1667,18 @@ The default color for iedit is `red`/`green` which is based on the current color 注释(comment)通过工具 [nerdcommenter](https://github.com/scrooloose/nerdcommenter) 来处理,它用下面的按键来界定范围。 -| 快捷键 | 描述 | -| ----------- | ------------------------------- | -| `SPC ;` | enter comment operator mode | -| `SPC c h` | hide/show comments(TODO) | -| `SPC c l` | comment lines | -| `SPC c L` | invert comment lines | -| `SPC c p` | comment paragraphs | -| `SPC c P` | invert comment paragraphs | -| `SPC c s` | comment with sexy/pretty layout | -| `SPC c t` | comment to line | -| `SPC c T` | invert comment to line | -| `SPC c y` | comment and yank(TODO) | -| `SPC c Y` | invert comment and yank(TODO) | +| 快捷键 | 描述 | +| ----------- | ------------------------------ | +| `SPC ;` | comment operator | +| `SPC c h` | hide/show comments | +| `SPC c l` | toggle comment lines | +| `SPC c L` | comment lines | +| `SPC c p` | comment paragraphs | +| `SPC c P` | toggle comment paragraphs | +| `SPC c t` | comment to line | +| `SPC c T` | toggle comment to line | +| `SPC c y` | comment and yank(TODOO) | +| `SPC c Y` | toggle comment and yank(TODOO) | 小提示: diff --git a/docs/documentation.md b/docs/documentation.md index 6c45c1c2f..1ba90ce9b 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1698,19 +1698,19 @@ The default color for iedit is `red`/`green` which is based on the current color Comments are handled by [nerdcommenter](https://github.com/scrooloose/nerdcommenter), it’s bound to the following keys. -| Key Bindings | Descriptions | -| ------------ | -------------------------- | -| `SPC ;` | comment operator | -| `SPC c h` | hide/show comments | -| `SPC c l` | comment lines | -| `SPC c L` | invert comment lines | -| `SPC c p` | comment paragraphs | -| `SPC c P` | invert comment paragraphs | -| `SPC c s` | comment with pretty layout | -| `SPC c t` | comment to line | -| `SPC c T` | invert comment to line | -| `SPC c y` | comment and yank | -| `SPC c Y` | invert comment and yank | +| Key Bindings | Descriptions | +| ------------ | ----------------------------- | +| `SPC ;` | comment operator | +| `SPC c h` | hide/show comments | +| `SPC c l` | toggle comment lines | +| `SPC c L` | comment lines | +| `SPC c p` | comment paragraphs | +| `SPC c P` | toggle comment paragraphs | +| `SPC c s` | comment with pretty layout | +| `SPC c t` | comment to line | +| `SPC c T` | toggle comment to line | +| `SPC c y` | comment and yank(TODO) | +| `SPC c Y` | toggle comment and yank(TODO) | **Tips:** `SPC ;` will start operator mode, in this mode, you can use motion command to comment lines. For example, `SPC ; 4 j` will comment current line and the following 4 lines. From 8353ecef68fec2c963a509fecde4ca16878872a2 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Thu, 24 Jan 2019 23:02:09 +0800 Subject: [PATCH 029/179] Add input method support on statusline (#2496) * Add input method support on statusline close #1693 * Update doc --- autoload/SpaceVim/layers/core/statusline.vim | 16 ++++++ docs/cn/documentation.md | 1 + docs/documentation.md | 56 +++++++++++--------- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index cf2fc6732..d298344b1 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -203,6 +203,19 @@ function! s:battery_status() abort endif endfunction +function! s:input_method() abort + " use fcitx-remote get current method + if executable('fcitx-remote') + if system('fcitx-remote') == 1 + return ' cn ' + else + return ' en ' + endif + endif + return '' +endfunction + + if g:spacevim_enable_neomake function! s:syntax_checking() if !exists('g:loaded_neomake') @@ -269,6 +282,7 @@ let s:registed_sections = { \ 'date' : function('s:date'), \ 'whitespace' : function('s:whitespace'), \ 'battery status' : function('s:battery_status'), + \ 'input method' : function('s:input_method'), \ 'search status' : function('s:search_status'), \ } @@ -580,6 +594,8 @@ function! SpaceVim#layers#core#statusline#config() abort \ 'toggle the battery status', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'd'], 'call SpaceVim#layers#core#statusline#toggle_section("date")', \ 'toggle the date', 1) + call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'i'], 'call SpaceVim#layers#core#statusline#toggle_section("input method")', + \ 'toggle the input methon', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")', \ 'toggle the time', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")', diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 47fa49b7c..1207ab5a5 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -438,6 +438,7 @@ SpaceVim 在终端下默认使用了真色,因此使用之前需要确认下 | ----------- | ------------------------------------------------------------------- | | `SPC t m b` | 显示/隐藏电池状态 (需要安装 acpi) | | `SPC t m c` | toggle the org task clock (available in org layer)(TODO) | +| `SPC t m i` | 显示/隐藏输入法 | | `SPC t m m` | 显示/隐藏 SpaceVim 已启用功能 | | `SPC t m M` | 显示/隐藏文件类型 | | `SPC t m n` | toggle the cat! (if colors layer is declared in your dotfile)(TODO) | diff --git a/docs/documentation.md b/docs/documentation.md index 1ba90ce9b..b334cfbe7 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -308,14 +308,16 @@ In SpaceVim, a layer is a single file. In a layer, for example, `autocomplete` l If you found one of the built-in plugins has bugs, and you want to debug that plugin. You can follow these steps: 1. Disable this plugin -Take disabling neomake.vim for instance: + Take disabling neomake.vim for instance: + ```toml [options] disabled_plugins = ["neomake.vim"] ``` 2. Add a forked plugin or add a local plugin -Use toml file to add custom forked plugins: + Use toml file to add custom forked plugins: + ```toml [[custom_plugins]] name = "wsdjeg/neomake.vim" @@ -324,6 +326,7 @@ Use toml file to add custom forked plugins: ``` Use the `bootstrap_before` function to add local plugin: + ```vim function! myspacevim#before() abort set rtp+=~/path/to/your/localplugin @@ -456,6 +459,7 @@ Some elements can be dynamically toggled: | ------------ | ------------------------------------------------------------------- | | `SPC t m b` | toggle the battery status (need to install acpi) | | `SPC t m c` | toggle the org task clock (available in org layer)(TODO) | +| `SPC t m i` | toggle the input method | | `SPC t m m` | toggle the minor mode lighters | | `SPC t m M` | toggle the major mode | | `SPC t m n` | toggle the cat! (If colors layer is declared in your dotfile)(TODO) | @@ -663,30 +667,30 @@ can change it via `windows_leader` option: SpaceVim has mapped normal `q` as smart buffer close, the normal func of `q` can be get by ` q r`, if you want to disable this feature, you can use `vimcompatible` mode. -| Key | Mode | Action | +| Key | Mode | Action | | ----------------- | ------------- | ------------------------------------------------------------------------------ | -| ` y` | visual | Copy selection to X11 clipboard ("+y) | -| `Ctrl-c` | Normal | Copy full path of current buffer to X11 clipboard | -| ` Ctrl-c` | Normal | Copy github.com url of current buffer to X11 clipboard(if it is a github repo) | +| ` y` | visual | Copy selection to X11 clipboard ("+y) | +| `Ctrl-c` | Normal | Copy full path of current buffer to X11 clipboard | +| ` Ctrl-c` | Normal | Copy github.com url of current buffer to X11 clipboard(if it is a github repo) | | ` Ctrl-l` | Normal/visual | Copy github.com url of current lines to X11 clipboard(if it is a github repo) | | ` p` | Normal/visual | Paste selection from X11 clipboard ("+p) | -| `Ctrl-f` | Normal | Smart page forward (C-f/C-d) | -| `Ctrl-b` | Normal | Smart page backwards (C-b/C-u) | -| `Ctrl-e` | Normal | Smart scroll down (3C-e/j) | -| `Ctrl-y` | Normal | Smart scroll up (3C-y/k) | -| `Ctrl-q` | Normal | `Ctrl`+`w` | -| `Ctrl-x` | Normal | Switch buffer and placement | -| ``, `` | Normal | Smart up and down | -| `}` | Normal | After paragraph motion go to first non-blank char (}^) | +| `Ctrl-f` | Normal | Smart page forward (C-f/C-d) | +| `Ctrl-b` | Normal | Smart page backwards (C-b/C-u) | +| `Ctrl-e` | Normal | Smart scroll down (3C-e/j) | +| `Ctrl-y` | Normal | Smart scroll up (3C-y/k) | +| `Ctrl-q` | Normal | `Ctrl`+`w` | +| `Ctrl-x` | Normal | Switch buffer and placement | +| ``, `` | Normal | Smart up and down | +| `}` | Normal | After paragraph motion go to first non-blank char (}^) | | `<` | Visual/Normal | Indent to left and re-select | | `>` | Visual/Normal | Indent to right and re-select | -| `` | Visual | Indent to right and re-select | -| `Shift-Tab` | Visual | Indent to left and re-select | -| `g p` | Normal | Select last paste | -| `Q` / `g Q` | Normal | Disable EX-mode () | -| `Ctrl-a` | Command | Navigation in command line | -| `Ctrl-b` | Command | Move cursor backward in command line | -| `Ctrl-f` | Command | Move cursor forward in command line | +| `` | Visual | Indent to right and re-select | +| `Shift-Tab` | Visual | Indent to left and re-select | +| `g p` | Normal | Select last paste | +| `Q` / `g Q` | Normal | Disable EX-mode () | +| `Ctrl-a` | Command | Navigation in command line | +| `Ctrl-b` | Command | Move cursor backward in command line | +| `Ctrl-f` | Command | Move cursor forward in command line | ### File Operations @@ -1776,11 +1780,11 @@ The next/previous error mappings and the error transient state can be used to br Custom sign symbol: -| Symbol | Descriptions | Custom options | -| ------ | ----------- | --------------------------- | -| `✖` | Error | `error_symbol` | -| `➤` | warning | `warning_symbol` | -| `🛈` | Info | `info_symbol` | +| Symbol | Descriptions | Custom options | +| ------ | ------------ | ---------------- | +| `✖` | Error | `error_symbol` | +| `➤` | warning | `warning_symbol` | +| `🛈` | Info | `info_symbol` | ### Managing projects From 4026cf61b44007717bc19b2704903f1bbc1ffd16 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Fri, 25 Jan 2019 19:11:55 +0800 Subject: [PATCH 030/179] Doc: update the documentation of the layer autocomplete. (#2501) --- docs/cn/layers/autocomplete.md | 2 +- docs/layers/autocomplete.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cn/layers/autocomplete.md b/docs/cn/layers/autocomplete.md index f9c820d7e..f238b8336 100644 --- a/docs/cn/layers/autocomplete.md +++ b/docs/cn/layers/autocomplete.md @@ -73,7 +73,7 @@ SpaceVim 选项 `snippet_engien` 设置为 ultisnips auto-completion-tab-key-behavior = "smart" auto-completion-delay = 200 auto-completion-complete-with-key-sequence = "nil" - auto-completion-complete-with-key-sequence-delay = 0.1, + auto-completion-complete-with-key-sequence-delay = 0.1 ``` 通常会建议将 `auto-completion-complete-with-key-sequence` 的值设为 `jk`,如果你不用 diff --git a/docs/layers/autocomplete.md b/docs/layers/autocomplete.md index fc858e66c..6314aed15 100644 --- a/docs/layers/autocomplete.md +++ b/docs/layers/autocomplete.md @@ -92,7 +92,7 @@ The default configuration of the layer is: auto-completion-tab-key-behavior = "smart" auto-completion-delay = 200 auto-completion-complete-with-key-sequence = "nil" - auto-completion-complete-with-key-sequence-delay = 0.1, + auto-completion-complete-with-key-sequence-delay = 0.1 ``` `jk` is a good candidate for `auto-completion-complete-with-key-sequence` if you don’t use it already. From 3806d56574f2f9aea36bc3aadb2eee7ff8013d10 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Fri, 25 Jan 2019 19:12:39 +0800 Subject: [PATCH 031/179] Fixed: extend the patterns. (#2500) * Fixed: extend the patterns to match all the right beginning and end of a Vim function defination. * Fixed: function and endf should be arrounded with blanks. --- autoload/SpaceVim/layers/lang/vim.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/vim.vim b/autoload/SpaceVim/layers/lang/vim.vim index 292b0cef1..ce3b226d8 100644 --- a/autoload/SpaceVim/layers/lang/vim.vim +++ b/autoload/SpaceVim/layers/lang/vim.vim @@ -34,7 +34,7 @@ endfunction function! SpaceVim#layers#lang#vim#config() abort call SpaceVim#mapping#gd#add('vim','lookup#lookup') call SpaceVim#mapping#space#regesit_lang_mappings('vim', function('s:language_specified_mappings')) - call SpaceVim#plugins#highlight#reg_expr('vim', '^\s*\(func\|fu\|function\)!\?\s\+', '^\s*\(endfunc\|endf\|endfunction\)') + call SpaceVim#plugins#highlight#reg_expr('vim', '\s*\!\?\s*', '\s*\\s*') endfunction function! s:language_specified_mappings() abort From 8896332f998ac2581bf9534023419c7f80127365 Mon Sep 17 00:00:00 2001 From: ssfjhh Date: Fri, 25 Jan 2019 19:19:38 +0800 Subject: [PATCH 032/179] Change: optimize some code. (#2498) * Change: optimize some code. * Fixed: kddp should not be modified. * Fixed: kddp should not be modified. --- autoload/SpaceVim/layers/edit.vim | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 3b4ef7406..ea7ac5431 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -167,7 +167,9 @@ endfunction function! s:transpose_with_previous(type) abort if a:type ==# 'line' if line('.') > 1 + let l:save_register = @" normal! kddp + let @" = l:save_register endif elseif a:type ==# 'word' let save_register = @k @@ -181,14 +183,12 @@ function! s:transpose_with_previous(type) abort let @k = tw normal! eviw"kp endif - let @k =save_register + let @k = save_register elseif a:type ==# 'character' if col('.') > 1 - let save_register_k = @k - let save_register_m = @m - normal! v"kyhv"myv"kplv"mp - let @k =save_register_k - let @m =save_register_m + let l:save_register = @" + normal! hxp + let @" = l:save_register endif endif endfunction @@ -196,15 +196,18 @@ endfunction function! s:move_text_down_transient_state() abort if line('.') == line('$') else + let l:save_register = @" normal! ddp + let @" = l:save_register endif call s:text_transient_state() endfunction function! s:move_text_up_transient_state() abort - if line('.') == 1 - else + if line('.') > 1 + let l:save_register = @" normal! ddkP + let @" = l:save_register endif call s:text_transient_state() endfunction From cb2a319e805690a28eded168e2a1a350ce716cbd Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Fri, 25 Jan 2019 20:56:11 +0800 Subject: [PATCH 033/179] Doc: fix typos. --- README.cn.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.cn.md b/README.cn.md index ed940e888..14fbaf096 100644 --- a/README.cn.md +++ b/README.cn.md @@ -32,7 +32,7 @@ Github: -- [最新特新](#最新特新) +- [最新特性](#最新特性) - [多光标 Iedit 模式](#多光标-iedit-模式) - [高亮光标下的函数](#高亮光标下的函数) - [实时代码检索](#实时代码检索) @@ -46,7 +46,7 @@ Github: -## 最新特新 +## 最新特性 以下为 SpaceVim 中最新实现的一些特性: @@ -62,7 +62,7 @@ SpaceVim 内置了一种特殊的模式,Iedit 模式,这种模式提供了 SpaceVim 支持高亮当前光标函数,并且启动一个特殊模式,在该模式下可以快捷地切换高亮区域 (方法内、屏幕内、整个文件内),并且可以快速在高亮函数间跳转、切换高亮状态(高亮、取消高亮), -并且可以根据已选择的位置计入 Iedit 模式。 +并且可以根据已选择的位置进入 Iedit 模式。 ![highlight cursor symbol](https://user-images.githubusercontent.com/13142418/36210381-e6dffde6-1163-11e8-9b35-0bf262e6f22b.gif) @@ -94,7 +94,7 @@ SpaceVim 利用了 Vim 8 和 Neovim 最新的异步机制,实现了异步插 ![UI for dein](https://user-images.githubusercontent.com/13142418/34907332-903ae968-f842-11e7-8ac9-07fcc9940a53.gif) -想要获取更多关于 SpaceVim 的最新特新,请关注 [SpaceVim 官方博客](https://spacevim.org/blog/) +想要获取更多关于 SpaceVim 的最新特性,请关注 [SpaceVim 官方博客](https://spacevim.org/blog/) ## 安装 From dcecba8ea0dbb1f6f006d530fa431e6e3237d118 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sat, 26 Jan 2019 10:26:34 +0800 Subject: [PATCH 034/179] Add key binding SPC e e (#2507) --- autoload/SpaceVim/layers/checkers.vim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index fbc191101..5f35e6632 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -91,6 +91,9 @@ function! SpaceVim#layers#checkers#config() abort call SpaceVim#mapping#space#def('nnoremap', ['t', 's'], 'call call(' \ . string(s:_function('s:toggle_syntax_checker')) . ', [])', \ 'toggle syntax checker', 1) + call SpaceVim#mapping#space#def('nnoremap', ['e', 'e'], 'call call(' + \ . string(s:_function('s:explain_the_error')) . ', [])', + \ 'explain the error', 1) augroup SpaceVim_layer_checker autocmd! if g:spacevim_enable_neomake @@ -221,6 +224,28 @@ function! s:toggle_syntax_checker() abort verbose NeomakeToggle endfunction + +function! s:explain_the_error() abort + if g:spacevim_enable_neomake + try + let message = neomake#GetCurrentErrorMsg() + catch /^Vim\%((\a\+)\)\=:E117/ + let message = '' + endtry + elseif g:spacevim_enable_ale + try + let message = neomake#GetCurrentErrorMsg() + catch /^Vim\%((\a\+)\)\=:E117/ + let message = '' + endtry + endif + if !empty(message) + echo message + else + echo 'no error message at this point!' + endif +endfunction + function! s:error_transient_state() abort if g:spacevim_enable_neomake let num_errors = neomake#statusline#LoclistCounts() From 56e39b40e250d1d5e6216d11d10a1b43ba866875 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sat, 26 Jan 2019 11:14:25 +0800 Subject: [PATCH 035/179] Fix vim81 checking close #2140 --- docs/cn/install.sh | 2 +- docs/install.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cn/install.sh b/docs/cn/install.sh index b7a01d9bf..94d7a6ba4 100755 --- a/docs/cn/install.sh +++ b/docs/cn/install.sh @@ -242,7 +242,7 @@ check_requirements () { warn "缺少依赖:git" fi if hash "vim" &>/dev/null; then - is_vim8=$(vim --version | grep "Vi IMproved 8.0") + is_vim8=$(vim --version | grep "Vi IMproved 8") is_vim74=$(vim --version | grep "Vi IMproved 7.4") if [ -n "$is_vim8" ]; then success "检测到 Vim 版本: vim 8.0" diff --git a/docs/install.sh b/docs/install.sh index add0b1515..6badfb340 100755 --- a/docs/install.sh +++ b/docs/install.sh @@ -240,7 +240,7 @@ check_requirements () { warn "Check Requirements : git" fi if hash "vim" &>/dev/null; then - is_vim8=$(vim --version | grep "Vi IMproved 8.0") + is_vim8=$(vim --version | grep "Vi IMproved 8") is_vim74=$(vim --version | grep "Vi IMproved 7.4") if [ -n "$is_vim8" ]; then success "Check Requirements: vim 8.0" From fec4905fb3516370991298545ce6325a92d50ec8 Mon Sep 17 00:00:00 2001 From: Amir Eldor Date: Sun, 27 Jan 2019 04:56:37 +0200 Subject: [PATCH 036/179] Fix typo in TypeScript layer TSDoc command (#2510) --- autoload/SpaceVim/layers/lang/typescript.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/typescript.vim b/autoload/SpaceVim/layers/lang/typescript.vim index 4a9af9307..830ff5300 100644 --- a/autoload/SpaceVim/layers/lang/typescript.vim +++ b/autoload/SpaceVim/layers/lang/typescript.vim @@ -60,7 +60,7 @@ function! s:on_ft() abort if has('nvim') call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'c'], 'TSTypeDef', \ 'type definition', 1) - call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TsDoc', + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'], 'TSDoc', \ 'show document', 1) call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'], 'TSRename', \ 'rename symbol', 1) From 7c2e7b7421a073e94f97b04c9b670134a403df45 Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Sun, 27 Jan 2019 10:59:44 +0800 Subject: [PATCH 037/179] Add: add function 'set_justification_to' with it's 3 key bindings. (#2511) --- autoload/SpaceVim/layers/edit.vim | 46 ++++++++++++++++++++++++++++++- docs/cn/documentation.md | 6 ++-- docs/cn/layers/edit.md | 8 ++++++ docs/documentation.md | 8 +++--- docs/layers/edit.md | 14 +++++++--- 5 files changed, 70 insertions(+), 12 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index ea7ac5431..cbad0a7f4 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -109,6 +109,17 @@ function! SpaceVim#layers#edit#config() abort \ . string(s:_function('s:kebab_case')) . ', [])', \ 'change symbol style to kebab-case', 1) + " justification + let g:_spacevim_mappings_space.x.j = {'name' : 'justification'} + call SpaceVim#mapping#space#def('nnoremap', ['x', 'j', 'l'], 'silent call call(' + \ . string(s:_function('s:set_justification_to')) . ', ["left"])', + \ 'set-the-justification-to-left', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'j', 'c'], 'silent call call(' + \ . string(s:_function('s:set_justification_to')) . ', ["center"])', + \ 'set-the-justification-to-center', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 'j', 'r'], 'silent call call(' + \ . string(s:_function('s:set_justification_to')) . ', ["right"])', + \ 'set-the-justification-to-right', 1) let g:_spacevim_mappings_space.i = {'name' : '+Insertion'} let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'} @@ -360,10 +371,43 @@ endfunction function! s:delete_extra_space() abort if !empty(getline('.')) if getline('.')[col('.')-1] ==# ' ' - exe "normal! viw\"_di\\" + execute "normal! \"_ciw\\" endif endif endfunction + +function! s:set_justification_to(align) abort + let l:startlinenr = line("'{") + let l:endlinenr = line("'}") + if getline(l:startlinenr) ==# '' + let l:startlinenr += 1 + endif + if getline(l:endlinenr) ==# '' + let l:endlinenr -= 1 + endif + let l:lineList = map(getline(l:startlinenr, l:endlinenr), 'trim(v:val)') + let l:maxlength = 0 + for l:line in l:lineList + let l:length = strlen(l:line) + if l:length > l:maxlength + let l:maxlength = l:length + endif + endfor + + if a:align ==# 'left' + execute l:startlinenr . "," . l:endlinenr . ":left\" + elseif a:align ==# 'center' + execute l:startlinenr . "," . l:endlinenr . ":center " . l:maxlength . "\" + elseif a:align ==# 'right' + execute l:startlinenr . "," . l:endlinenr . ":right " . l:maxlength . "\" + endif + + unlet l:startlinenr + unlet l:endlinenr + unlet l:lineList + unlet l:maxlength +endfunction + let s:local_lorem_ipsum = [ \ 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.', \ 'Donec hendrerit tempor tellus.', diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 1207ab5a5..10d8fa3ae 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1555,11 +1555,11 @@ In highlight symbol transient state: | `SPC x i _` | change symbol style to `under_score` | | `SPC x i u` | change symbol style to `under_score` | | `SPC x i U` | change symbol style to `UP_CASE` | -| `SPC x j c` | set the justification to center (TODO) | +| `SPC x j c` | 居中对齐当前段落 | | `SPC x j f` | set the justification to full (TODO) | -| `SPC x j l` | set the justification to left (TODO) | +| `SPC x j l` | 左对齐当前段落 | | `SPC x j n` | set the justification to none (TODO) | -| `SPC x j r` | set the justification to right (TODO) | +| `SPC x j r` | 右对齐当前段落 | | `SPC x J` | move down a line of text (enter transient state) | | `SPC x K` | move up a line of text (enter transient state) | | `SPC x l d` | duplicate line or region (TODO) | diff --git a/docs/cn/layers/edit.md b/docs/cn/layers/edit.md index 86c3a6fe5..35419465f 100644 --- a/docs/cn/layers/edit.md +++ b/docs/cn/layers/edit.md @@ -25,6 +25,7 @@ lang: cn - 重复编辑 - 多光标支持 - 对齐文档内容 +- 设置文档段落对齐方式 - 高亮行为符号 - 自动载入 editorconfig 配置,需要 `+python` 或者 `+python3` 支持 - 默认已启用 @@ -55,3 +56,10 @@ lang: cn - `}`: 对齐 `}` - `)`: 对齐 `)` +| 快捷键 | 功能描述 | +| ------------ | ------------------------------------ | +| `SPC x j c` | 居中对齐当前段落 | +| `SPC x j f` | set the justification to full (TODO) | +| `SPC x j l` | 左对齐当前段落 | +| `SPC x j n` | set the justification to none (TODO) | +| `SPC x j r` | 右对齐当前段落 | diff --git a/docs/documentation.md b/docs/documentation.md index b334cfbe7..be8d634e1 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1568,7 +1568,7 @@ Text related commands (start with `x`): | `SPC x a ;` | align region at ; | | `SPC x a =` | align region at = | | `SPC x a ¦` | align region at ¦ | -| `SPC x a |` | align region at | +| `SPC x a |` | align region at | | | `SPC x a a` | align region (or guessed section) using default rules (TODO) | | `SPC x a c` | align current indentation region using default rules (TODO) | | `SPC x a l` | left-align with evil-lion (TODO) | @@ -1589,11 +1589,11 @@ Text related commands (start with `x`): | `SPC x i _` | change symbol style to `under_score` | | `SPC x i u` | change symbol style to `under_score` | | `SPC x i U` | change symbol style to `UP_CASE` | -| `SPC x j c` | set the justification to center (TODO) | +| `SPC x j c` | set the justification to center | | `SPC x j f` | set the justification to full (TODO) | -| `SPC x j l` | set the justification to left (TODO) | +| `SPC x j l` | set the justification to left | | `SPC x j n` | set the justification to none (TODO) | -| `SPC x j r` | set the justification to right (TODO) | +| `SPC x j r` | set the justification to right | | `SPC x J` | move down a line of text (enter transient state) | | `SPC x K` | move up a line of text (enter transient state) | | `SPC x l d` | duplicate line or region (TODO) | diff --git a/docs/layers/edit.md b/docs/layers/edit.md index 01af2473e..2723570b9 100644 --- a/docs/layers/edit.md +++ b/docs/layers/edit.md @@ -24,7 +24,8 @@ This layer provides many edit key bindings for SpaceVim, and also provides more - repeat latest action via vim-repeat - multiple cursor - align -- highlight whitespace at the end of a line +- set justification for paragraph +- highlight whitespaces at the end of a line - load ditorconfig config, need `+python` or `+python3` ## Options @@ -33,9 +34,9 @@ This layer provides many edit key bindings for SpaceVim, and also provides more ## Key bindings -Key binding | desc ---- | --- -`SPC x a {delimiter}` | align content based on delimiter +| Key bindings | Descraptions | +| -------------------- | ------------------------------- | +| `SPC x a {delimiter}` | align content based on delimiter | **default delimiters** @@ -53,3 +54,8 @@ Key binding | desc - `}`: align `}` - `)`: align `)` +| Key bindings | Descraptions | +| ------------ | ------------------------------- | +| `SPC x j c` | set the justification to center | +| `SPC x j l` | set the justification to left | +| `SPC x j r` | set the justification to right | From 771177f4d9c785cabffd8e6e67499a36184a7acf Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Sun, 27 Jan 2019 13:57:58 +0800 Subject: [PATCH 038/179] Fixed: fix string len parser (#2513) Use strdisplay() instead of strlen. --- autoload/SpaceVim/layers/edit.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index cbad0a7f4..3befa68af 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -388,7 +388,7 @@ function! s:set_justification_to(align) abort let l:lineList = map(getline(l:startlinenr, l:endlinenr), 'trim(v:val)') let l:maxlength = 0 for l:line in l:lineList - let l:length = strlen(l:line) + let l:length = strdisplaywidth(l:line) if l:length > l:maxlength let l:maxlength = l:length endif From fa4d25a2eb9e5532633225b1e72c372b3190cbfc Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 27 Jan 2019 16:55:50 +0800 Subject: [PATCH 039/179] Add gtm support (#2512) --- .gitignore | 1 + autoload/SpaceVim/layers/VersionControl.vim | 68 ++++++++++++++++++--- docs/cn/layers/VersionControl.md | 4 ++ docs/layers/VersionControl.md | 6 ++ 4 files changed, 70 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 513c8e524..e034da575 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ cscope.po.out build/ .coverage.covimerage *.swp +.gtm/ diff --git a/autoload/SpaceVim/layers/VersionControl.vim b/autoload/SpaceVim/layers/VersionControl.vim index aca249f01..dab8425aa 100644 --- a/autoload/SpaceVim/layers/VersionControl.vim +++ b/autoload/SpaceVim/layers/VersionControl.vim @@ -10,6 +10,8 @@ scriptencoding utf-8 let s:CMP = SpaceVim#api#import('vim#compatible') +let s:enable_gtm_status = 0 + function! SpaceVim#layers#VersionControl#plugins() abort let plugins = [] call add(plugins, ['mhinz/vim-signify', {'merged' : 0}]) @@ -31,28 +33,76 @@ function! SpaceVim#layers#VersionControl#config() abort \ 'version control info', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'h'], 'call SpaceVim#layers#core#statusline#toggle_section("hunks")', \ 'toggle the hunks summary', 1) + let g:gtm_plugin_status_enabled = s:enable_gtm_status + if s:enable_gtm_status + augroup gtm_plugin + autocmd! + autocmd BufReadPost,BufWritePost,CursorMoved,CursorMovedI * silent call s:record() + augroup END + endif +endfunction + +function! SpaceVim#layers#VersionControl#set_variable(var) abort + let s:enable_gtm_status = get(a:var, + \ 'enable_gtm_status', + \ s:enable_gtm_status) endfunction "  master function! s:git_branch() abort if exists('g:loaded_fugitive') try - let l:head = fugitive#head() - if empty(l:head) - call fugitive#detect(getcwd()) let l:head = fugitive#head() - endif - if g:spacevim_statusline_unicode_symbols == 1 - return empty(l:head) ? '' : '  '.l:head . ' ' - else - return empty(l:head) ? '' : ' '.l:head . ' ' - endif + if empty(l:head) + call fugitive#detect(getcwd()) + let l:head = fugitive#head() + endif + if g:spacevim_statusline_unicode_symbols == 1 + return empty(l:head) ? '' : '  '.l:head . s:gtm_status() + else + return empty(l:head) ? '' : ' '.l:head . s:gtm_status() + endif catch endtry endif return '' endfunction + +function! s:gtm_status() abort + if s:enable_gtm_status + let status = s:gtm_statusline() + return empty(status) ? '' : ' (' . status . ') ' + else + return '' + endif +endfunction + +let s:last_update = 0 +let s:last_file = '' +let s:update_interval = 30 +let s:gtm_plugin_status = '' + +function! s:record() + let fpath = expand('%:p') + " record if file path has changed or last update is greater than update_interval + if (s:last_file != fpath || localtime() - s:last_update > s:update_interval) && filereadable(fpath) + let s:cmd = (s:enable_gtm_status == 1 ? 'gtm record --status' : 'gtm record') + let output=system(s:cmd . ' ' . shellescape(fpath)) + if v:shell_error + echoerr s:no_gtm_err + else + let s:gtm_plugin_status = (s:enable_gtm_status ? substitute(output, '\n\+$', '', '') : '') + endif + let s:last_update = localtime() + let s:last_file = fpath + endif +endfunction + +function! s:gtm_statusline() abort + return s:gtm_plugin_status +endfunction + " +0 ~0 -0 function! s:hunks() abort let hunks = [0,0,0] diff --git a/docs/cn/layers/VersionControl.md b/docs/cn/layers/VersionControl.md index fc3da7f90..d54a94ba1 100644 --- a/docs/cn/layers/VersionControl.md +++ b/docs/cn/layers/VersionControl.md @@ -10,6 +10,7 @@ lang: cn - [模块介绍](#模块介绍) - [启用模块](#启用模块) +- [模块选项](#模块选项) - [快捷键](#快捷键) @@ -30,6 +31,9 @@ lang: cn [[layers]] name = "VersionControl" ``` +## 模块选项 + +`enable-gtm-status`: 在状态栏展示当前分支工作的时间,这一特性需要安装 [gtm](https://github.com/git-time-metric/gtm) 命令。 ## 快捷键 diff --git a/docs/layers/VersionControl.md b/docs/layers/VersionControl.md index 135af92e8..73dcacb5a 100644 --- a/docs/layers/VersionControl.md +++ b/docs/layers/VersionControl.md @@ -10,6 +10,7 @@ description: "This layers provides general version control feature for vim. It s - [Description](#description) - [Features](#features) - [Install](#install) +- [Layer options](#layer-options) - [Key bindings](#key-bindings) @@ -33,6 +34,11 @@ To use this configuration layer, update custom configuration file with: name = "VersionControl" ``` +## Layer options + +`enable-gtm-status`: Enable diplaying time spent within SpaceVim's statusline. This feature need [gtm](https://github.com/git-time-metric/gtm) command to be installed. + + ## Key bindings | Key Binding | Description | From 6057c257f7d0e1bdf1d9a7425fb15a6fd3f1c3bf Mon Sep 17 00:00:00 2001 From: Chen Lijun Date: Sun, 27 Jan 2019 10:22:34 +0100 Subject: [PATCH 040/179] Add: keybinding to open terminal at current file's directory (#2480) --- autoload/SpaceVim/layers/shell.vim | 112 +++++++++++++++++++---------- 1 file changed, 76 insertions(+), 36 deletions(-) diff --git a/autoload/SpaceVim/layers/shell.vim b/autoload/SpaceVim/layers/shell.vim index 933c043cd..bb2f66b0a 100644 --- a/autoload/SpaceVim/layers/shell.vim +++ b/autoload/SpaceVim/layers/shell.vim @@ -37,7 +37,7 @@ let s:file = expand(':~') let s:lnum = expand('') + 2 function! SpaceVim#layers#shell#config() abort call SpaceVim#mapping#space#def('nnoremap', ["'"], 'call call(' - \ . string(function('s:open_default_shell')) . ', [])', + \ . string(function('s:open_default_shell')) . ', [0])', \ ['open shell', \ [ \ "[SPC '] is to open or jump to default shell window", @@ -45,6 +45,15 @@ function! SpaceVim#layers#shell#config() abort \ 'Definition: ' . s:file . ':' . s:lnum, \ ] \ ], 1) + call SpaceVim#mapping#space#def('nnoremap', ["\""], 'call call(' + \ . string(function('s:open_default_shell')) . ', [1])', + \ ["open shell in current file's path", + \ [ + \ "[SPC \"] is to open or jump to default shell window with the current file's pwd", + \ '', + \ 'Definition: ' . s:file . ':' . s:lnum, + \ ] + \ ], 1) if has('nvim') || exists(':tnoremap') == 2 exe 'tnoremap :wincmd l' @@ -115,28 +124,43 @@ function! SpaceVim#layers#shell#get_options() abort endfunction -let s:shell_win_nr = -1 -let s:term_buf_nr = -1 +let s:open_terminals_buffers = [] " shell windows shoud be toggleable, and can be hide. -function! s:open_default_shell() abort - if s:shell_win_nr != 0 && getwinvar(s:shell_win_nr, '&buftype') ==# 'terminal' && &buftype !=# 'terminal' - exe s:shell_win_nr . 'wincmd w' - " fuck gvim bug, startinsert do not work in gvim - if has('nvim') - startinsert +function! s:open_default_shell(open_with_file_cwd) abort + if a:open_with_file_cwd + if getwinvar(winnr(), '&buftype') ==# 'terminal' + let path = getbufvar(winbufnr(winnr()), '_spacevim_shell_cwd', SpaceVim#plugins#projectmanager#current_root()) else - normal! a + let path = expand('%:p:h') endif - return + else + let path = SpaceVim#plugins#projectmanager#current_root() endif - if &buftype ==# 'terminal' - if has('nvim') - startinsert - else - normal! a + + " look for already opened terminal windows + let windows = [] + windo call add(windows, winnr()) + for window in windows + if getwinvar(window, '&buftype') ==# 'terminal' + exe window . 'wincmd w' + if getbufvar(winbufnr(window), '_spacevim_shell_cwd') ==# l:path + " fuck gvim bug, startinsert do not work in gvim + if has('nvim') + startinsert + else + normal! a + endif + return + else + " the opened terminal window is not the one we want. + " close it, we're gonna open a new terminal window with the given l:path + exe 'wincmd c' + break + endif endif - return - endif + endfor + + " no terminal window found. Open a new window let cmd = s:default_position ==# 'top' ? \ 'topleft split' : \ s:default_position ==# 'bottom' ? @@ -144,20 +168,30 @@ function! s:open_default_shell() abort \ s:default_position ==# 'right' ? \ 'rightbelow vsplit' : 'leftabove vsplit' exe cmd + let w:shell_layer_win = 1 let lines = &lines * s:default_height / 100 if lines < winheight(0) && (s:default_position ==# 'top' || s:default_position ==# 'bottom') exe 'resize ' . lines endif - if bufexists(s:term_buf_nr) - exe 'silent b' . s:term_buf_nr - " clear the message - if has('nvim') - startinsert + for open_terminal in s:open_terminals_buffers + if bufexists(open_terminal) + if getbufvar(open_terminal, "_spacevim_shell_cwd") ==# l:path + exe 'silent b' . open_terminal + " clear the message + if has('nvim') + startinsert + else + normal! a + endif + return + endif else - normal! a + " remove closed buffer from list + call remove(s:open_terminals_buffers, 0) endif - return - endif + endfor + + " no terminal window with l:path as cwd has been found, let's open one if s:default_shell ==# 'terminal' if exists(':terminal') if has('nvim') @@ -166,7 +200,8 @@ function! s:open_default_shell() abort else let shell = empty($SHELL) ? 'bash' : $SHELL endif - terminal + enew + call termopen(shell, {'cwd': l:path}) " @bug cursor is not cleared when open terminal windows. " in neovim-qt when using :terminal to open a shell windows, the orgin " cursor position will be highlighted. switch to normal mode and back @@ -178,22 +213,25 @@ function! s:open_default_shell() abort stopinsert startinsert endif - let s:term_buf_nr = bufnr('%') - call extend(s:shell_cached_br, {getcwd() : s:term_buf_nr}) - else + let l:term_buf_nr = bufnr('%') + call extend(s:shell_cached_br, {getcwd() : l:term_buf_nr}) + else + " handle vim terminal if s:SYSTEM.isWindows let shell = empty($SHELL) ? 'cmd.exe' : $SHELL else let shell = empty($SHELL) ? 'bash' : $SHELL endif - let s:term_buf_nr = term_start(shell, {'curwin' : 1, 'term_finish' : 'close'}) + let l:term_buf_nr = term_start(shell, {'cwd': l:path, 'curwin' : 1, 'term_finish' : 'close'}) endif + call add(s:open_terminals_buffers, l:term_buf_nr) let b:_spacevim_shell = shell + let b:_spacevim_shell_cwd = l:path + " use WinEnter autocmd to update statusline doautocmd WinEnter - let s:shell_win_nr = winnr() - let w:shell_layer_win = 1 setlocal nobuflisted nonumber norelativenumber + " use q to hide terminal buffer in vim, if vimcompatible mode is not " enabled, and smart quit is on. if g:spacevim_windows_smartclose == 0 && !g:spacevim_vimcompatible @@ -210,7 +248,9 @@ function! s:open_default_shell() abort endfunction function! SpaceVim#layers#shell#close_terminal() - if bufexists(s:term_buf_nr) - exe 'silent bd!' . s:term_buf_nr - endif + for terminal_bufnr in s:open_terminals_buffers + if bufexists(terminal_bufnr) + exe 'silent bd!' . terminal_bufnr + endif + endfor endfunction From 3a74a6bf891950f5cecaf41d02d1aab695a08819 Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Sun, 27 Jan 2019 20:00:13 +0800 Subject: [PATCH 041/179] Add: add a new function fill_left. (#2514) * Add: add a new function fill_left. --- autoload/SpaceVim/api/data/string.vim | 63 +++++++++++++++------------ 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/autoload/SpaceVim/api/data/string.vim b/autoload/SpaceVim/api/data/string.vim index 927189ec3..fbb5518ff 100644 --- a/autoload/SpaceVim/api/data/string.vim +++ b/autoload/SpaceVim/api/data/string.vim @@ -26,42 +26,49 @@ endfunction function! s:self.fill(str, length) abort if strwidth(a:str) <= a:length - return a:str . repeat(' ', a:length - strwidth(a:str)) + let l:string = a:str else - let l = 0 - for i in range(strchars(a:str) - 1) - if strwidth(strcharpart(a:str, 0, i)) > a:length - break - else - let l = i - endif - endfor - let str = strcharpart(a:str, 0, l) - return str . repeat(' ', a:length - strwidth(str)) + let l:rightmost = 0 + while strwidth(strcharpart(a:str, 0, l:rightmost)) < a:length + let l:rightmost += 1 + endwhile + let l:string = strcharpart(a:str, 0, l:rightmost) endif + let l:spaces = repeat(' ', a:length - strwidth(l:string)) + return l:string . l:spaces +endfunction + +function! s:self.fill_left(str, length) abort + if strwidth(a:str) <= a:length + let l:string = a:str + else + let l:rightmost = 0 + while strwidth(strcharpart(a:str, 0, l:rightmost)) < a:length + let l:rightmost += 1 + endwhile + let l:string = strcharpart(a:str, 0, l:rightmost) + endif + let l:spaces = repeat(' ', a:length - strwidth(l:string)) + return l:spaces . l:string endfunction function! s:self.fill_middle(str, length) abort if strwidth(a:str) <= a:length - "return a:str . repeat(' ', a:length - strwidth(a:str)) - let n = a:length - strwidth(a:str) - if n % 2 == 0 - return repeat(' ', (a:length - strwidth(a:str))/2) . a:str . repeat(' ', (a:length - strwidth(a:str))/2) - else - return repeat(' ', (a:length - strwidth(a:str))/2) . a:str . repeat(' ', (a:length + 1 - strwidth(a:str))/2) - endif + let l:string = a:str else - let l = 0 - for i in range(strchars(a:str) - 1) - if strwidth(strcharpart(a:str, 0, i)) > a:length - break - else - let l = i - endif - endfor - let str = strcharpart(a:str, 0, l) - return str . repeat(' ', a:length - strwidth(str)) + let l:rightmost = 0 + while strwidth(strcharpart(a:str, 0, l:rightmost)) < a:length + let l:rightmost += 1 + endwhile + let l:string = strcharpart(a:str, 0, l:rightmost) endif + let l:numofspaces = a:length - strwidth(l:string) + let l:halfspaces = repeat(' ', l:numofspaces/2) + let l:rst = l:halfspaces . a:str . l:halfspaces + if l:numofspaces % 2 + let l:rst .= ' ' + endif + return l:rst endfunction function! s:self.trim_start(str) abort From eede4cfbe38f5e72a6496ead559352b41457c4a3 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Mon, 28 Jan 2019 17:50:20 +0800 Subject: [PATCH 042/179] Improve data#string api (#2515) - add fill_left and fill_middle function - fix string api doc - add string api cn doc --- autoload/SpaceVim/api/data/string.vim | 66 +++++++++++++++++-------- autoload/SpaceVim/layers/tools/zeal.vim | 1 + doc/SpaceVim.txt | 14 ++++++ docs/api/data/string.md | 16 ++++-- docs/cn/api.md | 19 +++---- docs/cn/api/data/string.md | 42 ++++++++++++++++ test/api/data/string.vader | 38 ++++++++++++-- 7 files changed, 159 insertions(+), 37 deletions(-) create mode 100644 docs/cn/api/data/string.md diff --git a/autoload/SpaceVim/api/data/string.vim b/autoload/SpaceVim/api/data/string.vim index fbb5518ff..55d517bec 100644 --- a/autoload/SpaceVim/api/data/string.vim +++ b/autoload/SpaceVim/api/data/string.vim @@ -16,6 +16,14 @@ " split(str [, sep [, keepempty[, max]]]) " " run vim command, and return the output of such command. +" +" trim(str) +" +" remove space at the begin and end of a string, same as |trim()| +" +" fill(str, length[, char]) +" +" fill string to length with {char}, if {char} is omnit, a space is used. let s:self = {} @@ -24,7 +32,7 @@ function! s:self.trim(str) abort return substitute(str, '^\s*', '', 'g') endfunction -function! s:self.fill(str, length) abort +function! s:self.fill(str, length, ...) abort if strwidth(a:str) <= a:length let l:string = a:str else @@ -34,39 +42,43 @@ function! s:self.fill(str, length) abort endwhile let l:string = strcharpart(a:str, 0, l:rightmost) endif - let l:spaces = repeat(' ', a:length - strwidth(l:string)) + let char = get(a:000, 0, ' ') + if type(char) !=# 1 || len(char) > 1 + let char = ' ' + endif + let l:spaces = repeat(char, a:length - strwidth(l:string)) return l:string . l:spaces endfunction -function! s:self.fill_left(str, length) abort +function! s:self.fill_left(str, length, ...) abort if strwidth(a:str) <= a:length let l:string = a:str else - let l:rightmost = 0 - while strwidth(strcharpart(a:str, 0, l:rightmost)) < a:length - let l:rightmost += 1 - endwhile - let l:string = strcharpart(a:str, 0, l:rightmost) + let l:string = strcharpart(a:str, strwidth(a:str) - a:length, a:length) endif - let l:spaces = repeat(' ', a:length - strwidth(l:string)) + let char = get(a:000, 0, ' ') + if type(char) !=# 1 || len(char) > 1 + let char = ' ' + endif + let l:spaces = repeat(char, a:length - strwidth(l:string)) return l:spaces . l:string endfunction -function! s:self.fill_middle(str, length) abort +function! s:self.fill_middle(str, length, ...) abort if strwidth(a:str) <= a:length let l:string = a:str else - let l:rightmost = 0 - while strwidth(strcharpart(a:str, 0, l:rightmost)) < a:length - let l:rightmost += 1 - endwhile - let l:string = strcharpart(a:str, 0, l:rightmost) + let l:string = strcharpart(a:str, (a:length/2 < 1 ? 1 : a:length/2), a:length) endif let l:numofspaces = a:length - strwidth(l:string) - let l:halfspaces = repeat(' ', l:numofspaces/2) - let l:rst = l:halfspaces . a:str . l:halfspaces + let char = get(a:000, 0, ' ') + if type(char) !=# 1 || len(char) > 1 + let char = ' ' + endif + let l:halfspaces = repeat(char, l:numofspaces/2) + let l:rst = l:halfspaces . l:string . l:halfspaces if l:numofspaces % 2 - let l:rst .= ' ' + let l:rst .= char endif return l:rst endfunction @@ -79,11 +91,17 @@ function! s:self.trim_end(str) abort return substitute(a:str, '\s*$', '', 'g') endfunction + +" note: this function only works when encoding is utf-8 +" ref: https://github.com/SpaceVim/SpaceVim/pull/2515 function! s:self.string2chars(str) abort + let save_enc = &encoding + let &encoding = 'utf-8' let chars = [] - for i in range(len(a:str)) - call add(chars, a:str[i : i]) + for i in range(strchars(a:str)) + call add(chars, strcharpart(a:str, i , 1)) endfor + let &encoding = save_enc return chars endfunction @@ -108,13 +126,15 @@ function! s:self.strAllIndex(str, need, use_expr) abort endfunction function! s:self.strQ2B(str) abort + let save_enc = &encoding + let &encoding = 'utf-8' let chars = self.string2chars(a:str) let bchars = [] for char in chars let nr = char2nr(char) if nr == 12288 call add(bchars, nr2char(32)) - elseif nr == 8216 && nr == 8217 + elseif nr == 8216 || nr == 8217 call add(bchars, nr2char(39)) elseif nr >= 65281 && nr <= 65374 call add(bchars, nr2char(nr - 65248)) @@ -122,10 +142,13 @@ function! s:self.strQ2B(str) abort call add(bchars, char) endif endfor + let &encoding = save_enc return join(bchars, '') endfunction function! s:self.strB2Q(str) abort + let save_enc = &encoding + let &encoding = 'utf-8' let chars = self.string2chars(a:str) let bchars = [] for char in chars @@ -138,6 +161,7 @@ function! s:self.strB2Q(str) abort call add(bchars, char) endif endfor + let &encoding = save_enc return join(bchars, '') endfunction diff --git a/autoload/SpaceVim/layers/tools/zeal.vim b/autoload/SpaceVim/layers/tools/zeal.vim index 1b6f5cacb..441867b1a 100644 --- a/autoload/SpaceVim/layers/tools/zeal.vim +++ b/autoload/SpaceVim/layers/tools/zeal.vim @@ -10,6 +10,7 @@ " @section tools#zeal, layer-tools-zeal " @parentsection layers " This layer provides Zeal integration for SpaceVim + function! SpaceVim#layers#tools#zeal#plugins() abort return [ \ ['KabbAmine/zeavim.vim', { diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 69b628aa0..9a86741d7 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -76,6 +76,7 @@ CONTENTS *SpaceVim-contents* 31. shell.........................................|SpaceVim-layer-shell| 32. tmux...........................................|SpaceVim-layer-tmux| 33. tools#dash...............................|SpaceVim-layer-tools-dash| + 34. tools#zeal...............................|SpaceVim-layer-tools-zeal| 7. API........................................................|SpaceVim-api| 1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu| 2. data#dict....................................|SpaceVim-api-data-dict| @@ -1362,6 +1363,11 @@ TOOLS#DASH *SpaceVim-layer-tools-dash* This layer provides Dash integration for SpaceVim +============================================================================== +TOOLS#ZEAL *SpaceVim-layer-tools-zeal* + +This layer provides Zeal integration for SpaceVim + ============================================================================== API *SpaceVim-api* @@ -1450,6 +1456,14 @@ split(str [, sep [, keepempty[, max]]]) run vim command, and return the output of such command. +trim(str) + + remove space at the begin and end of a string, same as |trim()| + +fill(str, length[, char]) + + fill string to length with {char}, if {char} is omnit, a space is used. + ============================================================================== JOB *SpaceVim-api-job* diff --git a/docs/api/data/string.md b/docs/api/data/string.md index 4d90f8ad8..e9e08f5f8 100644 --- a/docs/api/data/string.md +++ b/docs/api/data/string.md @@ -26,6 +26,16 @@ echo str1 ## functions -| name | description | -| ----------- | ------------------------------------------------------------------------ | -| `trim(str)` | remove spaces from the beginning and end of a string, return the resuilt | +| name | description | +| ------------------------------- | ------------------------------------------------------------------------ | +| `trim(str)` | remove spaces from the beginning and end of a string, return the resuilt | +| `trim_start(str)` | remove spaces from the beginning a string, return the resuilt | +| `trim_end(str)` | remove spaces from the end of a string, return the resuilt | +| `fill(str, len[, char])` | fill the char after string | +| `fill_left(str, len[, char])` | same as fill(), but the char will be append on the left | +| `fill_middle(str, len[, char])` | same as fill(), but the char will be append arround the string | +| `string2chars(str)` | return a list of chars in the string | +| `strALLIndex(str, )` | return a list of position found in this string | +| `strQ2B(str)` | change string form Q 2 B | +| `strB2Q(str)` | change string form B 2 Q | +| `split(str)` | split string into list | diff --git a/docs/cn/api.md b/docs/cn/api.md index 0e541c88f..e015a75e2 100644 --- a/docs/cn/api.md +++ b/docs/cn/api.md @@ -43,14 +43,15 @@ echom s:file.pathSeparator ## 可用 APIs -| 名称 | 描述 | -| ------------------------------------- | ------------------------------------------------------------------------- | -| [data#dict](data/dict/) | data#dict API 提供了一些处理字典变量的常用方法,包括基础的增删改查。 | -| [file](file/) | 文件函数提供了基础的文件读写相关函数,兼容不同系统平台。 | -| [job](job/) | 兼容 Neovim 和 Vim 的异步协同 API,对于旧版 Vim 采用非异步机制。 | -| [system](system/) | system 函数提供了系统相关函数,包括判断当前系统平台,文件格式等函数。 | -| [unicode#spinners](unicode/spinners/) | unicode#spinners API 可启用一个定时器,根据指定的名称定时更新进度条符号。 | -| [vim#command](vim/command/) | vim#command API 提供一些设置和获取 Vim 命令的基础函数。 | -| [vim#highlight](vim/highlight/) | vim#highlight API 提供一些设置和获取 Vim 高亮信息的基础函数。 | +| 名称 | 描述 | +| ------------------------------------- | ----------------------------------------------------------------------- | +| [data#dict](data/dict/) | data#dict API 提供了一些处理字典变量的常用方法,包括基础的增删改查。 | +| [data#string](data/string/) | data#string 函数库主要提供一些操作字符串的常用函数。 | +| [file](file/) | 文件函数提供了基础的文件读写相关函数,兼容不同系统平台。 | +| [job](job/) | 兼容 neovim 和 vim 的异步协同 API,对于旧版 vim 采用非异步机制 | +| [system](system/) | system 函数提供了系统相关函数,包括判断当前系统平台,文件格式等函数。 | +| [unicode#spinners](unicode/spinners/) | unicode#spinners API 可启用一个定时器,根据指定的名称定时更新进度条符号 | +| [vim#command](vim/command/) | vim#command API 提供一些设置和获取 Vim 命令的基础函数。 | +| [vim#highlight](vim/highlight/) | vim#highlight API 提供一些设置和获取 Vim 高亮信息的基础函数。 | diff --git a/docs/cn/api/data/string.md b/docs/cn/api/data/string.md new file mode 100644 index 000000000..80cb28d38 --- /dev/null +++ b/docs/cn/api/data/string.md @@ -0,0 +1,42 @@ +--- +title: "data#string 函数库" +description: "data#string 函数库主要提供一些操作字符串的常用函数。" +lang: cn +--- + +# [可用函数库](../../) >> data#string + + + +- [简介](#简介) +- [函数](#函数) + + + +## 简介 + +`data#string` 函数提供了一些操作字符串的工具方法,以下为使用这一函数的示例: + +```vim +let s:STR = SpaceVim#api#import('data#string') +let str1 = ' hello world ' +let str2 = s:STR.trim(str1) +echo str1 +" 此时将看到打印 `hello world` +``` + +## 函数 + +| 名称 | 功能描述 | +| ------------------------------- | ---------------------------------------------------- | +| `trim(str)` | 移除字符串首尾空白字符,包括空格、制表符等,返回结果 | +| `trim_start(str)` | 移除字符串首部空白字符,包括空格、制表符等,返回结果 | +| `trim_end(str)` | 移除字符串尾部空白字符,包括空格、制表符等,返回结果 | +| `fill(str, len[, char])` | 字符串尾部填充或删除字符以达到指定可视长度 | +| `fill_left(str, len[, char])` | 类似于`fill()`, 但是在首部填充或删除字符 | +| `fill_middle(str, len[, char])` | 类似于`fill()`, 但是在两次同时填充或删除字符 | +| `string2chars(str)` | 将字符串转换成一组字符列表并返回 | +| `strALLIndex(str, )` | 在字符串中查询某个表达式,并返回一组匹配位置列表 | +| `strQ2B(str)` | 将字符串从全角转化为半角 | +| `strB2Q(str)` | 将字符串从半角转化为全角 | +| `split(str)` | 拆分字符串 | diff --git a/test/api/data/string.vader b/test/api/data/string.vader index 2134c404c..117edb407 100644 --- a/test/api/data/string.vader +++ b/test/api/data/string.vader @@ -1,13 +1,43 @@ Execute ( SpaceVim api: data#string ): let str = SpaceVim#api#import('data#string') - AssertEqual str.split(' 20 281 23 -invalid-', '', 0, 4)[2], '23' + Log 'test trim()' AssertEqual str.trim(' s b '), 's b' - AssertEqual str.trim_start(' s b '), 's b ' - AssertEqual str.trim_end(' s b '), ' s b' + Log 'test fill()' AssertEqual str.fill('s b', 10), 's b ' - AssertEqual str.fill_middle('s b', 10), ' s b ' + Log 'test fill() len < strlen' + AssertEqual str.fill('s b', 2), 's ' + Log 'test fill() with char' + AssertEqual str.fill('s b', 10, '*'), 's b*******' + Log 'test fill_left()' + AssertEqual str.fill_left('s b', 10, '*'), '*******s b' + Log 'test fill_left() len = strlen' + AssertEqual str.fill_left('s b', 3, '*'), 's b' + Log 'test fill_left() len < strlen' + AssertEqual str.fill_left('s b', 2, '*'), ' b' + Log 'test fill_middle()' + AssertEqual str.fill_middle('s b', 9, '*'), '***s b***' + Log 'test fill_middle() fill number % 2 = 1' + AssertEqual str.fill_middle('s b', 10, '*'), '***s b****' + Log 'test fill_middle() len = strlen' + AssertEqual str.fill_middle('s b', 3, '*'), 's b' + Log 'test fill_middle() len < strlen' + AssertEqual str.fill_middle('s b', 2, '*'), ' b' + AssertEqual str.fill_middle('s b', 1, '*'), ' ' + Log 'test split()' + AssertEqual str.split(' 20 281 23 -invalid-', '', 0, 4)[2], '23' + Log 'test trim_start()' + AssertEqual str.trim_start(' s b '), 's b ' + Log 'test string2chars()' AssertEqual str.string2chars(' a b '), [' ', 'a', ' ', 'b', ' '] + AssertEqual str.string2chars('你好'), ['你', '好'] + Log 'test strQ2B()' + AssertEqual str.strQ2B('%'), '%' + Log 'test strB2Q()' + AssertEqual str.strB2Q('%'), '%' + AssertEqual str.trim_end(' s b '), ' s b' + AssertEqual str.fill_middle('s b', 10), ' s b ' AssertEqual str.strAllIndex('hello spacevim hello', 'hello', 0), [[0, 5], [15, 20]] AssertEqual str.strAllIndex('hello spacevim hello', 'he.*', 1), [[0, 20]] AssertEqual str.strAllIndex('hello spacevim hello', 'he[^ ]*', 1), [[0, 5], [15, 20]] AssertEqual str.strAllIndex('let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end', 's.cursor[^_]*', 1), [[4, 12], [28, 36], [55, 63]] + unlet str From ec5b8d0a01a4dea5c916fe125acfdc47fc6b802f Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Mon, 28 Jan 2019 22:12:37 +0800 Subject: [PATCH 043/179] fix vim script lint (#2519) --- .SpaceVim.d/autoload/SpaceVim/dev/g.vim | 4 +- .../autoload/SpaceVim/dev/releases.vim | 3 +- .../autoload/SpaceVim/dev/send_to_channel.vim | 6 +- .ci/after_failure.sh | 3 +- .ci/common/github_commenter.vim | 4 +- .ci/install.sh | 1 - .ci/script.sh | 1 + autoload/SpaceVim/api/bash/complete.vim | 14 +- autoload/SpaceVim/api/color.vim | 2 +- autoload/SpaceVim/api/data/list.vim | 4 +- autoload/SpaceVim/api/unicode/icon.vim | 2 +- autoload/SpaceVim/api/vim/command.vim | 10 +- autoload/SpaceVim/api/vim/key.vim | 2 +- autoload/SpaceVim/api/vim/tab.vim | 2 +- autoload/SpaceVim/issue.vim | 2 +- autoload/SpaceVim/layers/VersionControl.vim | 4 +- autoload/SpaceVim/layers/chat.vim | 2 +- autoload/SpaceVim/layers/core/banner.vim | 2 +- autoload/SpaceVim/layers/core/statusline.vim | 60 ++++---- autoload/SpaceVim/layers/edit.vim | 6 +- autoload/SpaceVim/layers/fzf.vim | 40 +++--- autoload/SpaceVim/layers/lang/fsharp.vim | 2 +- autoload/SpaceVim/layers/lang/lisp.vim | 58 ++++---- autoload/SpaceVim/layers/lang/markdown.vim | 8 +- autoload/SpaceVim/layers/lang/sh.vim | 2 +- autoload/SpaceVim/layers/lang/vim.vim | 4 +- autoload/SpaceVim/layers/lsp.vim | 2 +- autoload/SpaceVim/layers/mail.vim | 2 +- autoload/SpaceVim/layers/shell.vim | 12 +- autoload/SpaceVim/layers/tags.vim | 2 +- autoload/SpaceVim/lsp.vim | 23 +-- autoload/SpaceVim/mapping.vim | 4 +- autoload/SpaceVim/mapping/g.vim | 2 +- autoload/SpaceVim/mapping/guide.vim | 133 +++++++++--------- .../mapping/guide/theme/jellybeans.vim | 72 +++++----- .../mapping/guide/theme/solarized.vim | 32 ++--- autoload/SpaceVim/mapping/leader.vim | 8 +- autoload/SpaceVim/mapping/tab.vim | 2 +- autoload/SpaceVim/plugins/a.vim | 8 +- autoload/SpaceVim/plugins/bashcomplete.vim | 2 +- autoload/SpaceVim/plugins/flygrep.vim | 11 +- autoload/SpaceVim/plugins/help.vim | 6 +- autoload/SpaceVim/plugins/iedit.vim | 18 +-- autoload/SpaceVim/plugins/pmd.vim | 8 +- autoload/SpaceVim/plugins/projectmanager.vim | 4 +- autoload/SpaceVim/plugins/quickfix.vim | 12 +- autoload/SpaceVim/plugins/runner.vim | 4 +- autoload/SpaceVim/plugins/windisk.vim | 4 +- autoload/SpaceVim/server.vim | 8 +- autoload/zvim/debug.vim | 2 +- colors/SpaceVim.vim | 6 +- config/functions.vim | 20 +-- config/main.vim | 3 +- config/plugins/asyncomplete-buffer.vim | 15 +- config/plugins/asyncomplete-clang.vim | 21 +-- config/plugins/asyncomplete-necovim.vim | 13 +- config/plugins/asyncomplete-omni.vim | 15 +- config/plugins/java_getset.vim | 4 +- config/plugins_before/ale.vim | 2 +- filetype.vim | 7 +- syntax/HelpDescribe.vim | 4 +- syntax/SpaceVimFindArgv.vim | 4 +- syntax/SpaceVimQuickFix.vim | 4 +- 63 files changed, 389 insertions(+), 358 deletions(-) diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/g.vim b/.SpaceVim.d/autoload/SpaceVim/dev/g.vim index 24ebfb8e8..949e46f27 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/g.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/g.vim @@ -1,8 +1,8 @@ -function! SpaceVim#dev#g#updatedoc() +function! SpaceVim#dev#g#updatedoc() abort let keys = keys(g:_spacevim_mappings_g) let lines = [] for key in keys - if key == '`' + if key ==# '`' let line = '`` g' . key . ' `` | ' . g:_spacevim_mappings_g[key][1] else let line = '`g' . key . '` | ' . g:_spacevim_mappings_g[key][1] diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim b/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim index 1985b666f..ad0a3f486 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim @@ -6,6 +6,7 @@ " License: GPLv3 "============================================================================= +scriptencoding utf-8 " 2017-08-05 v0.4.0 is released at https://github.com/SpaceVim/SpaceVim/pull/768 " 2017-11-16 v0.5.0 is released at https://github.com/SpaceVim/SpaceVim/pull/966 @@ -112,7 +113,7 @@ endfunction " this function is to generate markdown form pull request list function! SpaceVim#dev#releases#parser_prs(prs, ...) abort - let is_cn = get(a:000, 0, '') == 'cn' + let is_cn = get(a:000, 0, '') ==# 'cn' let g:is_cn = is_cn let md = [] let adds = [] diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/send_to_channel.vim b/.SpaceVim.d/autoload/SpaceVim/dev/send_to_channel.vim index 789e170a6..8017e36a4 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/send_to_channel.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/send_to_channel.vim @@ -5,10 +5,10 @@ let s:port = '9995' let s:JSON = SpaceVim#api#import('data#json') let s:JOB = SpaceVim#api#import('job') -func! SpaceVim#dev#send_to_channel#setport(port) +func! SpaceVim#dev#send_to_channel#setport(port) abort let s:port = a:port endf -func! SpaceVim#dev#send_to_channel#send(t) +func! SpaceVim#dev#send_to_channel#send(t) abort if a:t ==# 'line' call s:sendline() @@ -16,7 +16,7 @@ func! SpaceVim#dev#send_to_channel#send(t) endf -func! s:send(msg) +func! s:send(msg) abort let msg = { \ 'text' : a:msg, \ 'username' : s:username, diff --git a/.ci/after_failure.sh b/.ci/after_failure.sh index 8b9672082..920c977fe 100755 --- a/.ci/after_failure.sh +++ b/.ci/after_failure.sh @@ -9,7 +9,8 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then VIMLINT_LOG=`cat build_log` echo "$VIMLINT_LOG" git clone https://github.com/wsdjeg/GitHub.vim.git build/GitHub.vim - docker run -it --rm \ + docker run \ + -it --rm \ -v $PWD/.ci:/.ci \ -v $PWD/autoload/SpaceVim/api:/API/autoload/SpaceVim/api \ -v $PWD/autoload/SpaceVim/api.vim:/API/autoload/SpaceVim/api.vim \ diff --git a/.ci/common/github_commenter.vim b/.ci/common/github_commenter.vim index efef4d22b..4e8d8731f 100644 --- a/.ci/common/github_commenter.vim +++ b/.ci/common/github_commenter.vim @@ -25,7 +25,7 @@ function! s:update_log(log, summary, new_log) abort endfunction if !empty(s:log) - if $LINT == 'vader' + if $LINT ==# 'vader' let s:summary = $VIM . ' ' . $LINT . ' build log' else let s:summary = $LINT . ' build log' @@ -50,7 +50,7 @@ if !empty(s:log) endif endif else - if $LINT == 'vader' + if $LINT ==# 'vader' let s:summary = $VIM . ' ' . $LINT . ' build log' else let s:summary = $LINT . ' build log' diff --git a/.ci/install.sh b/.ci/install.sh index 1f3aa48c9..319665610 100755 --- a/.ci/install.sh +++ b/.ci/install.sh @@ -7,7 +7,6 @@ set -ue -o pipefail export LC_ALL=C docker pull spacevim/vims - git fetch origin master:master if [ "${LINT#vimlint}" != "$LINT" ]; then diff --git a/.ci/script.sh b/.ci/script.sh index 1cca74acd..47e24ad91 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -ex +export TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} if [ "$LINT" = "vimlint" ]; then for file in $(git diff --name-only HEAD dev | grep .vim$); do diff --git a/autoload/SpaceVim/api/bash/complete.vim b/autoload/SpaceVim/api/bash/complete.vim index 5119a5363..42bc4c3aa 100644 --- a/autoload/SpaceVim/api/bash/complete.vim +++ b/autoload/SpaceVim/api/bash/complete.vim @@ -14,8 +14,11 @@ let s:COP = SpaceVim#api#import('vim#compatible') " this is for vim command completion +" @vimlint(EVL103, 1, a:ArgLead) +" @vimlint(EVL103, 1, a:CmdLine) +" @vimlint(EVL103, 1, a:CursorPos) function! s:self.complete(ArgLead, CmdLine, CursorPos) abort - if a:CmdLine =~ '^\s\{0,\}\w\+$' + if a:CmdLine =~? '^\s\{0,\}\w\+$' return s:COP.systemlist('compgen -c ' . a:CmdLine) endif let result = s:COP.systemlist([s:completer, a:CmdLine]) @@ -26,11 +29,11 @@ endfunction " this is for vim input() function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort - if a:CmdLine =~ '^\s\{0,\}\w\+$' + if a:CmdLine =~? '^\s\{0,\}\w\+$' return s:COP.systemlist('compgen -c ' . a:CmdLine) endif let result = s:COP.systemlist([s:completer, a:CmdLine]) - if a:ArgLead == '' + if a:ArgLead ==# '' let result = map(result, 'a:CmdLine . v:val') else let leader = substitute(a:CmdLine, '[^ ]*$', '', 'g') @@ -39,9 +42,12 @@ function! s:self.complete_input(ArgLead, CmdLine, CursorPos) abort return result endfunction +" @vimlint(EVL103, 0, a:ArgLead) +" @vimlint(EVL103, 0, a:CmdLine) +" @vimlint(EVL103, 0, a:CursorPos) -function! SpaceVim#api#bash#complete#get() +function! SpaceVim#api#bash#complete#get() abort return deepcopy(s:self) diff --git a/autoload/SpaceVim/api/color.vim b/autoload/SpaceVim/api/color.vim index 2e08b37b0..1163105f9 100644 --- a/autoload/SpaceVim/api/color.vim +++ b/autoload/SpaceVim/api/color.vim @@ -69,7 +69,7 @@ endfunction function! s:self.str2nr(str) abort let nr = get(self._deps.swap(self._color_map), a:str, -1) - if nr =~ 'fg\|bg\|NONE' + if nr =~# 'fg\|bg\|NONE' return nr else return str2nr(nr) diff --git a/autoload/SpaceVim/api/data/list.vim b/autoload/SpaceVim/api/data/list.vim index a2f9e3789..d05eac8ae 100644 --- a/autoload/SpaceVim/api/data/list.vim +++ b/autoload/SpaceVim/api/data/list.vim @@ -60,7 +60,7 @@ function! s:pop(list) abort return remove(a:list, -1) endfunction -function! s:listpart(list, start, ...) +function! s:listpart(list, start, ...) abort let idx = range(a:start, a:start + get(a:000, 0, 0)) let rst = [] for i in idx @@ -140,7 +140,7 @@ function! s:has_index(list, index) abort return 0 <= a:index && a:index < len(a:list) endfunction -function! s:replace(list, begin, end, re_list) +function! s:replace(list, begin, end, re_list) abort if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list) return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:] else diff --git a/autoload/SpaceVim/api/unicode/icon.vim b/autoload/SpaceVim/api/unicode/icon.vim index 474355b74..ff591518e 100644 --- a/autoload/SpaceVim/api/unicode/icon.vim +++ b/autoload/SpaceVim/api/unicode/icon.vim @@ -23,7 +23,7 @@ function! s:self.battery_status(v) abort endif endfunction -function! SpaceVim#api#unicode#icon#get() +function! SpaceVim#api#unicode#icon#get() abort return deepcopy(s:self) diff --git a/autoload/SpaceVim/api/vim/command.vim b/autoload/SpaceVim/api/vim/command.vim index c7fadf7f7..a12e69002 100644 --- a/autoload/SpaceVim/api/vim/command.vim +++ b/autoload/SpaceVim/api/vim/command.vim @@ -61,9 +61,9 @@ function! s:self.complete(ArgLead, CmdLine, CursorPos) abort let msg = 'ArgLead: ' . a:ArgLead . ' CmdLine: ' . a:CmdLine . ' CursorPos: ' \ . a:CursorPos . ' LastArgv: ' . last_argv call add(self._message, msg) - if a:ArgLead == '' && index(keys(self.options), last_argv) == -1 + if a:ArgLead ==# '' && index(keys(self.options), last_argv) == -1 return join(keys(self.options), "\n") - elseif a:ArgLead == '' && index(keys(self.options), last_argv) != -1 + elseif a:ArgLead ==# '' && index(keys(self.options), last_argv) != -1 return self._complete_opt(a:ArgLead, last_argv) elseif !empty(a:ArgLead) && len(argvs) >= 3 \ && index(keys(self.options), argvs[-2]) != -1 @@ -85,9 +85,9 @@ function! s:self.completelist(ArgLead, CmdLine, CursorPos) abort let msg = 'ArgLead: ' . a:ArgLead . ' CmdLine: ' . a:CmdLine . ' CursorPos: ' \ . a:CursorPos . ' LastArgv: ' . last_argv call add(self._message, msg) - if a:ArgLead == '' && index(keys(self.options), last_argv) == -1 + if a:ArgLead ==# '' && index(keys(self.options), last_argv) == -1 return keys(self.options) - elseif a:ArgLead == '' && index(keys(self.options), last_argv) != -1 + elseif a:ArgLead ==# '' && index(keys(self.options), last_argv) != -1 return self._complete_opt_list(a:ArgLead, last_argv) elseif !empty(a:ArgLead) && len(argvs) >= 3 \ && index(keys(self.options), argvs[-2]) != -1 @@ -108,7 +108,7 @@ endfunction -function! SpaceVim#api#vim#command#get() +function! SpaceVim#api#vim#command#get() abort return deepcopy(s:self) endfunction diff --git a/autoload/SpaceVim/api/vim/key.vim b/autoload/SpaceVim/api/vim/key.vim index 882bea5f4..c45e6ba39 100644 --- a/autoload/SpaceVim/api/vim/key.vim +++ b/autoload/SpaceVim/api/vim/key.vim @@ -33,6 +33,6 @@ function! s:self.nr2name(nr) abort endfunction -function! SpaceVim#api#vim#key#get() +function! SpaceVim#api#vim#key#get() abort return deepcopy(s:self) endfunction diff --git a/autoload/SpaceVim/api/vim/tab.vim b/autoload/SpaceVim/api/vim/tab.vim index dc8650feb..6d0408988 100644 --- a/autoload/SpaceVim/api/vim/tab.vim +++ b/autoload/SpaceVim/api/vim/tab.vim @@ -30,7 +30,7 @@ function! s:self.get_tree() abort endfunction function! s:self.realTabBuffers(id) abort - return filter(copy(tabpagebuflist(a:id)), 'buflisted(v:val) && getbufvar(v:val, "&buftype") == ""') + return filter(copy(tabpagebuflist(a:id)), 'buflisted(v:val) && getbufvar(v:val, "&buftype") ==# ""') endfunction function! SpaceVim#api#vim#tab#get() abort diff --git a/autoload/SpaceVim/issue.vim b/autoload/SpaceVim/issue.vim index 6a4f37c4d..b04bd3bdb 100644 --- a/autoload/SpaceVim/issue.vim +++ b/autoload/SpaceVim/issue.vim @@ -90,7 +90,7 @@ function! SpaceVim#issue#new() abort endfunction -function! SpaceVim#issue#reopen(id) +function! SpaceVim#issue#reopen(id) abort let issue = { \ 'state' : 'open' \ } diff --git a/autoload/SpaceVim/layers/VersionControl.vim b/autoload/SpaceVim/layers/VersionControl.vim index dab8425aa..c05ae933a 100644 --- a/autoload/SpaceVim/layers/VersionControl.vim +++ b/autoload/SpaceVim/layers/VersionControl.vim @@ -83,14 +83,14 @@ let s:last_file = '' let s:update_interval = 30 let s:gtm_plugin_status = '' -function! s:record() +function! s:record() abort let fpath = expand('%:p') " record if file path has changed or last update is greater than update_interval if (s:last_file != fpath || localtime() - s:last_update > s:update_interval) && filereadable(fpath) let s:cmd = (s:enable_gtm_status == 1 ? 'gtm record --status' : 'gtm record') let output=system(s:cmd . ' ' . shellescape(fpath)) if v:shell_error - echoerr s:no_gtm_err + echoerr 'failed to run ' . s:cmd . ' ' . shellescape(fpath) else let s:gtm_plugin_status = (s:enable_gtm_status ? substitute(output, '\n\+$', '', '') : '') endif diff --git a/autoload/SpaceVim/layers/chat.vim b/autoload/SpaceVim/layers/chat.vim index c93d3f769..e90726d69 100644 --- a/autoload/SpaceVim/layers/chat.vim +++ b/autoload/SpaceVim/layers/chat.vim @@ -14,7 +14,7 @@ endfunction let s:BASE64 = SpaceVim#api#import('data#base64') -function! SpaceVim#layers#chat#config() +function! SpaceVim#layers#chat#config() abort let g:chatting_server_ip = s:BASE64.decode('NDUuNzYuMTAwLjQ5') let g:chatting_server_port = 8989 if !exists('g:chatting_server_lib') diff --git a/autoload/SpaceVim/layers/core/banner.vim b/autoload/SpaceVim/layers/core/banner.vim index 30619ee9f..bb64af249 100644 --- a/autoload/SpaceVim/layers/core/banner.vim +++ b/autoload/SpaceVim/layers/core/banner.vim @@ -145,7 +145,7 @@ function! SpaceVim#layers#core#banner#config() abort \ [ \ '', \ '', - \ " ######### ######### ######### ######### ################## ", + \ ' ######### ######### ######### ######### ################## ', \ " ###(_)### [`\'`\'] ##\\`.\'/## \':v:` ##/\\:/\\## |:+:| ##\':v:`## \\`.\'/ ##[`\'`\']###\\`~\'/## \\`.\'/ ", \ " ###| |### |::| ##(o:o)## (o:0) #/(o:o)\\# (o:o) ##(o:0)## (o:o) ###|::|####(o o)## (o:o) ", \ " ###|_|### |::| ###\\:/:\\# (:) ###(:)### (:) ###(:)### \\:/:\\ ###|::|#####\\ / \\# \\:/:\\ ", diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index d298344b1..82d8ea108 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -113,7 +113,7 @@ function! s:winnr(...) abort endif endfunction -function! SpaceVim#layers#core#statusline#winnr(id) +function! SpaceVim#layers#core#statusline#winnr(id) abort return s:MESSLETTERS.circled_num(a:id, g:spacevim_windows_index_type) endfunction @@ -217,7 +217,7 @@ endfunction if g:spacevim_enable_neomake - function! s:syntax_checking() + function! s:syntax_checking() abort if !exists('g:loaded_neomake') return '' endif @@ -229,7 +229,7 @@ if g:spacevim_enable_neomake return l endfunction elseif g:spacevim_enable_ale - function! s:syntax_checking() + function! s:syntax_checking() abort if !exists('g:ale_enabled') return '' endif @@ -241,7 +241,7 @@ elseif g:spacevim_enable_ale return l endfunction else - function! s:syntax_checking() + function! s:syntax_checking() abort if !exists(':SyntasticCheck') return '' endif @@ -288,13 +288,13 @@ let s:registed_sections = { function! s:check_mode() abort - if mode() == 'n' + if mode() ==# 'n' return 'n' - elseif mode() =='i' + elseif mode() ==# 'i' return 'i' - elseif mode() =~ 'v' + elseif mode() =~# 'v' return 'v' - elseif mode() =~ 'R' + elseif mode() =~# 'R' return 'R' endif endfunction @@ -317,7 +317,7 @@ endfunction function! SpaceVim#layers#core#statusline#_current_tag() abort let tag = '' try - let tag =tagbar#currenttag("%s ", "") + let tag =tagbar#currenttag('%s ', '') catch endtry return tag @@ -371,7 +371,7 @@ function! SpaceVim#layers#core#statusline#get(...) abort elseif &filetype ==# 'gina-commit' return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep \ . '%#SpaceVim_statusline_b# Gina commit %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' ' - elseif &filetype ==# 'diff' && bufname('%') =~ '^gina://' + elseif &filetype ==# 'diff' && bufname('%') =~# '^gina://' return '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep \ . '%#SpaceVim_statusline_b# Gina diff %#SpaceVim_statusline_b_SpaceVim_statusline_c#' . s:lsep . ' ' elseif &filetype ==# 'nerdtree' @@ -479,7 +479,7 @@ endfunction function! s:inactive() abort let l = '%#SpaceVim_statusline_ia#' . s:winnr(1) . '%#SpaceVim_statusline_ia_SpaceVim_statusline_b#' . s:lsep . '%#SpaceVim_statusline_b#' - let secs = [s:filename(), " " . &filetype, s:modes()] + let secs = [s:filename(), ' ' . &filetype, s:modes()] let base = 10 for sec in secs let len = s:STATUSLINE.len(sec) @@ -572,7 +572,7 @@ function! SpaceVim#layers#core#statusline#toggle_section(name) abort let s:section_old_pos[a:name] = ['l', index(s:loaded_sections_l, a:name)] call remove(s:loaded_sections_l, index(s:loaded_sections_l, a:name)) elseif has_key(s:section_old_pos, a:name) - if s:section_old_pos[a:name][0] == 'r' + if s:section_old_pos[a:name][0] ==# 'r' call insert(s:loaded_sections_r, a:name, s:section_old_pos[a:name][1]) else call insert(s:loaded_sections_l, a:name, s:section_old_pos[a:name][1]) @@ -581,7 +581,7 @@ function! SpaceVim#layers#core#statusline#toggle_section(name) abort let &l:statusline = SpaceVim#layers#core#statusline#get(1) endfunction -function! SpaceVim#layers#core#statusline#rsep() +function! SpaceVim#layers#core#statusline#rsep() abort return get(s:separators, g:spacevim_statusline_separator, s:separators['arrow']) endfunction @@ -656,12 +656,12 @@ function! SpaceVim#layers#core#statusline#jump(i) abort endif endfunction -function! SpaceVim#layers#core#statusline#mode(mode) +function! SpaceVim#layers#core#statusline#mode(mode) abort let t = s:colors_template let iedit_mode = get(w:, 'spacevim_iedit_mode', '') let mode = get(w:, 'spacevim_statusline_mode', '') if mode != a:mode - if a:mode == 'n' + if a:mode ==# 'n' if !empty(iedit_mode) if iedit_mode ==# 'n' exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[8][3] . ' ctermfg=' . t[8][2] . ' guibg=' . t[8][1] . ' guifg=' . t[8][0] @@ -673,11 +673,11 @@ function! SpaceVim#layers#core#statusline#mode(mode) else exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] endif - elseif a:mode == 'i' + elseif a:mode ==# 'i' exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] - elseif a:mode == 'R' + elseif a:mode ==# 'R' exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[6][3] . ' ctermfg=' . t[6][2] . ' guibg=' . t[6][1] . ' guifg=' . t[6][0] - elseif a:mode == 'v' || a:mode == 'V' || a:mode == '' || a:mode == 's' || a:mode == 'S' || a:mode == '' + elseif a:mode ==# 'v' || a:mode ==# 'V' || a:mode ==# '' || a:mode ==# 's' || a:mode ==# 'S' || a:mode ==# '' exe 'hi! SpaceVim_statusline_a gui=bold cterm=bold ctermbg=' . t[5][3] . ' ctermfg=' . t[5][2] . ' guibg=' . t[5][1] . ' guifg=' . t[5][0] endif call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b') @@ -686,9 +686,9 @@ function! SpaceVim#layers#core#statusline#mode(mode) return '' endfunction -function! SpaceVim#layers#core#statusline#mode_text(mode) +function! SpaceVim#layers#core#statusline#mode_text(mode) abort let iedit_mode = get(w:, 'spacevim_iedit_mode', '') - if a:mode == 'n' + if a:mode ==# 'n' if !empty(iedit_mode) if iedit_mode ==# 'n' return 'IEDIT-NORMAL' @@ -697,9 +697,9 @@ function! SpaceVim#layers#core#statusline#mode_text(mode) endif endif return 'NORMAL' - elseif a:mode == 'i' + elseif a:mode ==# 'i' return 'INSERT' - elseif a:mode == 'R' + elseif a:mode ==# 'R' return 'REPLACE' elseif a:mode ==# 'v' return 'VISUAL' @@ -711,19 +711,19 @@ function! SpaceVim#layers#core#statusline#mode_text(mode) return 'COMMAND' elseif a:mode ==# 't' return 'TERMINAL' - elseif a:mode == 'v' || a:mode == 'V' || a:mode == '^V' || a:mode == 's' || a:mode == 'S' || a:mode == '^S' + elseif a:mode ==# 'v' || a:mode ==# 'V' || a:mode ==# '^V' || a:mode ==# 's' || a:mode ==# 'S' || a:mode ==# '^S' return 'VISUAL' endif return ' ' endfunction -function! SpaceVim#layers#core#statusline#denite_mode() +function! SpaceVim#layers#core#statusline#denite_mode() abort let t = s:colors_template let dmode = split(denite#get_status_mode())[1] if get(w:, 'spacevim_statusline_mode', '') != dmode - if dmode == 'NORMAL' + if dmode ==# 'NORMAL' exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - elseif dmode == 'INSERT' + elseif dmode ==# 'INSERT' exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] endif call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') @@ -732,13 +732,13 @@ function! SpaceVim#layers#core#statusline#denite_mode() return dmode endfunction -function! SpaceVim#layers#core#statusline#unite_mode() +function! SpaceVim#layers#core#statusline#unite_mode() abort let t = s:colors_template let dmode = mode() if get(w:, 'spacevim_statusline_mode', '') != dmode - if dmode == 'n' + if dmode ==# 'n' exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] - elseif dmode == 'i' + elseif dmode ==# 'i' exe 'hi! SpaceVim_statusline_a_bold cterm=bold gui=bold ctermbg=' . t[4][3] . ' ctermfg=' . t[4][2] . ' guibg=' . t[4][1] . ' guifg=' . t[4][0] endif call s:HI.hi_separator('SpaceVim_statusline_a_bold', 'SpaceVim_statusline_b') @@ -747,7 +747,7 @@ function! SpaceVim#layers#core#statusline#unite_mode() return '' endfunction -function! SpaceVim#layers#core#statusline#register_sections(name, func) +function! SpaceVim#layers#core#statusline#register_sections(name, func) abort if has_key(s:registed_sections, a:name) call SpaceVim#logger#info('statusline build-in section ' . a:name . ' has been changed!') diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 3befa68af..844411f94 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -395,11 +395,11 @@ function! s:set_justification_to(align) abort endfor if a:align ==# 'left' - execute l:startlinenr . "," . l:endlinenr . ":left\" + execute l:startlinenr . ',' . l:endlinenr . ":left\" elseif a:align ==# 'center' - execute l:startlinenr . "," . l:endlinenr . ":center " . l:maxlength . "\" + execute l:startlinenr . ',' . l:endlinenr . ':center ' . l:maxlength . "\" elseif a:align ==# 'right' - execute l:startlinenr . "," . l:endlinenr . ":right " . l:maxlength . "\" + execute l:startlinenr . ',' . l:endlinenr . ':right ' . l:maxlength . "\" endif unlet l:startlinenr diff --git a/autoload/SpaceVim/layers/fzf.vim b/autoload/SpaceVim/layers/fzf.vim index eb1064441..ba8e29354 100644 --- a/autoload/SpaceVim/layers/fzf.vim +++ b/autoload/SpaceVim/layers/fzf.vim @@ -151,7 +151,7 @@ endfunction command! FzfFiles call files() function! s:files() abort let s:source = 'files' - call fzf#run(fzf#wrap("files", {'sink': 'e', 'options': '--reverse', 'down' : '40%'})) + call fzf#run(fzf#wrap('files', {'sink': 'e', 'options': '--reverse', 'down' : '40%'})) endfunction let s:source = '' @@ -171,14 +171,11 @@ function! s:bufopen(e) abort let [linenr, col, file_text] = [list[1], list[2]+1, join(list[3:])] let lines = getbufline(file_text, linenr) let path = file_text - let bufnr = bufnr(file_text) if empty(lines) if stridx(join(split(getline(linenr))), file_text) == 0 let lines = [file_text] let path = bufname('%') - let bufnr = bufnr('%') elseif filereadable(path) - let bufnr = 0 let lines = ['buffer unloaded'] else " Skip. @@ -194,7 +191,7 @@ function! s:jumps() abort function! s:jumplist() abort return split(s:CMP.execute('jumps'), '\n')[1:] endfunction - call fzf#run(fzf#wrap("jumps", { + call fzf#run(fzf#wrap('jumps', { \ 'source': reverse(jumplist()), \ 'sink': function('s:bufopen'), \ 'options': '+m', @@ -213,7 +210,7 @@ function! s:message() abort function! s:messagelist() abort return split(s:CMP.execute('message'), '\n') endfunction - call fzf#run(fzf#wrap("messages", { + call fzf#run(fzf#wrap('messages', { \ 'source': reverse(messagelist()), \ 'sink': function('s:yankmessage'), \ 'options': '+m', @@ -238,7 +235,7 @@ function! s:quickfix() abort function! s:quickfix_list() abort return map(getqflist(), 's:quickfix_to_grep(v:val)') endfunction - call fzf#run(fzf#wrap("quickfix", { + call fzf#run(fzf#wrap('quickfix', { \ 'source': reverse(quickfix_list()), \ 'sink': function('s:open_quickfix_item'), \ 'options': '--reverse', @@ -262,7 +259,7 @@ function! s:location_list() abort function! s:get_location_list() abort return map(getloclist(0), 's:location_list_to_grep(v:val)') endfunction - call fzf#run(fzf#wrap("location_list", { + call fzf#run(fzf#wrap('location_list', { \ 'source': reverse(get_location_list()), \ 'sink': function('s:open_location_item'), \ 'options': '--reverse', @@ -291,6 +288,7 @@ function! s:outline_source(tag_cmds) abort throw 'Save the file first' endif + let lines = [] for cmd in a:tag_cmds let lines = split(system(cmd), "\n") if !v:shell_error @@ -314,7 +312,6 @@ endfunction function! s:outline(...) abort let s:source = 'outline' - let args = copy(a:000) let tag_cmds = [ \ printf('ctags -f - --sort=no --excmd=number --language-force=%s %s 2>/dev/null', &filetype, expand('%:S')), \ printf('ctags -f - --sort=no --excmd=number %s 2>/dev/null', expand('%:S'))] @@ -337,7 +334,7 @@ function! s:register() abort function! s:registers_list() abort return split(s:CMP.execute('registers'), '\n')[1:] endfunction - call fzf#run(fzf#wrap("registers", { + call fzf#run(fzf#wrap('registers', { \ 'source': reverse(registers_list()), \ 'sink': function('s:yankregister'), \ 'options': '+m', @@ -354,7 +351,7 @@ function! s:buffers() abort function! s:buffer_list() abort return split(s:CMP.execute('buffers'), '\n') endfunction - call fzf#run(fzf#wrap("buffers", { + call fzf#run(fzf#wrap('buffers', { \ 'source': reverse(buffer_list()), \ 'sink': function('s:open_buffer'), \ 'options': '+m', @@ -364,7 +361,7 @@ endfunction let s:ansi = {'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36} -function! s:get_color(attr, ...) +function! s:get_color(attr, ...) abort let gui = has('termguicolors') && &termguicolors let fam = gui ? 'gui' : 'cterm' let pat = gui ? '^#[a-f0-9]\+' : '^[0-9]\+$' @@ -376,15 +373,15 @@ function! s:get_color(attr, ...) endfor return '' endfunction -function! s:csi(color, fg) +function! s:csi(color, fg) abort let prefix = a:fg ? '38;' : '48;' - if a:color[0] == '#' + if a:color[0] ==# '#' return prefix.'2;'.join(map([a:color[1:2], a:color[3:4], a:color[5:6]], 'str2nr(v:val, 16)'), ';') endif return prefix.'5;'.a:color endfunction -function! s:ansi(str, group, default, ...) +function! s:ansi(str, group, default, ...) abort let fg = s:get_color('fg', a:group) let bg = s:get_color('bg', a:group) let color = s:csi(empty(fg) ? s:ansi[a:default] : fg, 1) . @@ -392,12 +389,13 @@ function! s:ansi(str, group, default, ...) return printf("\x1b[%s%sm%s\x1b[m", color, a:0 ? ';1' : '', a:str) endfunction for s:color_name in keys(s:ansi) - execute "function! s:".s:color_name."(str, ...)\n" + execute 'function! s:'.s:color_name."(str, ...)\n" \ " return s:ansi(a:str, get(a:, 1, ''), '".s:color_name."')\n" - \ "endfunction" + \ 'endfunction' endfor -function! s:helptag_sink(line) +function! s:helptag_sink(line) abort let [tag, file, path] = split(a:line, "\t")[0:2] + unlet file let rtp = fnamemodify(path, ':p:h:h') if stridx(&rtp, rtp) < 0 execute 'set rtp+='. fnameescape(rtp) @@ -405,7 +403,7 @@ function! s:helptag_sink(line) execute 'help' tag endfunction command! -nargs=? FzfHelpTags call helptags() -function! s:helptags(...) +function! s:helptags(...) abort let query = get(a:000, 0, '') if !executable('grep') || !executable('perl') call SpaceVim#logger#warn('FzfHelpTags command requires grep and perl') @@ -417,9 +415,9 @@ function! s:helptags(...) silent! call delete(s:helptags_script) endif let s:helptags_script = tempname() - call writefile(['/('.(s:SYS.isWindows ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('.s:green('%-40s', 'Label').'\t%s\t%s\n), $2, $3, $1)'], s:helptags_script) + call writefile(['/('.(s:SYS.isWindows ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('. call('s:green', ['%-40s', 'Label']) . '\t%s\t%s\n), $2, $3, $1)'], s:helptags_script) let s:source = 'help' - call fzf#run(fzf#wrap("helptags", { + call fzf#run(fzf#wrap('helptags', { \ 'source': 'grep -H ".*" '.join(map(tags, 'shellescape(v:val)')). \ ' | perl -n '. shellescape(s:helptags_script).' | sort', \ 'sink': function('s:helptag_sink'), diff --git a/autoload/SpaceVim/layers/lang/fsharp.vim b/autoload/SpaceVim/layers/lang/fsharp.vim index 2ed06f55d..d4324585d 100644 --- a/autoload/SpaceVim/layers/lang/fsharp.vim +++ b/autoload/SpaceVim/layers/lang/fsharp.vim @@ -15,7 +15,7 @@ function! SpaceVim#layers#lang#fsharp#plugins() abort endfunction -function! SpaceVim#layers#lang#fsharp#config() +function! SpaceVim#layers#lang#fsharp#config() abort call SpaceVim#plugins#repl#reg('fsharp', ['fsharpi', '--readline-']) call SpaceVim#mapping#space#regesit_lang_mappings('python', function('s:language_specified_mappings')) endfunction diff --git a/autoload/SpaceVim/layers/lang/lisp.vim b/autoload/SpaceVim/layers/lang/lisp.vim index fab8469ab..d86817830 100644 --- a/autoload/SpaceVim/layers/lang/lisp.vim +++ b/autoload/SpaceVim/layers/lang/lisp.vim @@ -117,46 +117,46 @@ function! SpaceVim#layers#lang#lisp#config() abort endfunction -fu! s:lisp() +fu! s:lisp() abort let g:_spacevim_mappings_space.l.c = {'name' : '+Connection Management'} - call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'c'], "call VlimeConnectREPL()", 'Connect to Vlime server', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 's'], "call VlimeSelectCurConnection()", 'Switch Vlime connections', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'd'], "call VlimeCloseCurConnection()", 'Disconnect', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'R'], "call VlimeRenameCurConnection()", 'Rename the current connection', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'c'], 'call VlimeConnectREPL()', 'Connect to Vlime server', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 's'], 'call VlimeSelectCurConnection()', 'Switch Vlime connections', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'd'], 'call VlimeCloseCurConnection()', 'Disconnect', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','c', 'R'], 'call VlimeRenameCurConnection()', 'Rename the current connection', 1) let g:_spacevim_mappings_space.l.r = {'name' : '+Server Management'} - call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'r'], "call VlimeNewServer()", 'Run a new Vlime server and connect to it', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'v'], "call VlimeShowSelectedServer()", 'View the console output of a server', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'R'], "call VlimeRenameSelectedServer()", 'Rename a server', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'r'], 'call VlimeNewServer()', 'Run a new Vlime server and connect to it', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'v'], 'call VlimeShowSelectedServer()', 'View the console output of a server', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'R'], 'call VlimeRenameSelectedServer()', 'Rename a server', 1) let g:_spacevim_mappings_space.l.s = {'name' : '+Sending Stuff To The REPL'} - call SpaceVim#mapping#space#langSPC('nmap', ['l','s','s'], "call VlimeSendToREPL(vlime#ui#CurExprOrAtom())", + call SpaceVim#mapping#space#langSPC('nmap', ['l','s','s'], 'call VlimeSendToREPL(vlime#ui#CurExprOrAtom())', \ 'Send s-expr or atom under the cursor to REPL', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','s','e'], "call VlimeSendToREPL(vlime#ui#CurExpr())", + call SpaceVim#mapping#space#langSPC('nmap', ['l','s','e'], 'call VlimeSendToREPL(vlime#ui#CurExpr())', \ 'Send s-expr under the cursor to REPL', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','s','t'], "VlimeSendToREPL(vlime#ui#CurTopExpr())", + call SpaceVim#mapping#space#langSPC('nmap', ['l','s','t'], 'VlimeSendToREPL(vlime#ui#CurTopExpr())', \ 'Send to-level s-expr under the cursor to REPL', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','s','a'], "call VlimeSendToREPL(vlime#ui#CurAtom())", + call SpaceVim#mapping#space#langSPC('nmap', ['l','s','a'], 'call VlimeSendToREPL(vlime#ui#CurAtom())', \ 'Send atom under the cursor to REPL', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','s','i'], "call VlimeSendToREPL()", + call SpaceVim#mapping#space#langSPC('nmap', ['l','s','i'], 'call VlimeSendToREPL()', \ 'Open vlime input buffer for REPL', 1) - call SpaceVim#mapping#space#langSPC('vmap', ['l','s','v'], "call VlimeSendToREPL(vlime#ui#CurSelection())", + call SpaceVim#mapping#space#langSPC('vmap', ['l','s','v'], 'call VlimeSendToREPL(vlime#ui#CurSelection())', \ 'Send the current selection to the REPL', 1) let g:_spacevim_mappings_space.l.m = {'name' : '+Expanding Macros'} - call SpaceVim#mapping#space#langSPC('nmap', ['l','m','l'], "call VlimeExpandMacro(vlime#ui#CurExpr(), v:false)", + call SpaceVim#mapping#space#langSPC('nmap', ['l','m','l'], 'call VlimeExpandMacro(vlime#ui#CurExpr(), v:false)', \ 'Expand the macro under the cursor', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','m','a'], "call VlimeExpandMacro(vlime#ui#CurExpr(), v:true)", + call SpaceVim#mapping#space#langSPC('nmap', ['l','m','a'], 'call VlimeExpandMacro(vlime#ui#CurExpr(), v:true)', \ 'Expand the macro under the cursor and all nested macros', 1) let g:_spacevim_mappings_space.l.o = {'name' : '+Compiling'} - call SpaceVim#mapping#space#langSPC('nmap', ['l','o','e'], "call VlimeCompile(vlime#ui#CurExpr(v:true))", + call SpaceVim#mapping#space#langSPC('nmap', ['l','o','e'], 'call VlimeCompile(vlime#ui#CurExpr(v:true))', \ 'Compile the form under the cursor', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','o','t'], "call VlimeCompile(vlime#ui#CurTopExpr(v:true))", + call SpaceVim#mapping#space#langSPC('nmap', ['l','o','t'], 'call VlimeCompile(vlime#ui#CurTopExpr(v:true))', \ 'Compile the top-level form under the cursor', 1) call SpaceVim#mapping#space#langSPC('nmap', ['l','o','f'], "call VlimeCompileFile(expand('%:p'))", \ 'Compile the current file', 1) - call SpaceVim#mapping#space#langSPC('vmap', ['l','o','v'], "call VlimeCompile(vlime#ui#CurSelection(v:true))", + call SpaceVim#mapping#space#langSPC('vmap', ['l','o','v'], 'call VlimeCompile(vlime#ui#CurSelection(v:true))', \ 'Compile the current selection', 1) let g:_spacevim_mappings_space.l.x = {'name' : '+Cross references'} @@ -220,23 +220,23 @@ fu! s:lisp() \ 'Prompt for the expression to inspect', 1) endf -fu! s:vlime_sldb() +fu! s:vlime_sldb() abort endf -fu! s:vlime_repl() +fu! s:vlime_repl() abort endf -fu! s:vlime_inspector() +fu! s:vlime_inspector() abort endf -fu! s:vlime_xref() +fu! s:vlime_xref() abort endf -fu! s:vlime_notes() +fu! s:vlime_notes() abort endf -fu! s:vlime_threads() +fu! s:vlime_threads() abort endf -fu! s:vlime_server() +fu! s:vlime_server() abort endf -fu! s:vlime_preview() +fu! s:vlime_preview() abort endf -fu! s:vlime_arglist() +fu! s:vlime_arglist() abort endf -fu! s:vlime_input() +fu! s:vlime_input() abort endf diff --git a/autoload/SpaceVim/layers/lang/markdown.vim b/autoload/SpaceVim/layers/lang/markdown.vim index 9b34a787f..57ae6b281 100644 --- a/autoload/SpaceVim/layers/lang/markdown.vim +++ b/autoload/SpaceVim/layers/lang/markdown.vim @@ -38,8 +38,8 @@ function! SpaceVim#layers#lang#markdown#config() abort let g:markdown_enable_insert_mode_leader_mappings = 0 let g:markdown_enable_spell_checking = 0 let g:markdown_quote_syntax_filetypes = { - \ "vim" : { - \ "start" : "\\%(vim\\|viml\\)", + \ 'vim' : { + \ 'start' : "\\%(vim\\|viml\\)", \}, \} let remarkrc = s:generate_remarkrc() @@ -71,8 +71,8 @@ function! s:mappings() abort let g:_spacevim_mappings_space = {} endif let g:_spacevim_mappings_space.l = {'name' : '+Language Specified'} - call SpaceVim#mapping#space#langSPC('nmap', ['l','ft'], "Tabularize /|", 'Format table under cursor', 1) - call SpaceVim#mapping#space#langSPC('nmap', ['l','p'], "MarkdownPreview", 'Real-time markdown preview', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','ft'], 'Tabularize /|', 'Format table under cursor', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','p'], 'MarkdownPreview', 'Real-time markdown preview', 1) call SpaceVim#mapping#space#langSPC('nmap', ['l','k'], '(markdown-insert-link)', 'add link url', 0, 1) endfunction diff --git a/autoload/SpaceVim/layers/lang/sh.vim b/autoload/SpaceVim/layers/lang/sh.vim index 6cd1521c4..efc178819 100644 --- a/autoload/SpaceVim/layers/lang/sh.vim +++ b/autoload/SpaceVim/layers/lang/sh.vim @@ -17,7 +17,7 @@ function! SpaceVim#layers#lang#sh#plugins() abort return l:plugins endfunction -function! SpaceVim#layers#lang#sh#config() +function! SpaceVim#layers#lang#sh#config() abort " chrisbra/vim-zsh {{{ let g:zsh_fold_enable = 1 " }}} diff --git a/autoload/SpaceVim/layers/lang/vim.vim b/autoload/SpaceVim/layers/lang/vim.vim index ce3b226d8..7cc6682e5 100644 --- a/autoload/SpaceVim/layers/lang/vim.vim +++ b/autoload/SpaceVim/layers/lang/vim.vim @@ -19,12 +19,12 @@ function! SpaceVim#layers#lang#vim#plugins() abort call add(plugins,['tweekmonster/exception.vim', {'merged' : 0}]) call add(plugins,['mhinz/vim-lookup', {'merged' : 0}]) call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}]) - if g:spacevim_autocomplete_method == 'asyncomplete' + if g:spacevim_autocomplete_method ==# 'asyncomplete' call add(plugins, ['prabirshrestha/asyncomplete-necovim.vim', { \ 'loadconf' : 1, \ 'merged' : 0, \ }]) - elseif g:spacevim_autocomplete_method == 'coc' + elseif g:spacevim_autocomplete_method ==# 'coc' call add(plugins, ['neoclide/coc-neco', {'merged' : 0}]) endif call add(plugins,['tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}]) diff --git a/autoload/SpaceVim/layers/lsp.vim b/autoload/SpaceVim/layers/lsp.vim index 859708b5d..6cdeb8016 100644 --- a/autoload/SpaceVim/layers/lsp.vim +++ b/autoload/SpaceVim/layers/lsp.vim @@ -9,7 +9,7 @@ function! SpaceVim#layers#lsp#plugins() abort let plugins = [] - if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_method") ==# 'coc' + if SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc' " nop elseif has('nvim') call add(plugins, ['autozimu/LanguageClient-neovim', diff --git a/autoload/SpaceVim/layers/mail.vim b/autoload/SpaceVim/layers/mail.vim index be3155d0b..6682f8d13 100644 --- a/autoload/SpaceVim/layers/mail.vim +++ b/autoload/SpaceVim/layers/mail.vim @@ -13,6 +13,6 @@ function! SpaceVim#layers#mail#plugins() abort endfunction -function! SpaceVim#layers#mail#config() +function! SpaceVim#layers#mail#config() abort call SpaceVim#mapping#space#def('nnoremap', ['a', 'm'], 'call mail#client#open()', 'Start mail client', 1) endfunction diff --git a/autoload/SpaceVim/layers/shell.vim b/autoload/SpaceVim/layers/shell.vim index bb2f66b0a..9492e3de6 100644 --- a/autoload/SpaceVim/layers/shell.vim +++ b/autoload/SpaceVim/layers/shell.vim @@ -175,7 +175,7 @@ function! s:open_default_shell(open_with_file_cwd) abort endif for open_terminal in s:open_terminals_buffers if bufexists(open_terminal) - if getbufvar(open_terminal, "_spacevim_shell_cwd") ==# l:path + if getbufvar(open_terminal, '_spacevim_shell_cwd') ==# l:path exe 'silent b' . open_terminal " clear the message if has('nvim') @@ -213,8 +213,8 @@ function! s:open_default_shell(open_with_file_cwd) abort stopinsert startinsert endif - let l:term_buf_nr = bufnr('%') - call extend(s:shell_cached_br, {getcwd() : l:term_buf_nr}) + let s:term_buf_nr = bufnr('%') + call extend(s:shell_cached_br, {getcwd() : s:term_buf_nr}) else " handle vim terminal if s:SYSTEM.isWindows @@ -222,9 +222,9 @@ function! s:open_default_shell(open_with_file_cwd) abort else let shell = empty($SHELL) ? 'bash' : $SHELL endif - let l:term_buf_nr = term_start(shell, {'cwd': l:path, 'curwin' : 1, 'term_finish' : 'close'}) + let s:term_buf_nr = term_start(shell, {'cwd': l:path, 'curwin' : 1, 'term_finish' : 'close'}) endif - call add(s:open_terminals_buffers, l:term_buf_nr) + call add(s:open_terminals_buffers, s:term_buf_nr) let b:_spacevim_shell = shell let b:_spacevim_shell_cwd = l:path @@ -247,7 +247,7 @@ function! s:open_default_shell(open_with_file_cwd) abort endif endfunction -function! SpaceVim#layers#shell#close_terminal() +function! SpaceVim#layers#shell#close_terminal() abort for terminal_bufnr in s:open_terminals_buffers if bufexists(terminal_bufnr) exe 'silent bd!' . terminal_bufnr diff --git a/autoload/SpaceVim/layers/tags.vim b/autoload/SpaceVim/layers/tags.vim index 29ca1a9c9..068366a81 100644 --- a/autoload/SpaceVim/layers/tags.vim +++ b/autoload/SpaceVim/layers/tags.vim @@ -49,7 +49,7 @@ endfunction function! MyTagfuncBack() abort if exists('s:MyTagfunc_flag')&&s:MyTagfunc_flag - exe "normal! `H" + exe 'normal! `H' let s:MyTagfunc_flag =0 endif endfunction diff --git a/autoload/SpaceVim/lsp.vim b/autoload/SpaceVim/lsp.vim index 6b647a38e..509860bbc 100644 --- a/autoload/SpaceVim/lsp.vim +++ b/autoload/SpaceVim/lsp.vim @@ -9,7 +9,7 @@ scriptencoding utf-8 -if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_method") ==# 'coc' +if SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc' " use coc.nvim let s:coc_language_servers = {} let s:coc_language_servers_key_id_map = {} @@ -30,7 +30,7 @@ if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_me " actually the same. " We need to keep an id to distinguish among conflicting keys. - if stridx(a:cmds[0], ".") >= 0 + if stridx(a:cmds[0], '.') >= 0 let l:key = split(a:cmds[0], "\\.")[-1] else let l:key = a:cmds[0] @@ -52,23 +52,26 @@ if SpaceVim#layers#isLoaded("autocomplete") && get(g:, "spacevim_autocomplete_me let s:coc_language_servers_key_id_map[l:key] = s:coc_language_servers_key_id_map[l:key] + 1 - autocmd! User CocNvimInit :call coc#config("languageserver", s:coc_language_servers) + augroup spacevim_lsp_layer + autocmd! + autocmd! User CocNvimInit :call coc#config("languageserver", s:coc_language_servers) + augroup END endfunction function! SpaceVim#lsp#show_doc() abort - call CocActionAsync("doHover") + call CocActionAsync('doHover') endfunction function! SpaceVim#lsp#go_to_def() abort - call CocActionAsync("jumpDefinition") + call CocActionAsync('jumpDefinition') endfunction function! SpaceVim#lsp#rename() abort - call CocActionAsync("rename") + call CocActionAsync('rename') endfunction function! SpaceVim#lsp#references() abort - call CocActionAsync("jumpReferences") + call CocActionAsync('jumpReferences') endfunction elseif has('nvim') " use LanguageClient-neovim @@ -94,11 +97,11 @@ elseif has('nvim') else " use vim-lsp function! SpaceVim#lsp#reg_server(ft, cmds) abort - exe "au User lsp_setup call lsp#register_server({" + exe 'au User lsp_setup call lsp#register_server({' \ . "'name': 'LSP'," - \ . "'cmd': {server_info -> " . string(a:cmds) . "}," + \ . "'cmd': {server_info -> " . string(a:cmds) . '},' \ . "'whitelist': ['" . a:ft . "' ]," - \ . "})" + \ . '})' exe 'autocmd FileType ' . a:ft . ' setlocal omnifunc=lsp#complete' endfunction diff --git a/autoload/SpaceVim/mapping.vim b/autoload/SpaceVim/mapping.vim index f4cc36060..9b07fedae 100644 --- a/autoload/SpaceVim/mapping.vim +++ b/autoload/SpaceVim/mapping.vim @@ -175,7 +175,7 @@ function! SpaceVim#mapping#close_current_buffer() abort endif endif - if &buftype == 'terminal' + if &buftype ==# 'terminal' exe 'bd!' return endif @@ -252,7 +252,7 @@ function! SpaceVim#mapping#menu(desc, key, cmd) abort \ a:cmd]) endfunction -function! SpaceVim#mapping#clear_saved_buffers() +function! SpaceVim#mapping#clear_saved_buffers() abort call s:BUFFER.filter_do( \ { \ 'expr' : [ diff --git a/autoload/SpaceVim/mapping/g.vim b/autoload/SpaceVim/mapping/g.vim index 285f2b0ea..897f1cb7f 100644 --- a/autoload/SpaceVim/mapping/g.vim +++ b/autoload/SpaceVim/mapping/g.vim @@ -17,7 +17,7 @@ function! SpaceVim#mapping#g#init() abort let g:_spacevim_mappings_g["'"] = ['call feedkeys("g' . "'" . '", "n")', 'jump to mark'] nnoremap g' g' - let g:_spacevim_mappings_g["`"] = ['call feedkeys("g' . "`" . '", "n")', 'jump to mark'] + let g:_spacevim_mappings_g['`'] = ['call feedkeys("g' . '`' . '", "n")', 'jump to mark'] nnoremap g` g` let g:_spacevim_mappings_g['+'] = ['call feedkeys("g+", "n")', 'newer text state'] diff --git a/autoload/SpaceVim/mapping/guide.vim b/autoload/SpaceVim/mapping/guide.vim index 48ce8253b..c48fea0d5 100644 --- a/autoload/SpaceVim/mapping/guide.vim +++ b/autoload/SpaceVim/mapping/guide.vim @@ -14,11 +14,11 @@ scriptencoding utf-8 let s:CMP = SpaceVim#api#import('vim#compatible') -function! SpaceVim#mapping#guide#has_configuration() "{{{ +function! SpaceVim#mapping#guide#has_configuration() abort "{{{ return exists('s:desc_lookup') endfunction "}}} -function! SpaceVim#mapping#guide#register_prefix_descriptions(key, dictname) " {{{ +function! SpaceVim#mapping#guide#register_prefix_descriptions(key, dictname) abort " {{{ let key = a:key ==? '' ? ' ' : a:key if !exists('s:desc_lookup') call s:create_cache() @@ -31,11 +31,11 @@ function! SpaceVim#mapping#guide#register_prefix_descriptions(key, dictname) " { let s:desc_lookup[key] = a:dictname endif endfunction "}}} -function! s:create_cache() " {{{ +function! s:create_cache() abort " {{{ let s:desc_lookup = {} let s:cached_dicts = {} endfunction " }}} -function! s:create_target_dict(key) " {{{ +function! s:create_target_dict(key) abort " {{{ if has_key(s:desc_lookup, 'top') let toplevel = deepcopy({s:desc_lookup['top']}) let tardict = s:toplevel ? toplevel : get(toplevel, a:key, {}) @@ -50,7 +50,7 @@ function! s:create_target_dict(key) " {{{ endif return tardict endfunction " }}} -function! s:merge(dict_t, dict_o) " {{{ +function! s:merge(dict_t, dict_o) abort " {{{ let target = a:dict_t let other = a:dict_o for k in keys(target) @@ -65,50 +65,50 @@ function! s:merge(dict_t, dict_o) " {{{ let target[k.'m'] = target[k] endif let target[k] = other[k] - if has_key(other, k."m") && type(other[k."m"]) == type({}) - call s:merge(target[k."m"], other[k."m"]) + if has_key(other, k.'m') && type(other[k.'m']) == type({}) + call s:merge(target[k.'m'], other[k.'m']) endif endif endif endfor - call extend(target, other, "keep") + call extend(target, other, 'keep') endfunction " }}} " @vimlint(EVL103, 1, a:dictname) -function! SpaceVim#mapping#guide#populate_dictionary(key, dictname) " {{{ +function! SpaceVim#mapping#guide#populate_dictionary(key, dictname) abort " {{{ call s:start_parser(a:key, s:cached_dicts[a:key]) endfunction " }}} " @vimlint(EVL103, 0, a:dictname) -function! SpaceVim#mapping#guide#parse_mappings() " {{{ +function! SpaceVim#mapping#guide#parse_mappings() abort " {{{ for [k, v] in items(s:cached_dicts) call s:start_parser(k, v) endfor endfunction " }}} -function! s:start_parser(key, dict) " {{{ +function! s:start_parser(key, dict) abort " {{{ if a:key ==# '[KEYs]' return endif - let key = a:key ==? ' ' ? "" : a:key + let key = a:key ==? ' ' ? '' : a:key 0verbose let readmap = s:CMP.execute('map ' . key, 'silent') let lines = split(readmap, "\n") - let visual = s:vis == "gv" ? 1 : 0 + let visual = s:vis ==# 'gv' ? 1 : 0 for line in lines let mapd = maparg(split(line[3:])[0], line[0], 0, 1) - if mapd.lhs == '\\' + if mapd.lhs ==# '\\' echom string(mapd) - let mapd.feedkeyargs = "" + let mapd.feedkeyargs = '' elseif mapd.noremap == 1 - let mapd.feedkeyargs = "nt" + let mapd.feedkeyargs = 'nt' else - let mapd.feedkeyargs = "mt" + let mapd.feedkeyargs = 'mt' endif - if mapd.lhs =~ '.*' || mapd.lhs =~ '.*' + if mapd.lhs =~# '.*' || mapd.lhs =~# '.*' continue endif let mapd.display = s:format_displaystring(mapd.rhs) @@ -116,17 +116,17 @@ function! s:start_parser(key, dict) " {{{ let mapd.lhs = substitute(mapd.lhs, '', ' ', 'g') let mapd.lhs = substitute(mapd.lhs, '', '', 'g') let mapd.rhs = substitute(mapd.rhs, '', ''.mapd['sid'].'_', 'g') - if mapd.lhs != '' && mapd.display !~# 'LeaderGuide.*' + if mapd.lhs !=# '' && mapd.display !~# 'LeaderGuide.*' let mapd.lhs = s:string_to_keys(mapd.lhs) - if (visual && match(mapd.mode, "[vx ]") >= 0) || - \ (!visual && match(mapd.mode, "[vx]") == -1) + if (visual && match(mapd.mode, '[vx ]') >= 0) || + \ (!visual && match(mapd.mode, '[vx]') == -1) call s:add_map_to_dict(mapd, 0, a:dict) endif endif endfor endfunction " }}} -function! s:add_map_to_dict(map, level, dict) " {{{ +function! s:add_map_to_dict(map, level, dict) abort " {{{ if len(a:map.lhs) > a:level+1 let curkey = a:map.lhs[a:level] let nlevel = a:level+1 @@ -142,7 +142,7 @@ function! s:add_map_to_dict(map, level, dict) " {{{ endif elseif type(a:dict[curkey]) == type([]) && g:leaderGuide_flatten == 0 let cmd = s:escape_mappings(a:map) - let curkey = curkey."m" + let curkey = curkey.'m' if !has_key(a:dict, curkey) let a:dict[curkey] = { 'name' : g:leaderGuide_default_group_name } endif @@ -166,7 +166,7 @@ function! s:add_map_to_dict(map, level, dict) " {{{ endif endfunction " }}} " @vimlint(EVL111, 1, Fun) -function! s:format_displaystring(map) " {{{ +function! s:format_displaystring(map) abort " {{{ let g:leaderGuide#displayname = a:map for Fun in g:leaderGuide_displayfunc call Fun() @@ -176,7 +176,7 @@ function! s:format_displaystring(map) " {{{ return display endfunction " }}} " @vimlint(EVL111, 0, Fun) -function! s:flattenmap(dict, str) " {{{ +function! s:flattenmap(dict, str) abort " {{{ let ret = {} for kv in keys(a:dict) if type(a:dict[kv]) == type([]) @@ -191,14 +191,14 @@ function! s:flattenmap(dict, str) " {{{ endfunction " }}} -function! s:escape_mappings(mapping) " {{{ +function! s:escape_mappings(mapping) abort " {{{ let rstring = substitute(a:mapping.rhs, '\', '\\\\', 'g') let rstring = substitute(rstring, '<\([^<>]*\)>', '\\<\1>', 'g') let rstring = substitute(rstring, '"', '\\"', 'g') let rstring = 'call feedkeys("'.rstring.'", "'.a:mapping.feedkeyargs.'")' return rstring endfunction " }}} -function! s:string_to_keys(input) " {{{ +function! s:string_to_keys(input) abort " {{{ " Avoid special case: <> let retlist = [] if match(a:input, '<.\+>') != -1 @@ -232,13 +232,13 @@ function! s:string_to_keys(input) " {{{ endif return retlist endfunction " }}} -function! s:escape_keys(inp) " {{{ - let ret = substitute(a:inp, "<", "", "") - return substitute(ret, "|", "", "") +function! s:escape_keys(inp) abort " {{{ + let ret = substitute(a:inp, '<', '', '') + return substitute(ret, '|', '', '') endfunction " }}} -function! s:calc_layout() " {{{ +function! s:calc_layout() abort " {{{ let ret = {} let smap = filter(copy(s:lmap), 'v:key !=# "name"') let ret.n_items = len(smap) @@ -260,7 +260,7 @@ function! s:calc_layout() " {{{ endif return ret endfunction " }}} -function! s:create_string(layout) " {{{ +function! s:create_string(layout) abort " {{{ let l = a:layout let l.capacity = l.n_rows * l.n_cols let overcap = l.capacity - l.n_items @@ -273,7 +273,7 @@ function! s:create_string(layout) " {{{ let smap = sort(filter(keys(s:lmap), 'v:val !=# "name"'),'1') for k in smap let desc = type(s:lmap[k]) == type({}) ? s:lmap[k].name : s:lmap[k][1] - let displaystring = "[". k ."] ".desc + let displaystring = '['. k .'] '.desc let crow = get(rows, row, []) if empty(crow) call add(rows, crow) @@ -301,7 +301,7 @@ function! s:create_string(layout) " {{{ let col += 1 endif endif - silent execute "cnoremap ".substitute(k, "|", "", ""). " " . s:escape_keys(k) ."" + silent execute 'cnoremap '.substitute(k, '|', '', ''). ' ' . s:escape_keys(k) .'' endfor let r = [] let mlen = 0 @@ -330,7 +330,7 @@ function! s:highlight_cursor() abort \ } hi! def link SpaceVimGuideCursor Cursor call s:VIMH.hi(info) - if s:vis == 'gv' + if s:vis ==# 'gv' " [bufnum, lnum, col, off] let begin = getpos("'<") let end = getpos("'>") @@ -358,7 +358,7 @@ function! s:remove_cursor_highlight() abort endfunction " @vimlint(EVL102, 1, l:string) -function! s:start_buffer() " {{{ +function! s:start_buffer() abort " {{{ let s:winv = winsaveview() let s:winnr = winnr() let s:winres = winrestcmd() @@ -379,14 +379,14 @@ function! s:start_buffer() " {{{ silent 1put!=string normal! gg"_dd setlocal nomodifiable - if empty(maparg("", "c", 0, 1)) + if empty(maparg('', 'c', 0, 1)) execute 'cnoremap ' endif call s:wait_for_input() endfunction " }}} " @vimlint(EVL102, 0, l:string) -function! s:handle_input(input) " {{{ +function! s:handle_input(input) abort " {{{ call s:winclose() if type(a:input) ==? type({}) let s:lmap = a:input @@ -403,20 +403,20 @@ function! s:handle_input(input) " {{{ endtry endif endfunction " }}} -function! s:wait_for_input() " {{{ +function! s:wait_for_input() abort " {{{ redraw! - let inp = input("") + let inp = input('') if inp ==? '' let s:prefix_key_inp = '' call s:winclose() doautocmd WinEnter - elseif match(inp, "^paging_help") == 0 + elseif match(inp, '^paging_help') == 0 let s:guide_help_mode = 1 call s:updateStatusline() redraw! call s:submode_mappings() else - if inp == ' ' + if inp ==# ' ' let inp = '[SPC]' endif let fsel = get(s:lmap, inp) @@ -430,7 +430,7 @@ function! s:wait_for_input() " {{{ endif endif endfunction " }}} -function! s:winopen() " {{{ +function! s:winopen() abort " {{{ if !exists('s:bufnr') let s:bufnr = -1 endif @@ -450,7 +450,10 @@ function! s:winopen() " {{{ let splitcmd = g:leaderGuide_vertical ? ' 1vnew' : ' 1new' noautocmd execute pos.splitcmd let s:bufnr = bufnr('%') - autocmd WinLeave call s:winclose() + augroup guide_autocmd + autocmd! + autocmd WinLeave call s:winclose() + augroup END endif let s:gwin = winnr() setlocal filetype=leaderGuide @@ -497,7 +500,7 @@ function! s:toggle_hide_cursor() abort endfunction -function! s:winclose() " {{{ +function! s:winclose() abort " {{{ call s:toggle_hide_cursor() noautocmd execute s:gwin.'wincmd w' if s:gwin == winnr() @@ -510,27 +513,27 @@ function! s:winclose() " {{{ endif call s:remove_cursor_highlight() endfunction " }}} -function! s:page_down() " {{{ - call feedkeys("\", "n") - call feedkeys("\", "x") +function! s:page_down() abort " {{{ + call feedkeys("\", 'n') + call feedkeys("\", 'x') redraw! call s:wait_for_input() endfunction " }}} -function! s:page_undo() " {{{ +function! s:page_undo() abort " {{{ call s:winclose() let s:guide_group = {} let s:prefix_key_inp = '' let s:lmap = s:lmap_undo call s:start_buffer() endfunction " }}} -function! s:page_up() " {{{ - call feedkeys("\", "n") - call feedkeys("\", "x") +function! s:page_up() abort " {{{ + call feedkeys("\", 'n') + call feedkeys("\", 'x') redraw! call s:wait_for_input() endfunction " }}} -function! s:handle_submode_mapping(cmd) " {{{ +function! s:handle_submode_mapping(cmd) abort " {{{ let s:guide_help_mode = 0 call s:updateStatusline() if a:cmd ==? 'page_down' @@ -542,15 +545,15 @@ function! s:handle_submode_mapping(cmd) " {{{ elseif a:cmd ==? 'win_close' call s:winclose() else - call feedkeys("\", "n") + call feedkeys("\", 'n') redraw! call s:wait_for_input() endif endfunction " }}} -function! s:submode_mappings() " {{{ +function! s:submode_mappings() abort " {{{ let maplist = [] for key in items(g:leaderGuide_submode_mappings) - let map = maparg(key[0], "c", 0, 1) + let map = maparg(key[0], 'c', 0, 1) if !empty(map) call add(maplist, map) endif @@ -562,7 +565,7 @@ function! s:submode_mappings() " {{{ endfor silent call s:handle_submode_mapping(inp) endfunction " }}} -function! s:mapmaparg(maparg) " {{{ +function! s:mapmaparg(maparg) abort " {{{ let noremap = a:maparg.noremap ? 'noremap' : 'map' let buffer = a:maparg.buffer ? ' ' : '' let silent = a:maparg.silent ? ' ' : '' @@ -572,7 +575,7 @@ function! s:mapmaparg(maparg) " {{{ execute st endfunction " }}} -function! s:get_register() "{{{ +function! s:get_register() abort "{{{ if match(&clipboard, 'unnamedplus') >= 0 let clip = '+' elseif match(&clipboard, 'unnamed') >= 0 @@ -582,8 +585,8 @@ function! s:get_register() "{{{ endif return clip endfunction "}}} -function! SpaceVim#mapping#guide#start_by_prefix(vis, key) " {{{ - if a:key == ' ' && exists('b:spacevim_lang_specified_mappings') +function! SpaceVim#mapping#guide#start_by_prefix(vis, key) abort " {{{ + if a:key ==# ' ' && exists('b:spacevim_lang_specified_mappings') let g:_spacevim_mappings_space.l = b:spacevim_lang_specified_mappings endif let s:guide_help_mode = 0 @@ -615,20 +618,20 @@ function! SpaceVim#mapping#guide#start_by_prefix(vis, key) " {{{ call s:start_buffer() endfunction " }}} -function! SpaceVim#mapping#guide#start(vis, dict) " {{{ +function! SpaceVim#mapping#guide#start(vis, dict) abort " {{{ let s:vis = a:vis ? 'gv' : 0 let s:lmap = a:dict call s:start_buffer() endfunction " }}} -if !exists("g:leaderGuide_displayfunc") - function! s:leaderGuide_display() +if !exists('g:leaderGuide_displayfunc') + function! s:leaderGuide_display() abort let g:leaderGuide#displayname = substitute(g:leaderGuide#displayname, '\c$', '', '') endfunction - let g:leaderGuide_displayfunc = [function("s:leaderGuide_display")] + let g:leaderGuide_displayfunc = [function('s:leaderGuide_display')] endif -if get(g:, 'mapleader', '\') == ' ' +if get(g:, 'mapleader', '\') ==# ' ' call SpaceVim#mapping#guide#register_prefix_descriptions(' ', \ 'g:_spacevim_mappings') else diff --git a/autoload/SpaceVim/mapping/guide/theme/jellybeans.vim b/autoload/SpaceVim/mapping/guide/theme/jellybeans.vim index 9691d5b1f..278cb71aa 100644 --- a/autoload/SpaceVim/mapping/guide/theme/jellybeans.vim +++ b/autoload/SpaceVim/mapping/guide/theme/jellybeans.vim @@ -6,44 +6,44 @@ " License: GPLv3 "============================================================================= " Color palette -let s:gui00 = "#151515" -let s:gui01 = "#262626" -let s:gui02 = "#4f5b66" -let s:gui03 = "#65737e" -let s:gui04 = "#a7adba" -let s:gui05 = "#c0c5ce" -let s:gui06 = "#cdd3de" -let s:gui07 = "#d8dee9" -let s:gui08 = "#870000" -let s:gui09 = "#f99157" -let s:gui0A = "#fac863" -let s:gui0B = "#437019" -let s:gui0C = "#5fb3b3" -let s:gui0D = "#0d61ac" -let s:gui0E = "#c594c5" -let s:gui0F = "#ab7967" +let s:gui00 = '#151515' +let s:gui01 = '#262626' +let s:gui02 = '#4f5b66' +let s:gui03 = '#65737e' +let s:gui04 = '#a7adba' +let s:gui05 = '#c0c5ce' +let s:gui06 = '#cdd3de' +let s:gui07 = '#d8dee9' +let s:gui08 = '#870000' +let s:gui09 = '#f99157' +let s:gui0A = '#fac863' +let s:gui0B = '#437019' +let s:gui0C = '#5fb3b3' +let s:gui0D = '#0d61ac' +let s:gui0E = '#c594c5' +let s:gui0F = '#ab7967' -let s:cterm00 = "233" -let s:cterm01 = "235" -let s:cterm02 = "59" -let s:cterm03 = "66" -let s:cterm04 = "145" -let s:cterm05 = "152" -let s:cterm06 = "188" -let s:cterm07 = "189" -let s:cterm08 = "88" -let s:cterm09 = "209" -let s:cterm0A = "221" -let s:cterm0B = "22" -let s:cterm0C = "73" -let s:cterm0D = "25" -let s:cterm0E = "176" -let s:cterm0F = "137" +let s:cterm00 = '233' +let s:cterm01 = '235' +let s:cterm02 = '59' +let s:cterm03 = '66' +let s:cterm04 = '145' +let s:cterm05 = '152' +let s:cterm06 = '188' +let s:cterm07 = '189' +let s:cterm08 = '88' +let s:cterm09 = '209' +let s:cterm0A = '221' +let s:cterm0B = '22' +let s:cterm0C = '73' +let s:cterm0D = '25' +let s:cterm0E = '176' +let s:cterm0F = '137' -let s:guiWhite = "#ffffff" -let s:guiGray = "#666666" -let s:ctermWhite = "231" -let s:ctermGray = "243" +let s:guiWhite = '#ffffff' +let s:guiGray = '#666666' +let s:ctermWhite = '231' +let s:ctermGray = '243' function! SpaceVim#mapping#guide#theme#jellybeans#palette() abort diff --git a/autoload/SpaceVim/mapping/guide/theme/solarized.vim b/autoload/SpaceVim/mapping/guide/theme/solarized.vim index 47de40347..19955311b 100644 --- a/autoload/SpaceVim/mapping/guide/theme/solarized.vim +++ b/autoload/SpaceVim/mapping/guide/theme/solarized.vim @@ -24,23 +24,23 @@ " group_v: window id in visual mode " group_r: window id in select mode -let s:gui_base03 = "#002b36" -let s:gui_base02 = "#073642" -let s:gui_base01 = "#586e75" -let s:gui_base00 = "#657b83" -let s:gui_base0 = "#839496" -let s:gui_base1 = "#93a1a1" -let s:gui_base2 = "#eee8d5" -let s:gui_base3 = "#fdf6e3" -let s:gui_yellow = "#b58900" -let s:gui_orange = "#cb4b16" -let s:gui_red = "#dc322f" -let s:gui_magenta = "#d33682" -let s:gui_violet = "#6c71c4" -let s:gui_blue = "#268bd2" -let s:gui_cyan = "#2aa198" +let s:gui_base03 = '#002b36' +let s:gui_base02 = '#073642' +let s:gui_base01 = '#586e75' +let s:gui_base00 = '#657b83' +let s:gui_base0 = '#839496' +let s:gui_base1 = '#93a1a1' +let s:gui_base2 = '#eee8d5' +let s:gui_base3 = '#fdf6e3' +let s:gui_yellow = '#b58900' +let s:gui_orange = '#cb4b16' +let s:gui_red = '#dc322f' +let s:gui_magenta = '#d33682' +let s:gui_violet = '#6c71c4' +let s:gui_blue = '#268bd2' +let s:gui_cyan = '#2aa198' "let s:gui_green = "#859900" "original -let s:gui_green = "#719e07" "experimental +let s:gui_green = '#719e07' "experimental let s:cterm_base03 = 8 let s:cterm_base02 = 0 diff --git a/autoload/SpaceVim/mapping/leader.vim b/autoload/SpaceVim/mapping/leader.vim index 2c5f41a00..4be7cb4e6 100644 --- a/autoload/SpaceVim/mapping/leader.vim +++ b/autoload/SpaceVim/mapping/leader.vim @@ -172,13 +172,13 @@ endfunction function! SpaceVim#mapping#leader#getName(key) abort - if a:key == ' ' + if a:key ==# ' ' return '[SPC]' - elseif a:key == 'g' + elseif a:key ==# 'g' return '[g]' - elseif a:key == 'z' + elseif a:key ==# 'z' return '[z]' - elseif a:key == g:spacevim_windows_leader + elseif a:key ==# g:spacevim_windows_leader return '[WIN]' elseif a:key ==# '\' return '' diff --git a/autoload/SpaceVim/mapping/tab.vim b/autoload/SpaceVim/mapping/tab.vim index 6a8bbb5c8..d962d475b 100644 --- a/autoload/SpaceVim/mapping/tab.vim +++ b/autoload/SpaceVim/mapping/tab.vim @@ -28,7 +28,7 @@ if g:spacevim_snippet_engine ==# 'neosnippet' endif endfunction elseif g:spacevim_snippet_engine ==# 'ultisnips' - function! SpaceVim#mapping#tab#expandable() + function! SpaceVim#mapping#tab#expandable() abort let snippet = UltiSnips#ExpandSnippetOrJump() if g:ulti_expand_or_jump_res > 0 return snippet diff --git a/autoload/SpaceVim/plugins/a.vim b/autoload/SpaceVim/plugins/a.vim index c8e9b927f..2031de2a5 100644 --- a/autoload/SpaceVim/plugins/a.vim +++ b/autoload/SpaceVim/plugins/a.vim @@ -20,13 +20,13 @@ let s:conf = '.project_alt.json' let s:project_config = {} -function! SpaceVim#plugins#a#set_config_name(name) +function! SpaceVim#plugins#a#set_config_name(name) abort let s:conf = a:name endfunction -function! SpaceVim#plugins#a#alt() +function! SpaceVim#plugins#a#alt() abort let conf_file = s:FILE.unify_path(s:conf, ':p') let file = s:FILE.unify_path(bufname('%'), ':.') let alt = SpaceVim#plugins#a#get_alt(file, conf_file) @@ -70,7 +70,7 @@ function! Log() abort return s:project_config endfunction -function! SpaceVim#plugins#a#get_alt(file, root) +function! SpaceVim#plugins#a#get_alt(file, root) abort if !has_key(s:project_config, a:root) let altconfa = s:JSON.json_decode(join(readfile(a:root), "\n")) let s:project_config[a:root] = {} @@ -84,7 +84,7 @@ function! SpaceVim#plugins#a#get_alt(file, root) endfunction -function! SpaceVim#plugins#a#get_root() +function! SpaceVim#plugins#a#get_root() abort return s:FILE.unify_path(s:conf, ':p') endfunction diff --git a/autoload/SpaceVim/plugins/bashcomplete.vim b/autoload/SpaceVim/plugins/bashcomplete.vim index 385aa5150..937bbbcb2 100644 --- a/autoload/SpaceVim/plugins/bashcomplete.vim +++ b/autoload/SpaceVim/plugins/bashcomplete.vim @@ -15,7 +15,7 @@ endif " complete input -function! SpaceVim#plugins#bashcomplete#complete(ArgLead, CmdLine, CursorPos) +function! SpaceVim#plugins#bashcomplete#complete(ArgLead, CmdLine, CursorPos) abort return s:BASH_COMPLETE.complete_input(a:ArgLead, a:CmdLine, a:CursorPos) endfunction diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index 73382360d..9b1e331b4 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -77,7 +77,7 @@ function! s:get_search_cmd(expr) abort let cmd += [a:expr] + [s:grep_files] elseif !empty(s:grep_dir) " grep dir is not a empty string - if s:grep_exe == 'findstr' + if s:grep_exe ==# 'findstr' let cmd += [s:grep_dir] + [a:expr] + ['%CD%\*'] else let cmd += [a:expr] + [s:grep_dir] @@ -87,7 +87,7 @@ function! s:get_search_cmd(expr) abort " current directory. let cmd += [a:expr] " in window, when using rg, ag, need to add '.' at the end. - if s:SYS.isWindows && (s:grep_exe == 'rg' || s:grep_exe == 'ag' || s:grep_exe == 'pt' ) + if s:SYS.isWindows && (s:grep_exe ==# 'rg' || s:grep_exe ==# 'ag' || s:grep_exe ==# 'pt' ) let cmd += ['.'] endif let cmd += s:grep_ropt @@ -449,6 +449,7 @@ function! Test() abort return s:previewd_bufnrs endfunction +" @vimlint(EVL103, 1, a:timer) function! s:preview_timer(timer) abort for id in filter(s:previewd_bufnrs, 'bufexists(v:val) && buflisted(v:val)') exe 'silent bd ' . id @@ -466,6 +467,7 @@ function! s:preview_timer(timer) abort resize 18 call s:MPT._build_prompt() endfunction +" @vimlint(EVL103, 0, a:timer) function! s:preview() abort @@ -580,6 +582,7 @@ function! SpaceVim#plugins#flygrep#open(agrv) abort setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber let save_tve = &t_ve setlocal t_ve= + let cursor_hi = {} if has('gui_running') let cursor_hi = s:HI.group2dict('Cursor') call s:HI.hide_in_normal('Cursor') @@ -603,9 +606,9 @@ function! SpaceVim#plugins#flygrep#open(agrv) abort let s:grep_dir = '' endif let s:grep_exe = get(a:agrv, 'cmd', s:grep_default_exe) - if empty(s:grep_dir) && empty(s:grep_files) && s:grep_exe == 'findstr' + if empty(s:grep_dir) && empty(s:grep_files) && s:grep_exe ==# 'findstr' let s:grep_files = '*.*' - elseif s:grep_exe == 'findstr' && !empty(s:grep_dir) + elseif s:grep_exe ==# 'findstr' && !empty(s:grep_dir) let s:grep_dir = '/D:' . s:grep_dir endif let s:grep_opt = get(a:agrv, 'opt', s:grep_default_opt) diff --git a/autoload/SpaceVim/plugins/help.vim b/autoload/SpaceVim/plugins/help.vim index a192f33f4..3385a6ff6 100644 --- a/autoload/SpaceVim/plugins/help.vim +++ b/autoload/SpaceVim/plugins/help.vim @@ -9,10 +9,10 @@ let s:KEY = SpaceVim#api#import('vim#key') let s:key_describ = {} -function! SpaceVim#plugins#help#describe_bindings() +function! SpaceVim#plugins#help#describe_bindings() abort endfunction -function! SpaceVim#plugins#help#regist_root(dict) +function! SpaceVim#plugins#help#regist_root(dict) abort let keys = keys(a:dict) if type(a:dict) == 4 && len(keys) == 1 call extend(s:key_describ, a:dict) @@ -20,7 +20,7 @@ function! SpaceVim#plugins#help#regist_root(dict) endfunction -function! SpaceVim#plugins#help#describe_key() +function! SpaceVim#plugins#help#describe_key() abort let defined = 1 let root = s:key_describ let prompt = 'Describe key:' diff --git a/autoload/SpaceVim/plugins/iedit.vim b/autoload/SpaceVim/plugins/iedit.vim index 1a3ca8f38..38a4497ac 100644 --- a/autoload/SpaceVim/plugins/iedit.vim +++ b/autoload/SpaceVim/plugins/iedit.vim @@ -70,7 +70,7 @@ endfunction " stack cursor pos stack " < " if only argv 1 is given, use selected word as pattern -function! SpaceVim#plugins#iedit#start(...) +function! SpaceVim#plugins#iedit#start(...) abort let save_tve = &t_ve let save_cl = &l:cursorline setlocal nocursorline @@ -112,7 +112,7 @@ function! SpaceVim#plugins#iedit#start(...) endif call s:highlight_cursor() redrawstatus! - while s:mode != '' + while s:mode !=# '' redraw! let char = getchar() if s:mode ==# 'n' && char == 27 @@ -176,7 +176,7 @@ function! s:handle_normal(char) abort let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g') endfor redrawstatus! - elseif a:char == "\" || a:char == 104 + elseif a:char ==# "\" || a:char == 104 for i in range(len(s:cursor_stack)) if !empty(s:cursor_stack[i].begin) let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end @@ -184,19 +184,19 @@ function! s:handle_normal(char) abort let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g') endif endfor - elseif a:char == "\" || a:char == 108 + elseif a:char ==# "\" || a:char == 108 for i in range(len(s:cursor_stack)) let s:cursor_stack[i].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.') let s:cursor_stack[i].end = substitute(s:cursor_stack[i].end, '^.', '', 'g') endfor - elseif a:char == 48 || a:char == "\" " 0 or + elseif a:char == 48 || a:char ==# "\" " 0 or for i in range(len(s:cursor_stack)) let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '^.') let s:cursor_stack[i].end = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '^.', '', 'g') let s:cursor_stack[i].begin = '' endfor - elseif a:char == 36 || a:char == "\" " $ or + elseif a:char == 36 || a:char ==# "\" " $ or for i in range(len(s:cursor_stack)) let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end, '.$') let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin . s:cursor_stack[i].cursor . s:cursor_stack[i].end , '.$', '', 'g') @@ -290,11 +290,11 @@ function! s:handle_insert(char) abort let s:cursor_stack[i].cursor = '' let s:cursor_stack[i].end = '' endfor - elseif a:char == "\" + elseif a:char ==# "\" for i in range(len(s:cursor_stack)) let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g') endfor - elseif a:char == "\" + elseif a:char ==# "\" for i in range(len(s:cursor_stack)) if !empty(s:cursor_stack[i].begin) let s:cursor_stack[i].end = s:cursor_stack[i].cursor . s:cursor_stack[i].end @@ -302,7 +302,7 @@ function! s:handle_insert(char) abort let s:cursor_stack[i].begin = substitute(s:cursor_stack[i].begin, '.$', '', 'g') endif endfor - elseif a:char == "\" + elseif a:char ==# "\" for i in range(len(s:cursor_stack)) let s:cursor_stack[i].begin = s:cursor_stack[i].begin . s:cursor_stack[i].cursor let s:cursor_stack[i].cursor = matchstr(s:cursor_stack[i].end, '^.') diff --git a/autoload/SpaceVim/plugins/pmd.vim b/autoload/SpaceVim/plugins/pmd.vim index eac8a7d84..4a1310d25 100644 --- a/autoload/SpaceVim/plugins/pmd.vim +++ b/autoload/SpaceVim/plugins/pmd.vim @@ -32,7 +32,7 @@ if !exists('Pmd_Cmd') endif if !exists('Pmd_Rulesets') - let g:Pmd_Rulesets = ["-R", "java-basic,java-design", "-property", "xsltFilename=my-own.xs"] + let g:Pmd_Rulesets = ['-R', 'java-basic,java-design', '-property', 'xsltFilename=my-own.xs'] endif if !exists('Pmd_silent_stderr') @@ -91,7 +91,7 @@ endfunction " @vimlint(EVL103, 0, a:data) " @vimlint(EVL103, 0, a:event) -function! SpaceVim#plugins#pmd#run(...) +function! SpaceVim#plugins#pmd#run(...) abort let argv = g:Pmd_Cmd + a:000 if index(a:000, '-R') == -1 let argv += g:Pmd_Rulesets @@ -112,13 +112,13 @@ function! SpaceVim#plugins#pmd#run(...) \ ) endfunction -function! SpaceVim#plugins#pmd#debug() +function! SpaceVim#plugins#pmd#debug() abort call s:CMD.debug() call s:JOB.debug() endfunction -function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos) +function! SpaceVim#plugins#pmd#complete(ArgLead, CmdLine, CursorPos) abort return s:CMD.complete(a:ArgLead, a:CmdLine, a:CursorPos) endfunction diff --git a/autoload/SpaceVim/plugins/projectmanager.vim b/autoload/SpaceVim/plugins/projectmanager.vim index f5614951e..76bd0f705 100644 --- a/autoload/SpaceVim/plugins/projectmanager.vim +++ b/autoload/SpaceVim/plugins/projectmanager.vim @@ -149,10 +149,10 @@ function! s:find_root_directory() abort let dir = SpaceVim#util#findFileInParent(pattern, fd) endif let ftype = getftype(dir) - if ftype == 'dir' || ftype == 'file' + if ftype ==# 'dir' || ftype ==# 'file' let dir = fnamemodify(dir, ':p') if dir !=# expand('~/.SpaceVim.d/') - call SpaceVim#logger#info(" (" . pattern . "):" . dir) + call SpaceVim#logger#info(' (' . pattern . '):' . dir) call add(dirs, dir) endif endif diff --git a/autoload/SpaceVim/plugins/quickfix.vim b/autoload/SpaceVim/plugins/quickfix.vim index c88da54ba..1fff5c0ba 100644 --- a/autoload/SpaceVim/plugins/quickfix.vim +++ b/autoload/SpaceVim/plugins/quickfix.vim @@ -26,7 +26,7 @@ let s:qf_bufnr = -1 " like setqflist() -function! SpaceVim#plugins#quickfix#setqflist(list, ...) +function! SpaceVim#plugins#quickfix#setqflist(list, ...) abort let action = get(a:000, 0, ' ') if action ==# 'a' call extend(s:qflist, a:list) @@ -46,14 +46,14 @@ function! SpaceVim#plugins#quickfix#setqflist(list, ...) endfunction -function! SpaceVim#plugins#quickfix#getqflist() +function! SpaceVim#plugins#quickfix#getqflist() abort return s:qflist endfunction -function! SpaceVim#plugins#quickfix#next() +function! SpaceVim#plugins#quickfix#next() abort let s:qf_index += 1 let file = get(s:filestack, s:qf_index, {}) @@ -66,7 +66,7 @@ function! SpaceVim#plugins#quickfix#next() endfunction -function! SpaceVim#plugins#quickfix#pre() +function! SpaceVim#plugins#quickfix#pre() abort let s:qf_index -= 1 let file = get(s:filestack, s:qf_index, {}) @@ -79,7 +79,7 @@ function! SpaceVim#plugins#quickfix#pre() endfunction -function! SpaceVim#plugins#quickfix#enter() +function! SpaceVim#plugins#quickfix#enter() abort let s:qf_index = line('.') - 1 let file = get(s:filestack, s:qf_index, {}) if !empty(file) @@ -90,7 +90,7 @@ function! SpaceVim#plugins#quickfix#enter() endfunction let s:BUFFER = SpaceVim#api#import('vim#buffer') -function! SpaceVim#plugins#quickfix#openwin() +function! SpaceVim#plugins#quickfix#openwin() abort call s:BUFFER.open({ \ 'bufname' : '__quickfix__', \ 'cmd' : 'setl buftype=nofile bufhidden=wipe filetype=SpaceVimQuickFix nomodifiable nowrap nobuflisted', diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index 0261f38d1..82fd15479 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -255,14 +255,14 @@ let g:unite_source_menu_menus.RunnerLanguage = {'description': let g:unite_source_menu_menus.RunnerLanguage.command_candidates = \ get(g:unite_source_menu_menus.RunnerLanguage,'command_candidates', []) -function! SpaceVim#plugins#runner#select_language() +function! SpaceVim#plugins#runner#select_language() abort " @todo use denite or unite to select language " and set the s:selected_language " the all language is keys(s:runners) Denite menu:RunnerLanguage endfunction -function! SpaceVim#plugins#runner#set_language(lang) +function! SpaceVim#plugins#runner#set_language(lang) abort " @todo use denite or unite to select language " and set the s:selected_language " the all language is keys(s:runners) diff --git a/autoload/SpaceVim/plugins/windisk.vim b/autoload/SpaceVim/plugins/windisk.vim index 19d775ec3..6824b447d 100644 --- a/autoload/SpaceVim/plugins/windisk.vim +++ b/autoload/SpaceVim/plugins/windisk.vim @@ -6,7 +6,7 @@ " License: GPLv3 "============================================================================= -func! SpaceVim#plugins#windisk#open() +func! SpaceVim#plugins#windisk#open() abort let disks = s:get_disks() if !empty(disks) " 1. open plugin buffer @@ -28,7 +28,7 @@ func! SpaceVim#plugins#windisk#open() endif endf -func! s:get_disks() +func! s:get_disks() abort return map(filter(range(65, 97), "isdirectory(nr2char(v:val) . ':/')"), 'nr2char(v:val) . ":/"') endf diff --git a/autoload/SpaceVim/server.vim b/autoload/SpaceVim/server.vim index da94021e8..e786662f7 100644 --- a/autoload/SpaceVim/server.vim +++ b/autoload/SpaceVim/server.vim @@ -11,7 +11,7 @@ " This function should not be called twice! let s:flag = 0 -function! SpaceVim#server#connect() +function! SpaceVim#server#connect() abort if s:flag == 0 if empty($SPACEVIM_SERVER_ADDRESS) let $SPACEVIM_SERVER_ADDRESS = fnamemodify('/tmp/' . (has('nvim') ? 'spacevim_nvim_' : 'spacevim_vim_') . 'server', ':p') @@ -36,17 +36,17 @@ function! SpaceVim#server#connect() endfunction -function! SpaceVim#server#export_server() +function! SpaceVim#server#export_server() abort if executable('export') call system('export $TEST_SPACEVIM="test"') endif endfunction -function! SpaceVim#server#terminate() +function! SpaceVim#server#terminate() abort endfunction -function! SpaceVim#server#list() +function! SpaceVim#server#list() abort if has('nvim') return join(serverlist(), "\n") else diff --git a/autoload/zvim/debug.vim b/autoload/zvim/debug.vim index 4579303ff..e72944f40 100644 --- a/autoload/zvim/debug.vim +++ b/autoload/zvim/debug.vim @@ -1,6 +1,6 @@ let s:debug_message = [] function! zvim#debug#completion_debug(ArgLead, CmdLine, CursorPos) abort - call add(s:debug_message, "arglead:[".a:ArgLead ."] cmdline:[" .a:CmdLine ."] cursorpos:[" .a:CursorPos ."]") + call add(s:debug_message, 'arglead:['.a:ArgLead .'] cmdline:[' .a:CmdLine .'] cursorpos:[' .a:CursorPos .']') endfunction function! zvim#debug#get_message() abort diff --git a/colors/SpaceVim.vim b/colors/SpaceVim.vim index 086def607..e1454700c 100644 --- a/colors/SpaceVim.vim +++ b/colors/SpaceVim.vim @@ -7,9 +7,9 @@ "============================================================================= -if version > 580 +if v:version > 580 hi clear - if exists("syntax_on") + if exists('syntax_on') syntax reset endif endif @@ -23,7 +23,7 @@ endif let s:HIAPI = SpaceVim#api#import('vim#highlight') let s:COLOR = SpaceVim#api#import('color') -let s:is_dark=(&background == 'dark') +let s:is_dark=(&background ==# 'dark') function! s:hi(items) abort for [item, fg, bg, cterm, gui] in a:items diff --git a/config/functions.vim b/config/functions.vim index bef197afa..ffa7660e8 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -61,19 +61,19 @@ function! BracketsFunc() endf function! XmlFileTypeInit() set omnifunc=xmlcomplete#CompleteTags - if filereadable("AndroidManifest.xml") + if filereadable('AndroidManifest.xml') set dict+=~/.vim/bundle/vim-dict/dict/android_xml.dic endif endf function! WSDAutoComplete(char) - if(getline(".")=~?'^\s*.*\/\/')==0 + if(getline('.')=~?'^\s*.*\/\/')==0 let line = getline('.') let col = col('.') - if a:char == "." + if a:char ==# '.' return a:char."\\\" - elseif line[col - 2] == " "||line[col -2] == "("||line[col - 2] == "," + elseif line[col - 2] ==# ' ' ||line[col -2] ==# '(' ||line[col - 2] ==# ',' return a:char."\\\" - elseif line[col - 3] == " "&&line[col - 2] =="@" + elseif line[col - 3] ==# ' ' && line[col - 2] ==# '@' return a:char."\\\" else return a:char @@ -109,7 +109,7 @@ endf function! QuoteDelim(char) let line = getline('.') let col = col('.') - if line[col - 2] == "\\" + if line[col - 2] ==# "\\" "Inserting a quoted quotation mark into the string return a:char elseif line[col - 1] == a:char @@ -129,23 +129,23 @@ function! JspFileTypeInit() endfunction function! MyLeaderTabfunc() abort - if g:spacevim_autocomplete_method == 'deoplete' + if g:spacevim_autocomplete_method ==# 'deoplete' if g:spacevim_enable_javacomplete2_py return deoplete#mappings#manual_complete(['javacomplete2']) else return deoplete#mappings#manual_complete(['omni']) endif - elseif g:spacevim_autocomplete_method == 'neocomplete' + elseif g:spacevim_autocomplete_method ==# 'neocomplete' return neocomplete#start_manual_complete(['omni']) endif endfunction func! Openpluginrepo() try - exec "normal! ".'"ayi'."'" + exec 'normal! '.'"ayi'."'" exec 'OpenBrowser https://github.com/'.@a catch - echohl WarningMsg | echomsg "can not open the web of current plugin" | echohl None + echohl WarningMsg | echomsg 'can not open the web of current plugin' | echohl None endtry endf func! Update_current_plugin() diff --git a/config/main.vim b/config/main.vim index 2ddc3a5b4..5fafefb99 100644 --- a/config/main.vim +++ b/config/main.vim @@ -10,7 +10,8 @@ if has('vim_starting') " set default encoding to utf-8 " Let Vim use utf-8 internally, because many scripts require this - set encoding=utf-8 + exe 'set encoding=utf-8' + scriptencoding utf-8 if &compatible set nocompatible endif diff --git a/config/plugins/asyncomplete-buffer.vim b/config/plugins/asyncomplete-buffer.vim index ed3d01fa7..223c0433a 100644 --- a/config/plugins/asyncomplete-buffer.vim +++ b/config/plugins/asyncomplete-buffer.vim @@ -1,6 +1,9 @@ -au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({ - \ 'name': 'B', - \ 'whitelist': ['*'], - \ 'blacklist': ['go'], - \ 'completor': function('asyncomplete#sources#buffer#completor'), - \ })) +augroup asyncompelet_buffer + autocmd! + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({ + \ 'name': 'B', + \ 'whitelist': ['*'], + \ 'blacklist': ['go'], + \ 'completor': function('asyncomplete#sources#buffer#completor'), + \ })) +augroup END diff --git a/config/plugins/asyncomplete-clang.vim b/config/plugins/asyncomplete-clang.vim index 54ad83bd9..8eb68f887 100644 --- a/config/plugins/asyncomplete-clang.vim +++ b/config/plugins/asyncomplete-clang.vim @@ -1,9 +1,12 @@ -autocmd User asyncomplete_setup call asyncomplete#register_source( - \ asyncomplete#sources#clang#get_source_options({ - \ 'config': { - \ 'clang_path': get(g:, 'asyncomplete_clang_executable', 'clang'), - \ 'clang_args': { - \ 'default': ['-I/opt/llvm/include'], - \ } - \ } - \ })) +augroup asyncomplete_clang + autocmd! + autocmd User asyncomplete_setup call asyncomplete#register_source( + \ asyncomplete#sources#clang#get_source_options({ + \ 'config': { + \ 'clang_path': get(g:, 'asyncomplete_clang_executable', 'clang'), + \ 'clang_args': { + \ 'default': ['-I/opt/llvm/include'], + \ } + \ } + \ })) +augroup END diff --git a/config/plugins/asyncomplete-necovim.vim b/config/plugins/asyncomplete-necovim.vim index 6b1fca6d7..2d671b68b 100644 --- a/config/plugins/asyncomplete-necovim.vim +++ b/config/plugins/asyncomplete-necovim.vim @@ -1,5 +1,8 @@ -au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#necovim#get_source_options({ - \ 'name': 'necovim', - \ 'whitelist': ['vim'], - \ 'completor': function('asyncomplete#sources#necovim#completor'), - \ })) +augroup asyncomplete_necovim + autocmd! + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#necovim#get_source_options({ + \ 'name': 'necovim', + \ 'whitelist': ['vim'], + \ 'completor': function('asyncomplete#sources#necovim#completor'), + \ })) +augroup END diff --git a/config/plugins/asyncomplete-omni.vim b/config/plugins/asyncomplete-omni.vim index f7c7d8de3..2964a9a56 100644 --- a/config/plugins/asyncomplete-omni.vim +++ b/config/plugins/asyncomplete-omni.vim @@ -1,6 +1,9 @@ -au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({ - \ 'name': 'omni', - \ 'whitelist': ['*'], - \ 'blacklist': ['html', 'c', 'cpp'], - \ 'completor': function('asyncomplete#sources#omni#completor') - \ })) +augroup asyncomplete_omni + autocmd! + au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#omni#get_source_options({ + \ 'name': 'omni', + \ 'whitelist': ['*'], + \ 'blacklist': ['html', 'c', 'cpp'], + \ 'completor': function('asyncomplete#sources#omni#completor') + \ })) +augroup END diff --git a/config/plugins/java_getset.vim b/config/plugins/java_getset.vim index 082013f13..dd315c618 100644 --- a/config/plugins/java_getset.vim +++ b/config/plugins/java_getset.vim @@ -7,7 +7,7 @@ let g:javagetset_setterTemplate = get(g:, 'javagetset_setterTemplate', \ " */\n" . \ "%modifiers% void %funcname%(%type% %varname%){\n" . \ " this.%varname% = %varname%;\n" . - \ "}") + \ '}') let g:javagetset_getterTemplate = get(g:, 'javagetset_getterTemplate', \ "/**\n" . \ " * Get %varname%.\n" . @@ -16,6 +16,6 @@ let g:javagetset_getterTemplate = get(g:, 'javagetset_getterTemplate', \ " */\n" . \ "%modifiers% %type% %funcname%(){\n" . \ " return %varname%;\n" . - \ "}") + \ '}') " vim:set et sw=2: diff --git a/config/plugins_before/ale.vim b/config/plugins_before/ale.vim index 9c72a3c8d..0f064c2a0 100644 --- a/config/plugins_before/ale.vim +++ b/config/plugins_before/ale.vim @@ -5,7 +5,7 @@ let g:ale_sign_info = get(g:,'spacevim_info_symbol', '🛈') let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%severity%: %linter%: %s') let g:ale_lint_on_save = get(g:, 'spacevim_lint_on_save', 1) -if g:spacevim_colorscheme == 'gruvbox' +if g:spacevim_colorscheme ==# 'gruvbox' highlight link ALEErrorSign GruvboxRedSign highlight link ALEWarningSign GruvboxYellowSign endif diff --git a/filetype.vim b/filetype.vim index 339a574be..5e0e0868f 100644 --- a/filetype.vim +++ b/filetype.vim @@ -6,7 +6,10 @@ " License: GPLv3 "============================================================================= -au BufRead,BufNewFile *.rs set filetype=rust -au BufNewFile,BufRead *.sol setf solidity +augroup spacevim_filetype_script + autocmd! + au BufRead,BufNewFile *.rs set filetype=rust + au BufNewFile,BufRead *.sol setf solidity +augroup END " vim:set et sw=2 diff --git a/syntax/HelpDescribe.vim b/syntax/HelpDescribe.vim index 74b0d62bf..2544e2a02 100644 --- a/syntax/HelpDescribe.vim +++ b/syntax/HelpDescribe.vim @@ -1,7 +1,7 @@ -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif -let b:current_syntax = "HelpDescribe" +let b:current_syntax = 'HelpDescribe' syntax case ignore syn match FileName /\(Definition:\ \)\@<=.*/ syn match KeyBindings /\[.*\]/ diff --git a/syntax/SpaceVimFindArgv.vim b/syntax/SpaceVimFindArgv.vim index 69fab3799..59f7adcfd 100644 --- a/syntax/SpaceVimFindArgv.vim +++ b/syntax/SpaceVimFindArgv.vim @@ -1,7 +1,7 @@ -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif -let b:current_syntax = "SpaceVimFindArgv" +let b:current_syntax = 'SpaceVimFindArgv' syntax case ignore syn match CMDFindArgvOpt /-[a-zA-Z]*\ / diff --git a/syntax/SpaceVimQuickFix.vim b/syntax/SpaceVimQuickFix.vim index 36c6801d5..3995ab0eb 100644 --- a/syntax/SpaceVimQuickFix.vim +++ b/syntax/SpaceVimQuickFix.vim @@ -1,7 +1,7 @@ -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif -let b:current_syntax = "SpaceVimQuickFix" +let b:current_syntax = 'SpaceVimQuickFix' syntax case ignore syn match FileName /^[^ ]*/ From dac32e1729e48447bbdd469484d7b2cee07ee0fa Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Mon, 28 Jan 2019 22:13:00 +0800 Subject: [PATCH 044/179] Doc: fix a typo. (#2520) --- docs/cn/api/data/string.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cn/api/data/string.md b/docs/cn/api/data/string.md index 80cb28d38..3e1463586 100644 --- a/docs/cn/api/data/string.md +++ b/docs/cn/api/data/string.md @@ -34,7 +34,7 @@ echo str1 | `trim_end(str)` | 移除字符串尾部空白字符,包括空格、制表符等,返回结果 | | `fill(str, len[, char])` | 字符串尾部填充或删除字符以达到指定可视长度 | | `fill_left(str, len[, char])` | 类似于`fill()`, 但是在首部填充或删除字符 | -| `fill_middle(str, len[, char])` | 类似于`fill()`, 但是在两次同时填充或删除字符 | +| `fill_middle(str, len[, char])` | 类似于`fill()`, 但是在两端同时填充或删除字符 | | `string2chars(str)` | 将字符串转换成一组字符列表并返回 | | `strALLIndex(str, )` | 在字符串中查询某个表达式,并返回一组匹配位置列表 | | `strQ2B(str)` | 将字符串从全角转化为半角 | From d388b33f2ff7fc368bdf500a026eb26ec6a9399e Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Tue, 29 Jan 2019 11:52:51 +0800 Subject: [PATCH 045/179] Add coffeescript suport (#2521) * Add coffeescript.vim * Add lang#coffeescript layer * Add post * Update coffee ide post * Fix image info * Update coffeescript ide post * Update layer list * Fix format * Fix type in doc --- .projections.json | 2 + .../SpaceVim/layers/lang/coffeescript.vim | 68 ++++++++++++ .../_posts/2019-01-19-use-vim-as-a-lua-ide.md | 2 +- .../_posts/2019-01-20-use-vim-as-a-lua-ide.md | 2 +- ...019-01-28-use-vim-as-a-coffeescript-ide.md | 92 ++++++++++++++++ ...019-01-29-use-vim-as-a-coffeescript-ide.md | 102 ++++++++++++++++++ docs/cn/layers.md | 4 +- docs/layers.md | 5 +- docs/layers/lang/coffeescript.md | 35 ++++++ 9 files changed, 306 insertions(+), 6 deletions(-) create mode 100644 autoload/SpaceVim/layers/lang/coffeescript.vim create mode 100644 docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md create mode 100644 docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md create mode 100644 docs/layers/lang/coffeescript.md diff --git a/.projections.json b/.projections.json index 2a8ef683b..206b50c4c 100644 --- a/.projections.json +++ b/.projections.json @@ -13,6 +13,8 @@ "wiki/cn/Following-HEAD.md": {"alternate": "wiki/en/Following-HEAD.md"}, "docs/_posts/2017-02-11-use-vim-as-a-java-ide.md": {"alternate": "docs/_posts/2018-09-19-use-vim-as-a-java-ide.md"}, "docs/_posts/2018-09-19-use-vim-as-a-java-ide.md": {"alternate": "docs/_posts/2017-02-11-use-vim-as-a-java-ide.md"}, + "docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md": {"alternate": "docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md"}, + "docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md": {"alternate": "docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md"}, "docs/_posts/2018-09-27-use-vim-as-a-python-ide.md": {"alternate": "docs/_posts/2018-09-28-use-vim-as-a-python-ide.md"}, "docs/_posts/2018-09-28-use-vim-as-a-python-ide.md": {"alternate": "docs/_posts/2018-09-27-use-vim-as-a-python-ide.md"}, "docs/_posts/2018-09-27-use-vim-as-ide.md": {"alternate": "docs/_posts/2018-09-28-use-vim-as-ide.md"}, diff --git a/autoload/SpaceVim/layers/lang/coffeescript.vim b/autoload/SpaceVim/layers/lang/coffeescript.vim new file mode 100644 index 000000000..a05ddcafa --- /dev/null +++ b/autoload/SpaceVim/layers/lang/coffeescript.vim @@ -0,0 +1,68 @@ +"============================================================================= +" coffeescript.vim --- lang#coffeescript layer +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + + +function! SpaceVim#layers#lang#coffeescript#plugins() abort + let plugins = [] + call add(plugins, ['wsdjeg/vim-coffeescript', {'on_ft' : 'coffee'}]) + return plugins +endfunction + + +function! SpaceVim#layers#lang#coffeescript#config() abort + call SpaceVim#plugins#runner#reg_runner('coffee', 'coffee %s') + call SpaceVim#plugins#repl#reg('coffee', 'coffee') + call SpaceVim#mapping#space#regesit_lang_mappings('coffee', function('s:language_specified_mappings')) + +endfunction + +function! s:language_specified_mappings() abort + call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) + let g:_spacevim_mappings_space.l.s = {'name' : '+Send'} + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'], + \ 'call SpaceVim#plugins#repl#start("coffee")', + \ 'start REPL process', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'], + \ 'call SpaceVim#plugins#repl#send("line")', + \ 'send line and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'], + \ 'call SpaceVim#plugins#repl#send("buffer")', + \ 'send buffer and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'], + \ 'call SpaceVim#plugins#repl#send("selection")', + \ 'send selection and keep code buffer focused', 1) + let g:neomake_coffee_enabled_makers = ['coffee', 'coffeelint'] + let g:neomake_coffee_coffeelint_maker = { + \ 'args': ['--reporter=csv'], + \ 'errorformat': '%f\,%l\,%\d%#\,%trror\,%m,' . + \ '%f\,%l\,%trror\,%m,' . + \ '%f\,%l\,%\d%#\,%tarn\,%m,' . + \ '%f\,%l\,%tarn\,%m' + \ } + let g:neomake_coffee_coffeelint_remove_invalid_entries = 1 + let g:neomake_coffee_coffee_maker = { + \ 'args': [], + \ 'output_stream': 'stderr', + \ 'errorformat': '%f:%l:%c: %m', + \ } + let g:neomake_coffee_coffee_remove_invalid_entries = 1 + " \ 'filter_output' : function('s:filter_coffee_lint'), + + let g:neoformat_enabled_coffee = ['coffeefmt'] + let g:neoformat_coffee_coffeefmt = { + \ 'exe': 'coffee-fmt', + \ 'args': ['--indent_stype', 'space', '-i'], + \ 'stdin': 0, + \ } +endfunction + + +function! s:filter_coffee_lint(lines, job) abort + let a:lines = [] +endfunction diff --git a/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md b/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md index 0d6e2e4f4..5c8be533e 100644 --- a/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md +++ b/docs/_posts/2019-01-19-use-vim-as-a-lua-ide.md @@ -1,7 +1,7 @@ --- title: "Use Vim as a Lua IDE" categories: [tutorials, blog] -images: https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png +image: https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png excerpt: "A general guide for using SpaceVim as Lua IDE, including layer configuration, requiems installation and usage." type: BlogPosting comments: true diff --git a/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md b/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md index 5cc37df79..6cda551a6 100644 --- a/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md +++ b/docs/_posts/2019-01-20-use-vim-as-a-lua-ide.md @@ -1,7 +1,7 @@ --- title: "使用 Vim 搭建 Lua 开发环境" categories: [tutorials_cn, blog_cn] -images: https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png +image: https://user-images.githubusercontent.com/13142418/51436347-3502f780-1cc6-11e9-9ae1-02e1dfa1e165.png excerpt: "这篇文章主要介绍如何使用 SpaceVim 搭建 Lua 的开发环境,简介 lang#lua 模块所支持的功能特性以及使用技巧" permalink: /cn/:title/ lang: cn diff --git a/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md b/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md new file mode 100644 index 000000000..ca0601671 --- /dev/null +++ b/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md @@ -0,0 +1,92 @@ +--- +title: "Use Vim as a CoffeeScript IDE" +categories: [tutorials, blog] +image: https://user-images.githubusercontent.com/13142418/51876268-fe526e80-23a2-11e9-8964-01fd62392a1f.png +excerpt: "A general guide for using SpaceVim as CoffeeScript IDE, including layer configuration, requiems installation and usage." +type: BlogPosting +comments: true +commentsID: "Use Vim as a CoffeeScript IDE" +--- + +# [Blogs](../blog/) >> Use Vim as a CoffeeScript IDE + +This is a general guide for using SpaceVim as a [CoffeeScript](https://coffeescript.org/) IDE, including layer configuration and usage. +Each of the following sections will be covered: + + + +- [Enable language layer](#enable-language-layer) +- [Code completion](#code-completion) +- [Syntax linting](#syntax-linting) +- [Jump to test file](#jump-to-test-file) +- [running code](#running-code) +- [Code formatting](#code-formatting) + + + +### Enable language layer + +By default `lang#coffeescript` layer is not loaded. To add CoffeeScript language support in SpaceVim, +you need to enable the `lang#coffeescript` layer. Press `SPC f v d` to open +SpaceVim configuration file, and add following configuration: + +```toml +[[layers]] + name = "lang#coffeescript" +``` + +for more info, you can read the [lang#coffeescript](../layers/lang/coffeescript/) layer documentation. + +### Code completion + +`lang#coffeescript` layer will load the vim-coffeescript plugin automatically, unless overriden in your `init.toml`. +The completion menu will be opened as you type. + +![coffeeide](https://user-images.githubusercontent.com/13142418/51876268-fe526e80-23a2-11e9-8964-01fd62392a1f.png) + +### Syntax linting + +The checkers layer is enabled by default. This layer provides asynchronous syntax linting via [neomake](https://github.com/neomake/neomake). +It will run [coffeelint](https://github.com/clutchski/coffeelint) asynchronously. + +The coffeelint is command line lint for coffeescript, currently is maintained by [Shuan Wang](https://github.com/swang). +To install coffeelint, just run following command in terminal. + +```sh +npm install -g coffeelint +``` + +Note: if no coffeelint is installed, neomake will ues default command `coffee`. + +![coffeecheckers](https://user-images.githubusercontent.com/13142418/51875890-bb43cb80-23a1-11e9-93b2-037e7120f5f2.png) + +### Jump to test file + +SpaceVim use built-in plugin to manager the files in a project, +you can add a `.project_alt.json` to the root of your project with following content: + +```json +{ + "src/*.coffee": {"alternate": "test/{}.coffee"}, + "test/*.coffee": {"alternate": "src/{}.coffee"} +} +``` + +with this configuration, you can jump between the source code and test file via command `:A`. + +### running code + +To run current script, you can press `SPC l r`, and a split windows +will be openen, the output of the script will be shown in this windows. +It is running asynchronously, and will not block your vim. + +![coffeerunner](https://user-images.githubusercontent.com/13142418/51877740-3f00b680-23a8-11e9-91ce-18cf147dbb95.png) + +### Code formatting + +The format layer is also enabled by default, with this layer you can use key binding `SPC b f` to format current buffer. +Before using this feature, please install coffee-fmt. + +```sh +npm install -g coffee-fmt +``` diff --git a/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md b/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md new file mode 100644 index 000000000..6d7552849 --- /dev/null +++ b/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md @@ -0,0 +1,102 @@ +--- +title: "使用 Vim 搭建 CoffeeScript 开发环境" +categories: [tutorials_cn, blog_cn] +image: https://user-images.githubusercontent.com/13142418/51876268-fe526e80-23a2-11e9-8964-01fd62392a1f.png +excerpt: "这篇文章主要介绍如何使用 SpaceVim 搭建 CoffeeScript 的开发环境,简介 lang#coffeescript 模块所支持的功能特性以及使用技巧" +permalink: /cn/:title/ +lang: cn +type: BlogPosting +comments: true +commentsID: "使用 Vim 搭建 CoffeeScript 开发环境" +--- + +# [Blogs](../blog/) >> 使用 Vim 搭建 CoffeeScript 开发环境 + +SpaceVim 是一个模块化的 Vim IDE,针对 CoffeeScript 这一语言的支持主要依靠 `lang#coffeescript` 模块以及与之相关的其他模块。 +的这篇文章主要介绍如何使用 SpaceVim 搭建 CoffeeScript 的开发环境,侧重介绍跟 CoffeeScript 开发相关使用技巧。 +在阅读这篇文章之前,可以先阅读《[使用 Vim 搭建基础的开发环境](../use-vim-as-ide/)》,对语言相关以外的功能有一个大致的了解。 + + + +- [安装模块](#安装模块) +- [代码自动补全](#代码自动补全) +- [语法检查](#语法检查) +- [工程文件跳转](#工程文件跳转) +- [快速运行](#快速运行) +- [代码格式化](#代码格式化) + + + +### 安装模块 + +SpaceVim 初次安装时默认并未启用相关语言模块。首先需要启用 +`lang#coffeescript` 模块, 通过快捷键 `SPC f v d` 打开配置文件,添加: + +```toml +[[layers]] + name = "lang#coffeescript" +``` + +启用 `lang#coffeescript` 模块后,在打开 CoffeeScript 文件时,就可以使用语言专属快捷键,这些快捷键都是以 `SPC l` 为前缀的。 + +### 代码自动补全 + +`autocomplete` 模块为 SpaceVim 提供了自动补全功能, +该模块会根据当前环境自动在多种补全引擎之间选择合适的, +默认的补全引擎有:deoplete、neocomplete、ycm、asyncomplete 以及 neocomplcache。 +几种自动补全引擎当中,要数 deoplete 的体验效果最好。 + +![coffeeide](https://user-images.githubusercontent.com/13142418/51876268-fe526e80-23a2-11e9-8964-01fd62392a1f.png) + +### 语法检查 + +`checkers` 模块为 SpaceVim 提供了语法检查的功能,该模块默认已经载入。该模块默认使用 [neomake](https://github.com/neomake/neomake) +这一异步语法检查工具。对于 CoffeeScript 的支持是通过异步调用 [coffeelint](https://github.com/clutchski/coffeelint) 命令来完成的。 + +`coffeelint` 是 CoffeeScript 命令行检测工具,目前由 [Shuan Wang](https://github.com/swang) 维护。可通过以下命令安装: + +```sh +npm install -g coffeelint +``` + +值得注意的是,除了 coffeelint, CoffeeScript 本身的 coffee 命令也居于语法检查功能,在 SpaceVim 中若 coffeelint 未安装, +则默认使用 coffee 这一命令来异步检查语法。 + +![coffeecheckers](https://user-images.githubusercontent.com/13142418/51875890-bb43cb80-23a1-11e9-93b2-037e7120f5f2.png) + +### 工程文件跳转 + +SpaceVim 自带工程管理插件,可以识别项目根目录,自动跳转alternate文件。 +可以在工程根目录添加 `.project_alt.json` 文件,并加入以下内容: + +```json +{ + "src/*.coffee": {"alternate": "test/{}.coffee"}, + "test/*.coffee": {"alternate": "src/{}.coffee"} +} +``` + +通过以上的配置,就可以使用命令 `:A` 在源文件和测试文件之间进行跳转。 + +### 快速运行 + +在编辑 CoffeeScript 文件时,可以快速运行当前文件,这个功能有点类似于 vscode 的 code runner 插件,默认的快捷键是 `SPC l r`。按下后, +会在屏幕下方打开一个插件窗口,运行的结果会被展示在窗口内。于此同时,光标并不会跳到该插件窗口,避免影响编辑。在这里需要说明下, +这一功能是根据当前文件的路径调用相对应的 `coffee` 命令。因此,在执行这个快捷键之前,应当先保存一下该文件。 + +![coffeerunner](https://user-images.githubusercontent.com/13142418/51877740-3f00b680-23a8-11e9-91ce-18cf147dbb95.png) + +### 代码格式化 + +CoffeeScript 代码格式化,主要依赖 `format` 模块,同时需要安装相关的后台命令 `coffee-fmt`: + +```toml +[[layers]] + name = "format" +``` + +安装 `coffee-fmt`: + +```sh +npm install -g coffee-fmt +``` diff --git a/docs/cn/layers.md b/docs/cn/layers.md index 47358fae6..170297703 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -59,6 +59,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | 名称 | 描述 | | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| [VersionControl](VersionControl/) | 这一模块为 SpaceVim 提供了通用的代码版本控制支持,该模块支持 Git、Mercurial、Bazaar、SVN 等等多种后台工具。 | | [autocomplete](autocomplete/) | 这一模块为 SpaceVim 提供了自动补全的框架,包括语法补全等多种补全来源,同时提供了代码块自动完成等特性。 | | [chat](chat/) | 这一模块为 SpaceVim 提供了一个聊天框架,目前支持微信聊天和 QQ 聊天,同时支持自定义聊天服务器。 | | [checkers](checkers/) | 这一模块为 SpaceVim 提供了代码语法检查的特性,同时提供代码实时检查,并列出语法错误的位置。 | @@ -80,6 +81,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [git](git/) | 这一模块为 SpaceVim 提供了 Git 支持,根据当前 Vim 版本特性,选择 gina 或者 gita 作为默认的后台 Git 插件。 | | [github](github/) | 这一模块为 SpaceVim 提供了 Github 数据管理功能,包括问题列表、动态等管理。 | | [japanese](japanese/) | 这一模块为 SpaceVim 的日文用户提供了日文的 Vim 帮助文档,同时提供部分插件的日文帮助文档。 | +| [lang#WebAssembly](lang/WebAssembly/) | 这一模块为 SpaceVim 提供了 WebAssembly 的开发支持。 | | [lang#agda](lang/agda/) | 这一模块为 SpaceVim 提供了 Agda 的开发支持,主要包括语法高亮及一键运行。 | | [lang#asciidoc](lang/asciidoc/) | 这一模块为 SpaceVim 提供了 AsciiDoc 的编辑支持,包括格式化、自动生成文章目录、代码块等特性。 | | [lang#autohotkey](lang/autohotkey/) | 这一模块为 SpaceVim 提供了 Autohotkey 的开发支持,包括语法高亮和自动补全等功能。 | @@ -123,7 +125,6 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [lang#typescript](lang/typescript/) | 这一模块为 SpaceVim 提供了 Typescript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#vim](lang/vim/) | 这一模块为 SpaceVim 提供了 Vimscript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#vue](lang/vue/) | 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。 | -| [lang#WebAssembly](lang/WebAssembly/) | 这一模块为 SpaceVim 提供了 WebAssembly 的开发支持。 | | [language-server-protocol](language-server-protocol/) | 这一模块为 SpaceVim 提供了 language server protocol 的支持,提供更多语言相关服务。 | | [leaderf](leaderf/) | 这一模块为 SpaceVim 提供了以 leaderf 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 | | [shell](shell/) | 这一模块为 SpaceVim 提供了终端集成特性,优化内置终端的使用体验。 | @@ -134,7 +135,6 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [tools](tools/) | 这一模块为 SpaceVim 提供了多种常用工具,包括日历、计算器等多种工具类插件,并针对 Vim8 以及 Neovim 提供了更好的插件选择。 | | [ui](ui/) | 这一模块为 SpaceVim 提供了 IDE-like 的界面,包括状态栏、文件树、语法树等等特性。 | | [unite](unite/) | 这一模块为 SpaceVim 提供以 unite 为核心的模糊查找机制,支持模糊搜索文件、历史纪录、函数列表等。 | -| [VersionControl](VersionControl/) | 这一模块为 SpaceVim 提供了通用的代码版本控制支持,该模块支持 Git、Mercurial、Bazaar、SVN 等等多种后台工具。 | diff --git a/docs/layers.md b/docs/layers.md index cd20ce5d3..9cad3fdca 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -65,6 +65,7 @@ Some layers are enabled by default. The following example shows how to disable ` | Name | Description | | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… | | [autocomplete](autocomplete/) | Autocomplete code within SpaceVim, fuzzy find the candidates from multiple completion sources, expand snippet before cursor automatically | | [chat](chat/) | SpaceVim chatting layer provide chatting with qq and weixin in vim. | | [checkers](checkers/) | Syntax checking automatically within SpaceVim, display error on the sign column and statusline. | @@ -86,11 +87,13 @@ Some layers are enabled by default. The following example shows how to disable ` | [git](git/) | This layers adds extensive support for git | | [github](github/) | This layer provides GitHub integration for SpaceVim | | [japanese](japanese/) | Layer for japanese users, include japanese docs and runtime messages | +| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim | | [lang#agda](lang/agda/) | This layer adds agda language support to SpaceVim | | [lang#asciidoc](lang/asciidoc/) | Edit asciidoc within vim, autopreview asciidoc in the default browser, with this layer you can also format asciidoc file. | | [lang#autohotkey](lang/autohotkey/) | This layer adds autohotkey language support to SpaceVim | | [lang#c](lang/c/) | c/c++/object-c language support for SpaceVim, include code completion, jump to definition, quick runner. | | [lang#clojure](lang/clojure/) | This layer is for clojure development, provide autocompletion, syntax checking, code format for clojure file. | +| [lang#coffeescript](lang/coffeescript/) | This layer is for coffeescript development, provide autocompletion, syntax checking, code format for coffeescript file. | | [lang#csharp](lang/csharp/) | This layer is for csharp development | | [lang#dart](lang/dart/) | This layer is for dart development, provide autocompletion, syntax checking, code format for dart file. | | [lang#dockerfile](lang/dockerfile/) | This layer adds DockerFile to SpaceVim | @@ -130,7 +133,6 @@ Some layers are enabled by default. The following example shows how to disable ` | [lang#typescript](lang/typescript/) | This layer is for TypeScript development | | [lang#vim](lang/vim/) | This layer is for writting vim script, including code completion, syntax checking and buffer formatting | | [lang#vue](lang/vue/) | This layer adds vue language support to SpaceVim | -| [lang#WebAssembly](lang/WebAssembly/) | This layer adds WebAssembly support to SpaceVim | | [language-server-protocol](language-server-protocol/) | This layers provides language server protocol for vim and neovim | | [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow | | [shell](shell/) | This layer provide shell support in SpaceVim | @@ -143,7 +145,6 @@ Some layers are enabled by default. The following example shows how to disable ` | [tools](tools/) | This layer provides some tools for vim | | [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI | | [unite](unite/) | This layers provide a heavily customized Unite centric work-flow | -| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… | diff --git a/docs/layers/lang/coffeescript.md b/docs/layers/lang/coffeescript.md new file mode 100644 index 000000000..be9f92fc3 --- /dev/null +++ b/docs/layers/lang/coffeescript.md @@ -0,0 +1,35 @@ +--- +title: "SpaceVim lang#coffeescript layer" +description: "This layer is for coffeescript development, provide autocompletion, syntax checking, code format for coffeescript file." +--- + +# [Available Layers](../../) >> lang#coffeescript + + + +- [Description](#description) +- [Features](#features) +- [Install](#install) + + + +## Description + +This layer is for coffeescript development, and it includes vim-coffeescript. + +## Features + +- Code completion +- Syntax highlighting +- Indent +- Code formatting +- REPL support + +## Install + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#coffeescript" +``` From b381aa88bdb935e3a27d874bfa4474e00154820d Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Tue, 29 Jan 2019 23:27:59 +0800 Subject: [PATCH 046/179] Add lsp support for css close #2517 --- autoload/SpaceVim/layers/lsp.vim | 23 +++++++++--------- docs/cn/layers/language-server-protocol.md | 28 ++++++++++++++-------- docs/layers/language-server-protocol.md | 27 +++++++++++++-------- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/autoload/SpaceVim/layers/lsp.vim b/autoload/SpaceVim/layers/lsp.vim index 6cdeb8016..0b978f40e 100644 --- a/autoload/SpaceVim/layers/lsp.vim +++ b/autoload/SpaceVim/layers/lsp.vim @@ -82,23 +82,24 @@ endfunction let s:enabled_fts = [] let s:lsp_servers = { - \ 'typescript' : ['typescript-language-server', '--stdio'], - \ 'sh' : ['bash-language-server', 'start'], - \ 'haskell' : ['hie-wrapper', '--lsp'], \ 'c' : ['clangd'], \ 'cpp' : ['clangd'], + \ 'css' : ['css-languageserver', '--stdio'], + \ 'dart' : ['dart_language_server'], + \ 'dockerfile' : ['docker-langserver', '--stdio'], + \ 'go' : ['go-langserver', '-mode', 'stdio'], + \ 'haskell' : ['hie-wrapper', '--lsp'], + \ 'html' : ['html-languageserver', '--stdio'], + \ 'javascript' : ['javascript-typescript-stdio'], + \ 'julia' : ['julia', '--startup-file=no', '--history-file=no', '-e', 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);'], \ 'objc' : ['clangd'], \ 'objcpp' : ['clangd'], - \ 'dart' : ['dart_language_server'], - \ 'go' : ['go-langserver', '-mode', 'stdio'], - \ 'dockerfile' : ['docker-langserver', '--stdio'], - \ 'rust' : ['rustup', 'run', 'nightly', 'rls'], - \ 'python' : ['pyls'], - \ 'html' : ['html-languageserver', '--stdio'], \ 'php' : ['php', g:spacevim_plugin_bundle_dir . 'repos/github.com/felixfbecker/php-language-server/bin/php-language-server.php'], - \ 'julia' : ['julia', '--startup-file=no', '--history-file=no', '-e', 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);'], - \ 'javascript' : ['javascript-typescript-stdio'], \ 'purescript' : ['purescript-language-server', '--stdio'], + \ 'python' : ['pyls'], + \ 'rust' : ['rustup', 'run', 'nightly', 'rls'], + \ 'sh' : ['bash-language-server', 'start'], + \ 'typescript' : ['typescript-language-server', '--stdio'], \ 'vue' : ['vls'] \ } diff --git a/docs/cn/layers/language-server-protocol.md b/docs/cn/layers/language-server-protocol.md index e310bceaf..959182626 100644 --- a/docs/cn/layers/language-server-protocol.md +++ b/docs/cn/layers/language-server-protocol.md @@ -100,6 +100,12 @@ julia> Pkg.clone("https://github.com/JuliaEditorSupport/LanguageServer.jl") npm install vue-language-server -g ``` +**css:** + +```sh +npm install -g vscode-css-languageserver-bin +``` + ## 模块配置 为指定模块启用语言服务器支持,需要在载入模块时,指定 `filetypes` 选项: @@ -117,21 +123,23 @@ npm install vue-language-server -g | 语言 | 命令 | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `javascript` | `['javascript-typescript-stdio']` | -| `sh` | `['bash-language-server', 'start']` | -| `typescript` | `['typescript-language-server', '--stdio']` | -| `haskell` | `['hie', '--lsp']` | | `c` | `['clangd']` | | `cpp` | `['clangd']` | -| `html` | `['html-languageserver', '--stdio']` | -| `objc` | `['clangd']` | -| `objcpp` | `['clangd']` | +| `css` | `['css-languageserver', '--stdio']` | | `dart` | `['dart_language_server']` | | `go` | `['go-langserver', '-mode', 'stdio']` | -| `rust` | `['rustup', 'run', 'nightly', 'rls']` | -| `python` | `['pyls']` | -| `php` | `['php', 'path/to/bin/php-language-server.php']` | +| `haskell` | `['hie', '--lsp']` | +| `html` | `['html-languageserver', '--stdio']` | +| `javascript` | `['javascript-typescript-stdio']` | | `julia` | `['julia', '--startup-file=no', '--history-file=no', '-e', 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);']` | +| `objc` | `['clangd']` | +| `objcpp` | `['clangd']` | +| `php` | `['php', 'path/to/bin/php-language-server.php']` | +| `purescript` | `['purescript-language-server', '--stdio']` | +| `python` | `['pyls']` | +| `rust` | `['rustup', 'run', 'nightly', 'rls']` | +| `sh` | `['bash-language-server', 'start']` | +| `typescript` | `['typescript-language-server', '--stdio']` | | `vue` | `['vls']` | 如果需要修改语言服务器的命令,在载入模块时,需要指定 `override_cmd` 选项: diff --git a/docs/layers/language-server-protocol.md b/docs/layers/language-server-protocol.md index 8ef74279c..9aec8d282 100644 --- a/docs/layers/language-server-protocol.md +++ b/docs/layers/language-server-protocol.md @@ -113,6 +113,12 @@ npm install -g purescript-language-server npm install vue-language-server -g ``` +**css:** + +```sh +npm install -g vscode-css-languageserver-bin +``` + ## Configuration To enable lsp support for a specified filetype, you may need to load this layer with `filtypes` option, for example: @@ -130,22 +136,23 @@ default language server commands: | language | server command | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `javascript` | `['javascript-typescript-stdio']` | -| `sh` | `['bash-language-server', 'start']` | -| `typescript` | `['typescript-language-server', '--stdio']` | -| `haskell` | `['hie', '--lsp']` | | `c` | `['clangd']` | | `cpp` | `['clangd']` | -| `html` | `['html-languageserver', '--stdio']` | -| `objc` | `['clangd']` | -| `objcpp` | `['clangd']` | +| `css` | `['css-languageserver', '--stdio']` | | `dart` | `['dart_language_server']` | | `go` | `['go-langserver', '-mode', 'stdio']` | -| `rust` | `['rustup', 'run', 'nightly', 'rls']` | -| `python` | `['pyls']` | -| `php` | `['php', 'path/to/bin/php-language-server.php']` | +| `haskell` | `['hie', '--lsp']` | +| `html` | `['html-languageserver', '--stdio']` | +| `javascript` | `['javascript-typescript-stdio']` | | `julia` | `['julia', '--startup-file=no', '--history-file=no', '-e', 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);']` | +| `objc` | `['clangd']` | +| `objcpp` | `['clangd']` | +| `php` | `['php', 'path/to/bin/php-language-server.php']` | | `purescript` | `['purescript-language-server', '--stdio']` | +| `python` | `['pyls']` | +| `rust` | `['rustup', 'run', 'nightly', 'rls']` | +| `sh` | `['bash-language-server', 'start']` | +| `typescript` | `['typescript-language-server', '--stdio']` | | `vue` | `['vls']` | To override the server command, you may need to use `override_cmd` option: From a700d516da2ecc464a6963754883bf675d07eec9 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 30 Jan 2019 14:05:52 +0800 Subject: [PATCH 047/179] Add vim-jsdoc to typescript layer (#2527) * Add vim-jsdoc to typescript layer * Improve typescript layer doc --- autoload/SpaceVim/layers/lang/typescript.vim | 6 ++++++ docs/cn/layers/lang/typescript.md | 1 + docs/layers/lang/typescript.md | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/typescript.vim b/autoload/SpaceVim/layers/lang/typescript.vim index 830ff5300..aa8982a13 100644 --- a/autoload/SpaceVim/layers/lang/typescript.vim +++ b/autoload/SpaceVim/layers/lang/typescript.vim @@ -10,6 +10,7 @@ function! SpaceVim#layers#lang#typescript#plugins() abort let plugins = [] call add(plugins, ['leafgarland/typescript-vim']) + call add(plugins, ['heavenshell/vim-jsdoc', { 'on_cmd': 'JsDoc' }]) if !SpaceVim#layers#lsp#check_filetype('typescript') if has('nvim') call add(plugins, ['mhartington/nvim-typescript', {'build': './install.sh'}]) @@ -91,6 +92,11 @@ function! s:on_ft() abort \ 'references', 1) endif endif + let g:_spacevim_mappings_space.l.g = {'name' : '+Generate'} + + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'g', 'd'], 'JsDoc', + \ 'generate JSDoc', 1) + endfunction function! s:go_to_def() abort diff --git a/docs/cn/layers/lang/typescript.md b/docs/cn/layers/lang/typescript.md index 2df9ae13c..affa4ee82 100644 --- a/docs/cn/layers/lang/typescript.md +++ b/docs/cn/layers/lang/typescript.md @@ -62,4 +62,5 @@ npm install -g typescript | `SPC l r` | references | | `SPC l s` | search | | `SPC l t` | type | +| `SPC l g d` | generate doc | | `g d` | defintion preview | diff --git a/docs/layers/lang/typescript.md b/docs/layers/lang/typescript.md index 0d9db95bf..82e08536c 100644 --- a/docs/layers/lang/typescript.md +++ b/docs/layers/lang/typescript.md @@ -1,6 +1,6 @@ --- title: "SpaceVim lang#typescript layer" -description: "This layer is for TypeScript development" +description: "This layer is for TypeScript development, includding code completion, Syntax lint, and doc generation." --- # [Available Layers](../../) >> lang#typescript @@ -17,7 +17,7 @@ description: "This layer is for TypeScript development" ## Description -This layer is for TypeScript development. +This layer is for TypeScript development, includding code completion, Syntax lint, and doc generation. ## Install @@ -61,4 +61,5 @@ npm install -g typescript | `SPC l r` | references | | `SPC l s` | search | | `SPC l t` | type | -| `g d` | defintion preview | +| `SPC l g d` | generate doc | +| `g d` | defintion preview | From f7a188528640369ef1ad6b360b7955854b333d01 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 30 Jan 2019 18:48:18 +0800 Subject: [PATCH 048/179] Update statusline after signify updated (#2528) --- autoload/SpaceVim/layers/VersionControl.vim | 3 +-- config/plugins/vim-signify.vim | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 config/plugins/vim-signify.vim diff --git a/autoload/SpaceVim/layers/VersionControl.vim b/autoload/SpaceVim/layers/VersionControl.vim index c05ae933a..e7c008c47 100644 --- a/autoload/SpaceVim/layers/VersionControl.vim +++ b/autoload/SpaceVim/layers/VersionControl.vim @@ -14,7 +14,7 @@ let s:enable_gtm_status = 0 function! SpaceVim#layers#VersionControl#plugins() abort let plugins = [] - call add(plugins, ['mhinz/vim-signify', {'merged' : 0}]) + call add(plugins, ['mhinz/vim-signify', {'merged' : 0, 'loadconf' : 1}]) call add(plugins, ['tpope/vim-fugitive', { 'merged' : 0}]) return plugins endfunction @@ -122,7 +122,6 @@ function! s:hunks() abort endif return empty(rst) ? '' : ' ' . rst endfunction - " vcs transient state functions: " first we need to open a buffer contains: diff --git a/config/plugins/vim-signify.vim b/config/plugins/vim-signify.vim new file mode 100644 index 000000000..626ad1d42 --- /dev/null +++ b/config/plugins/vim-signify.vim @@ -0,0 +1,5 @@ +augroup signify_config + autocmd! + autocmd User Signify let &l:statusline = SpaceVim#layers#core#statusline#get(1) +augroup END + From 8118fab5a8018749df21601df3f9f63a6d9ca055 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 30 Jan 2019 22:20:22 +0800 Subject: [PATCH 049/179] Improve the javascript layer (#2529) --- autoload/SpaceVim/layers/checkers.vim | 2 + autoload/SpaceVim/layers/lang/javascript.vim | 30 ++++- docs/_posts/2018-09-28-use-vim-as-ide.md | 6 + .../2019-01-27-use-vim-as-a-javascript-ide.md | 107 ++++++++++++++++++ .../2019-01-30-use-vim-as-a-javascript-ide.md | 98 ++++++++++++++++ docs/cn/layers/lang/javascript.md | 13 +++ docs/layers/lang/javascript.md | 14 +++ 7 files changed, 268 insertions(+), 2 deletions(-) create mode 100644 docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md create mode 100644 docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md diff --git a/autoload/SpaceVim/layers/checkers.vim b/autoload/SpaceVim/layers/checkers.vim index 5f35e6632..7b6841a30 100644 --- a/autoload/SpaceVim/layers/checkers.vim +++ b/autoload/SpaceVim/layers/checkers.vim @@ -58,6 +58,8 @@ function! SpaceVim#layers#checkers#config() abort let g:neomake_cursormoved_delay = get(g:, 'neomake_cursormoved_delay', 300) "" }}} + let g:neomake_virtualtext_current_error = get(g:, 'neomake_virtualtext_current_error', !s:show_cursor_error) + "" w0rp/ale {{{ let g:ale_echo_delay = get(g:, 'ale_echo_delay', 300) "" }}} diff --git a/autoload/SpaceVim/layers/lang/javascript.vim b/autoload/SpaceVim/layers/lang/javascript.vim index 1d4b51236..ad61a2360 100644 --- a/autoload/SpaceVim/layers/lang/javascript.vim +++ b/autoload/SpaceVim/layers/lang/javascript.vim @@ -62,12 +62,20 @@ function! SpaceVim#layers#lang#javascript#config() abort call SpaceVim#mapping#gd#add('javascript', function('s:tern_go_to_def')) endif + let g:neomake_javascript_enabled_makers = ['eslint'] + let g:neomake_javascript_eslint_maker = { + \ 'args': ['--format=compact'], + \ 'errorformat': '%E%f: line %l\, col %c\, Error - %m,' . + \ '%W%f: line %l\, col %c\, Warning - %m,%-G,%-G%*\d problems%#', + \ 'cwd': '%:p:h', + \ 'output_stream': 'stdout', + \ } + if s:auto_fix - " Only use eslint - let g:neomake_javascript_enabled_makers = ['eslint'] " Use the fix option of eslint let g:neomake_javascript_eslint_args = ['-f', 'compact', '--fix'] endif + " Only use eslint if s:auto_fix augroup SpaceVim_lang_javascript @@ -77,6 +85,10 @@ function! SpaceVim#layers#lang#javascript#config() abort autocmd FocusGained * call checktime_if_javascript() augroup END endif + " just add a note here, when using `node -`, the Buffered stdout will not + " be flushed by sender. + " Use node -i will show the output of repl command. + call SpaceVim#plugins#repl#reg('javascript', ['node', '-i']) endfunction function! s:on_ft() abort @@ -125,6 +137,20 @@ function! s:on_ft() abort call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'], \ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) + + let g:_spacevim_mappings_space.l.s = {'name' : '+Send'} + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'], + \ 'call SpaceVim#plugins#repl#start("javascript")', + \ 'start REPL process', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'], + \ 'call SpaceVim#plugins#repl#send("line")', + \ 'send line and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'], + \ 'call SpaceVim#plugins#repl#send("buffer")', + \ 'send buffer and keep code buffer focused', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'], + \ 'call SpaceVim#plugins#repl#send("selection")', + \ 'send selection and keep code buffer focused', 1) endfunction function! s:tern_go_to_def() abort diff --git a/docs/_posts/2018-09-28-use-vim-as-ide.md b/docs/_posts/2018-09-28-use-vim-as-ide.md index d1bd42b1f..42f13c5bd 100644 --- a/docs/_posts/2018-09-28-use-vim-as-ide.md +++ b/docs/_posts/2018-09-28-use-vim-as-ide.md @@ -17,6 +17,7 @@ This is a general guide for using SpaceVim as IDE. including following sections: - [Default UI](#default-ui) - [Fuzzy finder](#fuzzy-finder) - [Files and Windows](#files-and-windows) +- [Language support](#language-support) @@ -31,6 +32,8 @@ after installing Vim, following the quick start guide to install SpaceVim, ![default UI](https://user-images.githubusercontent.com/13142418/33804722-bc241f50-dd70-11e7-8dd8-b45827c0019c.png) +The welcome screen will show the recent files of current project. + ### Fuzzy finder SpaceVim provides 5 fuzzy finder layer, they are unite, denite, fzf, leaderf and ctrlp. To use fuzzy finder feature, you need to enable a @@ -46,3 +49,6 @@ name = "denite" The windows ID will be shown on the statusline, and users can use `SPC + number` to jump to specific windows, the buffer id or tabpage id will be shown on the tabline. To jump to specific tab, you can use `Leader + number` the default leader in SpaceVim is `\`. +### Language support + +By default, SpaceVim do not load any lanaguge layer, please checkout the [available layers](../layers/) page. diff --git a/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md b/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md new file mode 100644 index 000000000..f9b653ead --- /dev/null +++ b/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md @@ -0,0 +1,107 @@ +--- +title: "使用 Vim 搭建 JavaScript 开发环境" +categories: [tutorials_cn, blog_cn] +image: https://user-images.githubusercontent.com/13142418/51976034-add03380-24be-11e9-84b5-245432e7f933.png +excerpt: "这篇文章主要介绍如何使用 SpaceVim 搭建 JavaScript 的开发环境,简介 lang#javascript 模块所支持的功能特性以及使用技巧" +permalink: /cn/:title/ +lang: cn +type: BlogPosting +comments: true +commentsID: "使用 Vim 搭建 JavaScript 开发环境" +--- + +# [Blogs](../blog/) >> 使用 Vim 搭建 JavaScript 开发环境 + +SpaceVim 是一个模块化的 Vim IDE,针对 JavaScript 这一语言的支持主要依靠 `lang#javascript` 模块以及与之相关的其他模块。 +的这篇文章主要介绍如何使用 SpaceVim 搭建 JavaScript 的开发环境,侧重介绍跟 JavaScript 开发相关使用技巧。 +在阅读这篇文章之前,可以先阅读《[使用 Vim 搭建基础的开发环境](../use-vim-as-ide/)》,对语言相关以外的功能有一个大致的了解。 + + + +- [安装模块](#安装模块) +- [代码自动补全](#代码自动补全) +- [语法检查](#语法检查) +- [工程文件跳转](#工程文件跳转) +- [快速运行](#快速运行) +- [代码格式化](#代码格式化) +- [交互式编程](#交互式编程) + + + +### 安装模块 + +SpaceVim 初次安装时默认并未启用 JavaScript 相关语言模块。首先需要启用 +`lang#javascript` 模块, 通过快捷键 `SPC f v d` 打开配置文件,添加: + +```toml +[[layers]] + name = "lang#javascript" +``` + +启用 `lang#javascript` 模块后,在打开 JavaScript 文件时,就可以使用语言专属快捷键,这些快捷键都是以 `SPC l` 为前缀的。 + +### 代码自动补全 + +代码自动补全依赖 `autocomplete` 模块,该模块默认已经启动了,为 SpaceVim 提供了自动补全功能。 +该模块会根据当前环境自动在多种补全引擎之间选择合适的, +默认的补全引擎有:deoplete、neocomplete、ycm、asyncomplete 以及 neocomplcache。 +几种自动补全引擎当中,要数 deoplete 的体验效果最好。 + +![jside](https://user-images.githubusercontent.com/13142418/51976034-add03380-24be-11e9-84b5-245432e7f933.png) + +### 语法检查 + +`checkers` 模块为 SpaceVim 提供了语法检查的功能,该模块默认已经载入。该模块默认使用 [neomake](https://github.com/neomake/neomake) +这一异步语法检查工具。对于 JavaScript 的支持是通过异步调用 [eslint](https://eslint.org/) 命令来完成的。 + +可通过以下命令安装: + +```sh +npm install -g eslint +``` + +![eslint](https://user-images.githubusercontent.com/13142418/51972203-dbfd4580-24b5-11e9-9bbd-2a88e6f656f6.png) + +### 工程文件跳转 + +SpaceVim 自带工程管理插件,可以识别项目根目录,自动跳转alternate文件。 +可以在工程根目录添加 `.project_alt.json` 文件,并加入以下内容: + +```json +{ + "src/*.js": {"alternate": "test/{}.js"}, + "test/*.js": {"alternate": "src/{}.js"} +} +``` + +通过以上的配置,就可以使用命令 `:A` 在源文件和测试文件之间进行跳转。 + +### 快速运行 + +在编辑 JavaScript 文件时,可以快速运行当前文件,这个功能有点类似于 vscode 的 code runner 插件,默认的快捷键是 `SPC l r`。按下后, +会在屏幕下方打开一个插件窗口,运行的结果会被展示在窗口内。于此同时,光标并不会跳到该插件窗口,避免影响编辑。在这里需要说明下, +这一功能是根据当前文件的路径调用相对应的 `coffee` 命令。因此,在执行这个快捷键之前,应当先保存一下该文件。 + +![jsrunner](https://user-images.githubusercontent.com/13142418/51972835-4cf12d00-24b7-11e9-9693-5e1eea9853b0.png) + +### 代码格式化 + +JavaScript 代码格式化,主要依赖 `format` 模块,同时需要安装相关的后台命令 `js-beautify`: + +```toml +[[layers]] + name = "format" +``` + +安装 `js-beautify`: + +```sh +npm install -g js-beautify +``` + +### 交互式编程 + +在编辑 JavaScript 文件时,可通过快捷键 `SPC l s i` 启动 `node -i` 交互窗口,之后使用快捷键将代码发送至解释器。默认快捷键都以 `SPC l s` 为前缀。 + +![jsrepl](https://user-images.githubusercontent.com/13142418/51974494-00a7ec00-24bb-11e9-8e98-c449a7a067c3.png) + diff --git a/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md b/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md new file mode 100644 index 000000000..d4d39c5da --- /dev/null +++ b/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md @@ -0,0 +1,98 @@ +--- +title: "Use Vim as a JavaScript IDE" +categories: [tutorials, blog] +image: https://user-images.githubusercontent.com/13142418/51976034-add03380-24be-11e9-84b5-245432e7f933.png +excerpt: "A general guide for using SpaceVim as JavaScript IDE, including layer configuration, requiems installation and usage." +type: BlogPosting +comments: true +commentsID: "Use Vim as a JavaScript IDE" +--- + +# [Blogs](../blog/) >> Use Vim as a JavaScript IDE + +This is a general guide for using SpaceVim as a JavaScript IDE, including layer configuration and usage. +Each of the following sections will be covered: + + + +- [Enable language layer](#enable-language-layer) +- [Code completion](#code-completion) +- [Syntax linting](#syntax-linting) +- [Jump to test file](#jump-to-test-file) +- [running code](#running-code) +- [Code formatting](#code-formatting) +- [REPL support](#repl-support) + + + +### Enable language layer + +By default `lang#javascript` layer is not loaded. To add JavaScript language support in SpaceVim, +you need to enable the `lang#javascript` layer. Press `SPC f v d` to open +SpaceVim configuration file, and add following configuration: + +```toml +[[layers]] + name = "lang#javascript" +``` + +for more info, you can read the [lang#javascript](../layers/lang/javascript/) layer documentation. + +### Code completion + +`lang#javascript` layer will load the javascript plugins automatically, unless overriden in your `init.toml`. +The completion menu will be opened as you type. + +![jside](https://user-images.githubusercontent.com/13142418/51976034-add03380-24be-11e9-84b5-245432e7f933.png) + +### Syntax linting + +The checkers layer is enabled by default. This layer provides asynchronous syntax linting via [neomake](https://github.com/neomake/neomake). +It will run [eslint](https://eslint.org/) asynchronously. + +To install eslint, just run following command in terminal. + +```sh +npm install -g eslint +``` + +![eslint](https://user-images.githubusercontent.com/13142418/51972203-dbfd4580-24b5-11e9-9bbd-2a88e6f656f6.png) + +### Jump to test file + +SpaceVim use built-in plugin to manager the files in a project, +you can add a `.project_alt.json` to the root of your project with following content: + +```json +{ + "src/*.js": {"alternate": "test/{}.js"}, + "test/*.js": {"alternate": "src/{}.js"} +} +``` + +with this configuration, you can jump between the source code and test file via command `:A`. + +### running code + +To run current script, you can press `SPC l r`, and a split windows +will be openen, the output of the script will be shown in this windows. +It is running asynchronously, and will not block your vim. + +![jsrunner](https://user-images.githubusercontent.com/13142418/51972835-4cf12d00-24b7-11e9-9693-5e1eea9853b0.png) + +### Code formatting + +The format layer is also enabled by default, with this layer you can use key binding `SPC b f` to format current buffer. +Before using this feature, please install js-beautify. + +```sh +npm install -g js-beautify +``` + +### REPL support + +Start a `node -i` inferior REPL process with `SPC l s i`. After the REPL process has been started. you can +send code to inferior process, all key bindings are begin with `SPC l s` prefix, including sending line, sending selection or even +send whole buffer. + +![jsrepl](https://user-images.githubusercontent.com/13142418/51974494-00a7ec00-24bb-11e9-8e98-c449a7a067c3.png) diff --git a/docs/cn/layers/lang/javascript.md b/docs/cn/layers/lang/javascript.md index 02576a514..6ac4d968a 100644 --- a/docs/cn/layers/lang/javascript.md +++ b/docs/cn/layers/lang/javascript.md @@ -15,6 +15,7 @@ lang: cn - [快捷键](#快捷键) - [导包相关快捷键](#导包相关快捷键) - [常规快捷键](#常规快捷键) + - [交互式编程](#交互式编程) @@ -71,3 +72,15 @@ lang: cn | 模式 | 快捷键 | 按键描述 | | ------ | ----------- | ---------- | | normal | `SPC l g d` | 生成 JSDoc | + +### 交互式编程 + +启动 `node -i` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | diff --git a/docs/layers/lang/javascript.md b/docs/layers/lang/javascript.md index 88f3f0c53..f7b690d46 100644 --- a/docs/layers/lang/javascript.md +++ b/docs/layers/lang/javascript.md @@ -14,6 +14,7 @@ description: "This layer is for JaveScript development" - [Key bindings](#key-bindings) - [Import key bindings](#import-key-bindings) - [Generate key bindings](#generate-key-bindings) + - [Inferior REPL process](#inferior-repl-process) @@ -70,3 +71,16 @@ enable_flow_syntax = true | Mode | Key Binding | Description | | ------------- | ----------- | ------------------------------------- | | normal | `SPC l g d` | Generate JSDoc | + +### Inferior REPL process + +Start a `node -i` inferior REPL process with `SPC l s i`. + +Send code to inferior process commands: + +| Key Binding | Description | +| ----------- | ------------------------------------------------ | +| `SPC l s b` | send buffer and keep code buffer focused | +| `SPC l s l` | send line and keep code buffer focused | +| `SPC l s s` | send selection text and keep code buffer focused | + From 9f9122a4b3e4669cd7b188fab0d638d342528d88 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Wed, 30 Jan 2019 23:32:09 +0800 Subject: [PATCH 050/179] Use eslint-cli instead of eslint by default --- docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md | 2 +- docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md b/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md index f9b653ead..c911be558 100644 --- a/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md +++ b/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md @@ -57,7 +57,7 @@ SpaceVim 初次安装时默认并未启用 JavaScript 相关语言模块。首 可通过以下命令安装: ```sh -npm install -g eslint +npm install -g eslint-cli ``` ![eslint](https://user-images.githubusercontent.com/13142418/51972203-dbfd4580-24b5-11e9-9bbd-2a88e6f656f6.png) diff --git a/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md b/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md index d4d39c5da..f7c01274f 100644 --- a/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md +++ b/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md @@ -53,7 +53,7 @@ It will run [eslint](https://eslint.org/) asynchronously. To install eslint, just run following command in terminal. ```sh -npm install -g eslint +npm install -g eslint-cli ``` ![eslint](https://user-images.githubusercontent.com/13142418/51972203-dbfd4580-24b5-11e9-9bbd-2a88e6f656f6.png) From b8ac6d1b3172f0d8e0eff78e4e00714817021220 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 1 Feb 2019 00:00:16 +0800 Subject: [PATCH 051/179] Add stdin support in runner (#2535) * Add stdin support in runner * Add stdin support for javascript --- autoload/SpaceVim/api/job.vim | 11 +++++++++++ autoload/SpaceVim/layers/lang/javascript.vim | 6 +++++- autoload/SpaceVim/plugins/runner.vim | 19 ++++++++++++++++--- .../2019-01-27-use-vim-as-a-javascript-ide.md | 2 +- .../2019-01-30-use-vim-as-a-javascript-ide.md | 4 ++-- docs/layers/lang/javascript.md | 6 ++++++ docs/layers/lang/lua.md | 2 +- 7 files changed, 42 insertions(+), 8 deletions(-) diff --git a/autoload/SpaceVim/api/job.vim b/autoload/SpaceVim/api/job.vim index d7a98be25..872acf3cf 100644 --- a/autoload/SpaceVim/api/job.vim +++ b/autoload/SpaceVim/api/job.vim @@ -272,6 +272,17 @@ function! s:self.info(id) abort endif endfunction +function! s:self.chanclose(id, type) abort + if self.nvim_job + call chanclose(a:id, a:type) + elseif self.vim_job + if has_key(self.jobs, a:id) && a:type ==# 'stdin' + call ch_close_in(get(self.jobs, a:id)) + endif + endif +endfunction + + function! s:self.debug() abort echo join(self._message, "\n") endfunction diff --git a/autoload/SpaceVim/layers/lang/javascript.vim b/autoload/SpaceVim/layers/lang/javascript.vim index ad61a2360..cfbf8cb0a 100644 --- a/autoload/SpaceVim/layers/lang/javascript.vim +++ b/autoload/SpaceVim/layers/lang/javascript.vim @@ -51,7 +51,11 @@ function! SpaceVim#layers#lang#javascript#config() abort call add(g:spacevim_project_rooter_patterns, 'package.json') - call SpaceVim#plugins#runner#reg_runner('javascript', 'node %s') + call SpaceVim#plugins#runner#reg_runner('javascript', { + \ 'exe' : 'node', + \ 'usestdin' : 1, + \ 'opt': ['-'], + \ }) call SpaceVim#mapping#space#regesit_lang_mappings('javascript', \ function('s:on_ft')) diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index 82fd15479..428ce335b 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -72,10 +72,19 @@ function! s:async_run(runner) abort \ 'on_exit' : function('s:on_compile_exit'), \ }) elseif type(a:runner) == type({}) - let exe = call(a:runner.exe, []) - let cmd = exe + a:runner.opt + [get(s:, 'selected_file', bufname('%'))] + if type(a:runner.exe) == 2 + let exe = call(a:runner.exe, []) + elseif type(a:runner.exe) ==# type('') + let exe = [a:runner.exe] + endif + let usestdin = get(a:runner, 'usestdin', 0) + if usestdin + let cmd = exe + a:runner.opt + else + let cmd = exe + a:runner.opt + [get(s:, 'selected_file', bufname('%'))] + endif call SpaceVim#logger#info(' cmd:' . string(cmd)) - call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[Running] ' . join(cmd), '', repeat('-', 20)]) + call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[Running] ' . join(cmd) . (usestdin ? ' STDIN' : ''), '', repeat('-', 20)]) let s:lines += 3 let s:start_time = reltime() let s:job_id = s:JOB.start(cmd,{ @@ -83,6 +92,10 @@ function! s:async_run(runner) abort \ 'on_stderr' : function('s:on_stderr'), \ 'on_exit' : function('s:on_exit'), \ }) + if usestdin + call s:JOB.send(s:job_id, getline(1, '$')) + call s:JOB.chanclose(s:job_id, 'stdin') + endif endif endfunction diff --git a/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md b/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md index c911be558..21fff8a42 100644 --- a/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md +++ b/docs/_posts/2019-01-27-use-vim-as-a-javascript-ide.md @@ -80,7 +80,7 @@ SpaceVim 自带工程管理插件,可以识别项目根目录,自动跳转al 在编辑 JavaScript 文件时,可以快速运行当前文件,这个功能有点类似于 vscode 的 code runner 插件,默认的快捷键是 `SPC l r`。按下后, 会在屏幕下方打开一个插件窗口,运行的结果会被展示在窗口内。于此同时,光标并不会跳到该插件窗口,避免影响编辑。在这里需要说明下, -这一功能是根据当前文件的路径调用相对应的 `coffee` 命令。因此,在执行这个快捷键之前,应当先保存一下该文件。 +这一功能是根据当前缓存器调用相对应的 `node` 命令,无需保存文件。 ![jsrunner](https://user-images.githubusercontent.com/13142418/51972835-4cf12d00-24b7-11e9-9693-5e1eea9853b0.png) diff --git a/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md b/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md index f7c01274f..5910ea5d0 100644 --- a/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md +++ b/docs/_posts/2019-01-30-use-vim-as-a-javascript-ide.md @@ -74,8 +74,8 @@ with this configuration, you can jump between the source code and test file via ### running code -To run current script, you can press `SPC l r`, and a split windows -will be openen, the output of the script will be shown in this windows. +To run code in current buffer, you can press `SPC l r`, and a split windows +will be openen, the output will be shown in this windows. It is running asynchronously, and will not block your vim. ![jsrunner](https://user-images.githubusercontent.com/13142418/51972835-4cf12d00-24b7-11e9-9693-5e1eea9853b0.png) diff --git a/docs/layers/lang/javascript.md b/docs/layers/lang/javascript.md index f7b690d46..91f7f628d 100644 --- a/docs/layers/lang/javascript.md +++ b/docs/layers/lang/javascript.md @@ -14,6 +14,7 @@ description: "This layer is for JaveScript development" - [Key bindings](#key-bindings) - [Import key bindings](#import-key-bindings) - [Generate key bindings](#generate-key-bindings) + - [Code runner](#code-runner) - [Inferior REPL process](#inferior-repl-process) @@ -72,6 +73,11 @@ enable_flow_syntax = true | ------------- | ----------- | ------------------------------------- | | normal | `SPC l g d` | Generate JSDoc | +### Code runner + +To run javascript code in current buffer, you can press `SPC l r`. It will run without loss focus, +and the result will be shown in a runner buffer. + ### Inferior REPL process Start a `node -i` inferior REPL process with `SPC l s i`. diff --git a/docs/layers/lang/lua.md b/docs/layers/lang/lua.md index ade69879a..1dfa0161f 100644 --- a/docs/layers/lang/lua.md +++ b/docs/layers/lang/lua.md @@ -62,4 +62,4 @@ Send code to inferior process commands: ### Running current script -To running a ruby script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. +To running a lua script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. From 9fef8fa74dae5a2bbd96c12fcfcce6f99e7b425e Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Fri, 1 Feb 2019 10:18:26 +0800 Subject: [PATCH 052/179] Update docs (#2540) * Doc: update docs. * Doc: update documentations. --- docs/cn/conventions.md | 121 ++++++++++++++++++++++------------------- docs/conventions.md | 68 ++++++++++++----------- 2 files changed, 99 insertions(+), 90 deletions(-) diff --git a/docs/cn/conventions.md b/docs/cn/conventions.md index 034baca7f..63bfac80b 100644 --- a/docs/cn/conventions.md +++ b/docs/cn/conventions.md @@ -33,8 +33,9 @@ lang: cn - [空白行](#空白行) - [连续行](#连续行) - [命名](#命名) -- [markdown 代码规范](#markdown-代码规范) -- [感谢:](#感谢) +- [按键表示](#按键表示) +- [Vimscript 代码规范](#vimscript-代码规范) +- [Markdown 代码规范](#markdown-代码规范) @@ -60,7 +61,7 @@ Vim 具有高度可定制性。用户可以更改很多的默认设置,包括 双引号字符串在 Vim 和脚本中的语义跟其它语言中不一样,你可能并不需要它们(它们打破了正则表达式)。 -当你需要转义时使用双引号(例如 "\\n") 或者你需要嵌入单引号,例如 "Abce'a'" 。 +当你需要转义时使用双引号(例如`\\n`) 或者你需要嵌入单引号,例如"Abce'a'"。 #### 匹配字符串 @@ -73,33 +74,34 @@ Vim 具有高度可定制性。用户可以更改很多的默认设置,包括 **所有的正则表达前缀都是 \\m, \\v, \\M, 或 \\V 其中之一** -在传统的大小写语义设置下,正则表达式的行为取决于用户的无魔法(nomagic)设置。为了让正则表达式的行为像无魔法(nomagic)和不忽略大小写(noignorecase)设置下一样,在所有正则表达式前都必须有前缀,前缀是 \\m, \\v, \\M, 或 \\V 其中之一。 +在传统的大小写语义设置下,正则表达式的行为取决于用户的无魔法(nomagic)设置。 +为了让正则表达式的行为像无魔法(nomagic)和不忽略大小写(noignorecase)设置下一样,在所有正则表达式前都必须有前缀,前缀是`\\m`,`\\v`,`\\M`, 或`\\V`其中之一。 -欢迎你使用其它等级的魔法(magic levels)(\\v) 和大小写敏感性(\\c) 只要确定了它们是你有意为之并且是明确的。 +欢迎你使用其它等级的魔法(magic levels)`\\v` 和大小写敏感性`\\c`,只要确定了它们是你有意为之并且是明确的。 #### 危险命令 **避免命令意想不到的副作用** -避免使用 `:s[ubstitute]` 因为它会移动光标并打印错误消息。函数(例如 search())更适用于脚本。 +避免使用`:s[ubstitute]`因为它会移动光标并打印错误消息。函数(例如search())更适用于脚本。 -这意味着 g 标志取决于上层中 gdefault 的设置。如果你用了 `:substitute` 你必须要保存 gdefault, 把它设置为 0 或 1,预先生成替换并且在操作完成后还原它。 -For many Vim commands, functions exist that do the same thing with fewer side effects. See `:help functions()` for a list of built-in functions. -有很多内置的 Vim 命令、函数,可以在更小的影响下完成同样的事情。查看 `:help functions` 查看内置的函数表。 +这意味着`g`标志取决于上层中 gdefault 的设置。如果你用了`:substitute`你必须要保存 gdefault, 把它设置为 0 或 1,预先生成替换并且在操作完成后还原它。 + +有很多内置的函数可以代替Vim 命令在影响更小的情况下完成同样的事情。查看`:help functions`查看内置的函数表。 #### 脆弱命令 **避免依赖于用户设置的命令** -一直使用普通模式(normal) 在普通模式下安装。后者取决于用户的按键映射,可以做任何事情。 +总是使用`normal!`在替代`normal`。后者取决于用户的按键映射,可以做任何事情。 -避免 `:s[ubstitute]`,因为它的行为取决于上层的一些运行设置。 +避免`:s[ubstitute]`,因为它的行为取决于上层的一些运行设置。 其它同样的命令的应用,在此不再列出。 #### 捕获异常 -**匹配异常代码,而非异常文本** +**匹配错误代码,而非错误文本** 错误文本可能与语言环境(local dependant)有关。 @@ -120,11 +122,11 @@ For many Vim commands, functions exist that do the same thing with fewer side ef Vim 脚本在处理一些类型(style)时有不安全,不直观的行为。举个例子:`0 == 'foo'` 认证为真(evalutaes to true)。 -尽可能的用严格的比较操作。当二次比较字母的时候用 is# 操作符。除此之外,更适合用 maktaba#value#IsEqual 或明确使用 check htype()。 +尽可能的用严格的比较操作。当二次比较字母的时候用`is#`操作符。除此之外,更适合用 maktaba#value#IsEqual 或明确使用 check htype()。 在使用变量前,明确检查变量的类型。使用 maktaba#ensure 中的函数(functions from maktaba#ensure) 或 check maktaba#value 或 type() 找出你自己的错误。 -使用 `:unlet` 对变量使用(:unlet)可能更改变量的类型,尤其是在循环中赋值的时候。 +对变量使用`:unlet`可能更改变量的类型,尤其是在循环中赋值的时候。 #### Python @@ -142,7 +144,8 @@ Vim 脚本在处理一些类型(style)时有不安全,不直观的行为。举 **将功能组织到模块化插件中** -把你的功能组织成为一个插件,统一放在一个文件夹中(或者是代码仓库)分享你的插件名(用一个 "vim-" 前缀或者需要的话使用 ".vim" 后缀)。它应该可以被拆分到 plugin/, autoload/, 等等。子目录应该以 addon-info.json 格式声明元数据(详情参见 Vim 文档)。 +把你的功能组织成为一个插件,统一放在一个文件夹中(或者是代码仓库)分享你的插件名(用一个 "vim-" 前缀或者需要的话使用 ".vim" 后缀)。 +它应该可以被拆分到 plugin/, autoload/, 等等。子目录应该以 addon-info.json 格式声明元数据(详情参见 Vim 文档)。 #### 功能 @@ -150,9 +153,9 @@ Vim 脚本在处理一些类型(style)时有不安全,不直观的行为。举 自动加载允许按需加载函数,这使得启动时间更快,并且强制执行函数命名空间(namespacing)。 -脚本本地函数(Script-local functions)是被欢迎的,但是只应存活在 atuoload/ 和被自动运行函数调用中。 +脚本本地函数(Script-local functions)是被欢迎的,但是只应存活在`atuoload/`中并且能够被自动运行函数调用。 -非库函数(Non-library) 插件应该提供命令来代替函数。命令逻辑应该被提取到功能和自动加载。 +非库函数(Non-library)插件应该提供命令来代替函数。命令逻辑应该被提取到功能和 `autoload/`。 [!] 允许开发者无需申诉(complaint)便可重新加载它们的功能。 @@ -170,17 +173,17 @@ Excluding [!] prevents your plugin from silently clobbering existing commands. C **在 plugin/autocmds.vim 中用参数组(augroups) 替换它们** -把所有的自动命令(autocommands)替换进参数组(augroups)。 +把所有的自动命令(autocommands)放进参数组(augroups)。 每个参数组都应当有一个独特的名字。或许你应该给它加上插件名前缀。 -在定义一个新的自动命令(autocommands)前,用 autocmd! 清除参数组(augroup)。这可以让你的插件复用(re-entrable)。 +在定义一个新的自动命令(autocommands)前,用`autocmd!`清除参数组(augroup)。这可以让你的插件复用(re-entrable)。 #### 映射 **在 plugin/mappings.vim 中用 maktaba#plugin#MapPrefix 获取前缀** -所有的按键映射都应当在 plugin/mappings.vim 中被定义。 +所有的按键映射都应当在`plugin/mappings.vim`中被定义。 练习映射(参看`:help using-`)应当在 plugin/plugs.vim 中被定义。 @@ -196,7 +199,7 @@ Excluding [!] prevents your plugin from silently clobbering existing commands. C **在本地更改设置** -用 `:setlocal` 和 &l: 替代 `:set` 和 & 除非你有明确的原因不去使用它们。 +用`:setlocal`和`&l:`替代`:set`和`&`,除非你有明确的原因不去使用它们。 ### 风格 @@ -217,7 +220,7 @@ let s:variable = "concatenated " . "strings" command -range=% MyCommand ``` -- 不要在空白行处留下空白字符 +- 不要在行尾留下空白字符 你无需用自己的方法去清除它。 @@ -258,46 +261,50 @@ autocommand BufEnter \|endif ``` -- 你应该尽量避免使用多行命令,可以用函数调用来替代它 +- 应当尽量避免使用多行命令,可以用函数调用来替代它 #### 命名 -总的来说,使用 -- 像这样的插件名 `plugin-names-like-this` -- 像这样的函数名 `FunctionNamesLikeThis` -- 像这样的命令名 `CommandNamesLikeThis` -- 像这样的参数组 `augroup_names_like_this` -- 像这样的变量名 `variable_names_like_this` -- 像这样的提示 `hints-like-this` +- 保持简单易于理解 -总是在变量名前加上它们的范围前缀 -- `plugin-names-like-this` - 保持简单易于理解 -- `FunctionNamesLikeThis` - - 本地脚本函数的前缀为`s:` - - 自动运行函数(autoload functions)可以没有范围前缀。 - - 不要编写(creat)全局函数。用自动运行函数(autoloaded functions)来替代全局函数。 -- `CommandNamesLikeThis` - 通用命令优先于一般的前缀 -- `variable_names_like_this` - Augroup names count as variables for naming purposes. - 参数组(augroup)名字计数作为变量的命名方向。 +- 总的来说,使用 + - 像这样的插件名 `plugin-names-like-this` + - 像这样的函数名 `FunctionNamesLikeThis` + - 像这样的命令名 `CommandNamesLikeThis` + - 像这样的参数组 `augroup_names_like_this` + - 像这样的变量名 `variable_names_like_this` + - 像这样的提示 `hints-like-this` + +- 不要编写(create)全局函数,用自动运行函数(autoloaded functions)来替代全局函数。 +- 通用命令优先于一般的前缀 +- 参数组(augroup)名字像变量一样命名。(Augroup names count as variables for naming purposes.) - 所有的变量据需要加上它们的范围前缀。 - - 全局变量的前缀为`g:` - - 本地脚本变量的前缀为`s:` - - 函数的参数前缀为`a:` - - 本地函数的变量前缀为`l:` - - Vim 预定义(Vim-predefinded)变量前缀为`v:` - - 本地缓冲区(Buffer-local)变量的前缀为`b:` - - `g:`, `s:`, 和 `a:` 前缀必须使用 - - `b:` 当你想要改变本地缓冲区(buffer-local)的变量的语义时前缀为 `b:` - - `l:` and `v:` should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. + - 全局变量的前缀为`g:` + - 本地脚本变量的前缀为`s:` + - 函数的参数前缀为`a:` + - 本地函数的变量前缀为`l:` + - Vim 预定义(Vim-predefinded)变量前缀为`v:` + - 本地缓冲区(Buffer-local)变量的前缀为`b:` + - `g:`,`s:`,和`a:`前缀必须使用 + - `b:`当你想要改变本地缓冲区(buffer-local)的变量的语义时前缀为`b:` + - `l:`and`v:`should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. + - 自动运行函数(autoloaded functions)可以没有范围前缀。 -## markdown 代码规范 +## 按键表示 -## 感谢: +- 使用首字母大写的单词和尖括号来表示按键:``, ``。 +- 使用大写字母来表示custom leader:`SPC`, `WIN`, `UNITE`, `DENITE`。 +- 使用空格来分隔按键序列:`SPC t w`, ` f o`. +- 使用`/` 来分隔多个可选的按键序列:`` / ``. +- 在文档中使用`Ctrl-e`而不是``。 + +## Vimscript 代码规范 + +- [Google Vimscript Style Guide](https://google.github.io/styleguide/vimscriptguide.xml) +- [Google Vimscript Guide](https://google.github.io/styleguide/vimscriptfull.xml) +- [Vim Scripting Style Guide](https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt) + +## Markdown 代码规范 + +- [Google's Markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md) -- link: -- link: -- link: -- [google's markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md) diff --git a/docs/conventions.md b/docs/conventions.md index 1dfd1461a..5b7fc05af 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -1,5 +1,5 @@ --- -title: "Conventions" +title: "Conventions" description: "conventions of contributing to SpaceVim, including the coding style guides about vim script and markdown" --- @@ -33,7 +33,8 @@ description: "conventions of contributing to SpaceVim, including the coding styl - [Line Continuations](#line-continuations) - [Naming](#naming) - [Key notations](#key-notations) -- [Thanks:](#thanks) +- [Vimscript Style](#vimscript-style) +- [Markdown Style](#markdown-style) @@ -140,7 +141,7 @@ Avoid using other scripting languages such as ruby and lua. We cannot guarantee **Organize functionality into modular plugins** -Group your functionality as a plugin, unified in one directory (or code repository) which shares your plugin's name (with a "vim-" prefix or ".vim" suffix if desired). It should be split into plugin/, autoload/, etc. subdirectories as necessary, and it should declare metadata in the addon-info.json format (see the VAM documentation for details). +Group your functionality as a plugin, unified in one directory (or code repository) which shares your plugin's name (with a "vim-" prefix or ".vim" suffix if desired). It should be split into plugin/, autoload/, etc. subdirectories as necessary, and it should declare metadata in the addon-info.json format (see the Vim documentation for details). #### Functions @@ -188,7 +189,7 @@ Your plugins generally shouldn't introduce mappings, but if they do, the map com #### Errors -When using catch, match the error code rather than the error text. +When using catch, match the error codes rather than the error text. #### Settings @@ -221,7 +222,7 @@ Trailing whitespace is allowed in mappings which prep commands for user input, such as "noremap gf :grep -f ". - Restrict lines to 80 columns wide -- Indent continued lines by four spaces +- Indent continued lines by two spaces - Do not align arguments of commands ```diff @@ -259,31 +260,28 @@ autocommand BufEnter #### Naming -In general, use `plugin-names-like-this`, `FunctionNamesLikeThis`, -`CommandNamesLikeThis`, `augroup_names_like_this`, `variable_names_like_this`. +- Keep them short and sweet. +- In general, use + - `plugin-names-like-this` + - `FunctionNamesLikeThis` + - `CommandNamesLikeThis` + - `augroup_names_like_this` + - `variable_names_like_this` -Always prefix variables with their scope. - -- `plugin-names-like-this` - Keep them short and sweet. -- `FunctionNamesLikeThis` - - Prefix script-local functions with s: - - Autoloaded functions may not have a scope prefix. - - Do not create global functions. Use autoloaded functions instead. -- `CommandNamesLikeThis` - Prefer succinct command names over common command prefixes. -- `variable_names_like_this` - Augroup names count as variables for naming purposes. +- Do not create global functions. Use autoloaded functions instead. +- Prefer succinct command names over common command prefixes. +- Augroup names count as variables for naming purposes. - Prefix all variables with their scope. - - Global variables with g: - - Script-local variables with s: - - Function arguments with a: - - Function-local variables with l: - - Vim-predefined variables with v: - - Buffer-local variables with b: - - g:, s:, and a: must always be used. - - b: changes the variable semantics; use it when you want buffer-local semantics. - - l: and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. + - Global variables with g: + - Script-local variables with s: + - Function arguments with a: + - Function-local variables with l: + - Vim-predefined variables with v: + - Buffer-local variables with b: + - g:, s:, and a: must always be used. + - b: changes the variable semantics; use it when you want buffer-local semantics. + - l: and v: should be used for consistency, future proofing, and to avoid subtle bugs. They are not strictly required. Add them in new code but don’t go out of your way to add them elsewhere. + - Autoloaded functions may not have a scope prefix. ## Key notations @@ -293,9 +291,13 @@ Always prefix variables with their scope. - Use `/` for alternative sequences: `` / ``. - Use `Ctrl-e` rather than `` in documentation. -## Thanks: +## Vimscript Style + +- [Google Vimscript Style Guide](https://google.github.io/styleguide/vimscriptguide.xml) +- [Google Vimscript Guide](https://google.github.io/styleguide/vimscriptfull.xml) +- [Vim Scripting Style Guide](https://github.com/noahfrederick/vim-scripting-style-guide/blob/master/doc/scripting-style.txt) + +## Markdown Style + +- [Google's Markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md) -- link : -- link : -- link : -- [google's markdown style guide](https://github.com/google/styleguide/blob/3591b2e540cbcb07423e02d20eee482165776603/docguide/style.md) From 294f723469498da03dfe0b0234fbbddb52c76fa6 Mon Sep 17 00:00:00 2001 From: Jesse Bilsten Date: Thu, 31 Jan 2019 20:37:49 -0800 Subject: [PATCH 053/179] Fixed a typo for "reference" (#2538) --- docs/layers/lang/javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/layers/lang/javascript.md b/docs/layers/lang/javascript.md index 91f7f628d..8867398ca 100644 --- a/docs/layers/lang/javascript.md +++ b/docs/layers/lang/javascript.md @@ -37,7 +37,7 @@ name = "lang#javascript" - auto-completion - syntax checking - goto definition -- refernce finder +- reference finder ## Layer configuration From 8391fa1fa8e0e58f92021388f92c46ee653e4f98 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 1 Feb 2019 20:39:07 +0800 Subject: [PATCH 054/179] Add stdin support for python (#2536) * Add stdin support for python * Remove extra line break in stdout --- autoload/SpaceVim/layers/lang/python.vim | 3 ++- autoload/SpaceVim/plugins/runner.vim | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/python.vim b/autoload/SpaceVim/layers/lang/python.vim index c04f8c155..e70982df4 100644 --- a/autoload/SpaceVim/layers/lang/python.vim +++ b/autoload/SpaceVim/layers/lang/python.vim @@ -53,7 +53,8 @@ function! SpaceVim#layers#lang#python#config() abort call SpaceVim#plugins#runner#reg_runner('python', \ { \ 'exe' : function('s:getexe'), - \ 'opt' : [], + \ 'opt' : ['-'], + \ 'usestdin' : 1, \ }) call SpaceVim#mapping#gd#add('python', function('s:go_to_def')) call SpaceVim#mapping#space#regesit_lang_mappings('python', function('s:language_specified_mappings')) diff --git a/autoload/SpaceVim/plugins/runner.vim b/autoload/SpaceVim/plugins/runner.vim index 428ce335b..15a3bb06b 100644 --- a/autoload/SpaceVim/plugins/runner.vim +++ b/autoload/SpaceVim/plugins/runner.vim @@ -156,6 +156,7 @@ endfunction " @vimlint(EVL103, 1, a:data) " @vimlint(EVL103, 1, a:event) if has('nvim') && exists('*chanclose') + " remoet at the end of each let s:_out_data = [''] function! s:on_stdout(job_id, data, event) abort let s:_out_data[-1] .= a:data[0] @@ -167,6 +168,7 @@ if has('nvim') && exists('*chanclose') let lines = s:_out_data endif if !empty(lines) + let lines = map(lines, "substitute(v:val, ' $', '', 'g')") call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines) endif let s:lines += len(lines) From 5d937770108993871948be57c4944afe57efd701 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 1 Feb 2019 22:01:30 +0800 Subject: [PATCH 055/179] Fix coffee_stdin support (#2543) * Fix coffee_stdin support * Updtae coffeescript post --- autoload/SpaceVim/layers/lang/coffeescript.vim | 11 ++++++++--- .../2019-01-28-use-vim-as-a-coffeescript-ide.md | 9 +++++++++ .../2019-01-29-use-vim-as-a-coffeescript-ide.md | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/autoload/SpaceVim/layers/lang/coffeescript.vim b/autoload/SpaceVim/layers/lang/coffeescript.vim index a05ddcafa..553790de6 100644 --- a/autoload/SpaceVim/layers/lang/coffeescript.vim +++ b/autoload/SpaceVim/layers/lang/coffeescript.vim @@ -6,7 +6,7 @@ " License: GPLv3 "============================================================================= - +let s:SYS = SpaceVim#api#import('system') function! SpaceVim#layers#lang#coffeescript#plugins() abort let plugins = [] @@ -16,8 +16,13 @@ endfunction function! SpaceVim#layers#lang#coffeescript#config() abort - call SpaceVim#plugins#runner#reg_runner('coffee', 'coffee %s') - call SpaceVim#plugins#repl#reg('coffee', 'coffee') + call SpaceVim#plugins#runner#reg_runner('coffee', { + \ 'exe' : 'coffee' . (s:SYS.isWindows ? '.CMD' : ''), + \ 'usestdin' : 1, + \ 'opt': ['-s'], + \ }) + " call SpaceVim#plugins#runner#reg_runner('coffee', 'coffee %s') + call SpaceVim#plugins#repl#reg('coffee', ['coffee' . (s:SYS.isWindows ? '.CMD' : ''), '-i']) call SpaceVim#mapping#space#regesit_lang_mappings('coffee', function('s:language_specified_mappings')) endfunction diff --git a/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md b/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md index ca0601671..16e2787e9 100644 --- a/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md +++ b/docs/_posts/2019-01-28-use-vim-as-a-coffeescript-ide.md @@ -21,6 +21,7 @@ Each of the following sections will be covered: - [Jump to test file](#jump-to-test-file) - [running code](#running-code) - [Code formatting](#code-formatting) +- [REPL support](#repl-support) @@ -90,3 +91,11 @@ Before using this feature, please install coffee-fmt. ```sh npm install -g coffee-fmt ``` + +### REPL support + +Start a `coffee -i` inferior REPL process with `SPC l s i` when edit CoffeeScript file. After the REPL process has been started. you can +send code to inferior process, all key bindings are begin with `SPC l s` prefix, including sending line, sending selection or even +send whole buffer. + +![coffeerepl](https://user-images.githubusercontent.com/13142418/52127084-08f35900-266c-11e9-9efb-92fe8a014f08.png) diff --git a/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md b/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md index 6d7552849..0bf28c87c 100644 --- a/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md +++ b/docs/_posts/2019-01-29-use-vim-as-a-coffeescript-ide.md @@ -24,6 +24,7 @@ SpaceVim 是一个模块化的 Vim IDE,针对 CoffeeScript 这一语言的支 - [工程文件跳转](#工程文件跳转) - [快速运行](#快速运行) - [代码格式化](#代码格式化) +- [交互式编程](#交互式编程) @@ -100,3 +101,10 @@ CoffeeScript 代码格式化,主要依赖 `format` 模块,同时需要安装 ```sh npm install -g coffee-fmt ``` + +### 交互式编程 + +在编辑 CoffeeScript 文件时,可通过快捷键 `SPC l s i` 启动 `coffee -i` 交互窗口,之后使用快捷键将代码发送至解释器。默认快捷键都以 `SPC l s` 为前缀。 +可以发送光标所在行内容,也可以发送选择区域的内容,甚至是整个 buffer 内容。 + +![coffeerepl](https://user-images.githubusercontent.com/13142418/52127084-08f35900-266c-11e9-9efb-92fe8a014f08.png) From c58216441a164ff1569e812cf0e8b0a51cd305de Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Fri, 1 Feb 2019 22:45:24 +0800 Subject: [PATCH 056/179] Use forked gitment --- docs/_layouts/default.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 267e294e8..7c3d88dc3 100644 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -113,7 +113,7 @@ {% if page.comments %}
      - + {% endif %} - + ','nb',line('w0')) let pos2 = search(' Date: Thu, 14 Mar 2019 22:37:13 +0800 Subject: [PATCH 158/179] Remove toggle line number function --- config/functions.vim | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/config/functions.vim b/config/functions.vim index 4095f800e..fb3173f6c 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -11,19 +11,6 @@ function! OnmiConfigForJsp() return "\a." endif endf -function! ToggleNumber() - let s:isThereNumber = &nu - let s:isThereRelativeNumber = &relativenumber - if s:isThereNumber && s:isThereRelativeNumber - set paste! - set nonumber - set norelativenumber - else - set paste! - set number - set relativenumber - endif -endf function! ToggleBG() let s:tbg = &background " Inversion From 2e6064cf14c044a8b21f0164ab35adfa245e08d8 Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Thu, 14 Mar 2019 22:39:54 +0800 Subject: [PATCH 159/179] Remove toggle conceal func --- autoload/SpaceVim/layers/ui.vim | 11 ++++++++++- config/functions.vim | 7 ------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/autoload/SpaceVim/layers/ui.vim b/autoload/SpaceVim/layers/ui.vim index c24f23847..95014c686 100644 --- a/autoload/SpaceVim/layers/ui.vim +++ b/autoload/SpaceVim/layers/ui.vim @@ -55,7 +55,8 @@ function! SpaceVim#layers#ui#config() abort \ 'highlight-long-lines', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'b'], 'call ToggleBG()', \ 'toggle background', 1) - call SpaceVim#mapping#space#def('nnoremap', ['t', 'c'], 'call ToggleConceal()', + call SpaceVim#mapping#space#def('nnoremap', ['t', 'c'], 'call call(' + \ . string(s:_function('s:toggle_conceal')) . ', [])', \ 'toggle conceal', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 't'], 'call SpaceVim#plugins#tabmanager#open()', \ 'Open tabs manager', 1) @@ -272,3 +273,11 @@ function! s:toggle_whitespace() abort call SpaceVim#layers#core#statusline#toggle_section('whitespace') call SpaceVim#layers#core#statusline#toggle_mode('whitespace') endfunction + +func! s:toggle_conceal() + if &conceallevel == 0 + setlocal conceallevel=2 + else + setlocal conceallevel=0 + endif +endf diff --git a/config/functions.vim b/config/functions.vim index fb3173f6c..10529e07d 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -20,13 +20,6 @@ function! ToggleBG() set background=dark endif endfunction -function! ToggleConceal() - if &conceallevel == 0 - setlocal conceallevel=2 - else - setlocal conceallevel=0 - endif -endfunction function! BracketsFunc() let line = getline('.') let col = col('.') From e628e1eebfdfece73b77a5d0ebfd4f6f436a7dc5 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Thu, 14 Mar 2019 23:32:20 +0800 Subject: [PATCH 160/179] Change plugin list key binding (#2665) * Change plugin list key binding * Fix doc --- autoload/SpaceVim/layers/denite.vim | 10 +++++ autoload/SpaceVim/layers/unite.vim | 10 +++++ autoload/SpaceVim/mapping/space.vim | 2 +- autoload/zvim/plug.vim | 2 - docs/cn/documentation.md | 57 ++++++++++++++--------------- docs/documentation.md | 1 - 6 files changed, 49 insertions(+), 33 deletions(-) diff --git a/autoload/SpaceVim/layers/denite.vim b/autoload/SpaceVim/layers/denite.vim index a5a571041..476faeeae 100644 --- a/autoload/SpaceVim/layers/denite.vim +++ b/autoload/SpaceVim/layers/denite.vim @@ -250,6 +250,16 @@ function! s:defind_fuzzy_finder() abort \ 'Definition: ' . s:file . ':' . lnum, \ ] \ ] + nnoremap fp :Denite menu:AddedPlugins + let lnum = expand('') + s:unite_lnum - 4 + let g:_spacevim_mappings.f.p = ['Denite menu:AddedPlugins', + \ 'fuzzy find vim packages', + \ [ + \ '[Leader f p] is to fuzzy find vim packages installed in SpaceVim', + \ '', + \ 'Definition: ' . s:file . ':' . lnum, + \ ] + \ ] endfunction function! s:warp_denite(cmd) abort diff --git a/autoload/SpaceVim/layers/unite.vim b/autoload/SpaceVim/layers/unite.vim index a135a2297..e72e821a6 100644 --- a/autoload/SpaceVim/layers/unite.vim +++ b/autoload/SpaceVim/layers/unite.vim @@ -198,6 +198,16 @@ function! s:defind_fuzzy_finder() abort \ 'Definition: ' . s:file . ':' . lnum, \ ] \ ] + nnoremap fp :Unite menu:AddedPlugins + let lnum = expand('') + s:unite_lnum - 4 + let g:_spacevim_mappings.f.p = ['Unite menu:AddedPlugins', + \ 'fuzzy find vim packages', + \ [ + \ '[Leader f p] is to fuzzy find vim packages installed in SpaceVim', + \ '', + \ 'Definition: ' . s:file . ':' . lnum, + \ ] + \ ] endfunction function! s:run_shell_cmd() abort diff --git a/autoload/SpaceVim/mapping/space.vim b/autoload/SpaceVim/mapping/space.vim index 6bf144530..be4f96476 100644 --- a/autoload/SpaceVim/mapping/space.vim +++ b/autoload/SpaceVim/mapping/space.vim @@ -21,7 +21,7 @@ function! SpaceVim#mapping#space#init() abort let g:_spacevim_mappings_space.j = {'name' : '+Jump/Join/Split'} let g:_spacevim_mappings_space.m = {'name' : '+Major-mode'} let g:_spacevim_mappings_space.w = {'name' : '+Windows'} - let g:_spacevim_mappings_space.p = {'name' : '+Projects'} + let g:_spacevim_mappings_space.p = {'name' : '+Projects/Packages'} let g:_spacevim_mappings_space.h = {'name' : '+Help'} let g:_spacevim_mappings_space.n = {'name' : '+Narrow/Numbers'} let g:_spacevim_mappings_space.q = {'name' : '+Quit'} diff --git a/autoload/zvim/plug.vim b/autoload/zvim/plug.vim index ac9af7973..1070f515b 100644 --- a/autoload/zvim/plug.vim +++ b/autoload/zvim/plug.vim @@ -88,8 +88,6 @@ function! zvim#plug#begin(path) abort \ 'All the Added plugins' \ . ' lp'} let g:unite_source_menu_menus.AddedPlugins.command_candidates = [] - nnoremap lp :Unite -silent - \ -winheight=17 -start-insert menu:AddedPlugins if g:spacevim_plugin_manager ==# 'neobundle' call neobundle#begin(a:path) elseif g:spacevim_plugin_manager ==# 'dein' diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 03ab02e59..19ed3adb7 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -671,40 +671,39 @@ can be get by ` q r` | Key | Mode | Action | | --------------- | --------------------- | ------------------------------------------ | -| ``+`cd` | Normal | Switch to the directory of the open buffer | -| ``+`w` | Normal/Visual | Write (:w) | +| `SPC f s` | Normal/Visual | Write (:w) | | `Ctrl-s` | Normal/Visual/Command | Write (:w) | | `:w!!` | Command | Write as root (%!sudo tee > /dev/null %) | ### Editor UI -| Key | Mode | Action | -| ----------------------------------------------- | ------------- | ---------------------------------------------------------------- | -| `` | _All_ | Toggle tagbar | -| `` | _All_ | Toggle Vimfiler | -| `` + num | Normal | Jump to the buffer with the num index | -| `` + num | Normal | Jump to the buffer with the num index, this only works in Neovim | -| `Alt-h` / `` | Normal | Jump to left buffer in the tabline, this only works in Neovim | -| `Alt-l` / `` | Normal | Jump to Right buffer in the tabline, this only works in Neovim | -| ``+`ts` | Normal | Toggle spell-checker (:setlocal spell!) | -| ``+`tn` | Normal | Toggle line numbers (:setlocal nonumber!) | -| ``+`tl` | Normal | Toggle hidden characters (:setlocal nolist!) | -| ``+`th` | Normal | Toggle highlighted search (:set hlsearch!) | -| ``+`tw` | Normal | Toggle wrap (:setlocal wrap! breakindent!) | -| `g0` | Normal | Go to first tab (:tabfirst) | -| `g$` | Normal | Go to last tab (:tablast) | -| `gr` | Normal | Go to previous tab (:tabprevious) | -| `Ctrl-` | Normal | Move to split below (Ctrl-w j) | -| `Ctrl-` | Normal | Move to upper split (Ctrl-w k) | -| `Ctrl-` | Normal | Move to left split (Ctrl-w h) | -| `Ctrl-` | Normal | Move to right split (Ctrl-w l) | -| `*` | Visual | Search selection forwards | -| `#` | Visual | Search selection backwards | -| `,`` | Normal | Remove all spaces at EOL | -| `Ctrl-r` | Visual | Replace selection | -| ` l j` | Normal | Next on location list | -| ` l k` | Normal | Previous on location list | -| ` S` | Normal/Visual | Source selection | +| Key | Mode | Action | +| ------------------- | ------------- | ---------------------------------------------------------------- | +| `` | _All_ | Toggle tagbar | +| `` | _All_ | Toggle Vimfiler | +| `` + num | Normal | Jump to the buffer with the num index | +| `` + num | Normal | Jump to the buffer with the num index, this only works in Neovim | +| `Alt-h` / `` | Normal | Jump to left buffer in the tabline, this only works in Neovim | +| `Alt-l` / `` | Normal | Jump to Right buffer in the tabline, this only works in Neovim | +| ``+`ts` | Normal | Toggle spell-checker (:setlocal spell!) | +| ``+`tn` | Normal | Toggle line numbers (:setlocal nonumber!) | +| ``+`tl` | Normal | Toggle hidden characters (:setlocal nolist!) | +| ``+`th` | Normal | Toggle highlighted search (:set hlsearch!) | +| ``+`tw` | Normal | Toggle wrap (:setlocal wrap! breakindent!) | +| `g0` | Normal | Go to first tab (:tabfirst) | +| `g$` | Normal | Go to last tab (:tablast) | +| `gr` | Normal | Go to previous tab (:tabprevious) | +| `Ctrl-` | Normal | Move to split below (Ctrl-w j) | +| `Ctrl-` | Normal | Move to upper split (Ctrl-w k) | +| `Ctrl-` | Normal | Move to left split (Ctrl-w h) | +| `Ctrl-` | Normal | Move to right split (Ctrl-w l) | +| `*` | Visual | Search selection forwards | +| `#` | Visual | Search selection backwards | +| `, ` | Normal | Remove all spaces at EOL | +| `Ctrl-r` | Visual | Replace selection | +| ` l j` | Normal | Next on location list | +| ` l k` | Normal | Previous on location list | +| ` S` | Normal/Visual | Source selection | ### Native functions diff --git a/docs/documentation.md b/docs/documentation.md index 08a30fb8a..a851a67b9 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -697,7 +697,6 @@ can be get by ` q r`, if you want to disable this feature, you can use ` | Key Bindings | Descriptions | | -------------- | ------------------------------------------ | -| ` c d` | Switch to the directory of the open buffer | | `SPC f s` | Write (:w) | | `Ctrl-s` | Write (:w) | | `SPC f W` | Write as root (need sudo layer) | From 3271359bd0d9f574979b7685fcc26674ab5b19ef Mon Sep 17 00:00:00 2001 From: Seungdols Date: Fri, 15 Mar 2019 23:04:21 +0900 Subject: [PATCH 161/179] Fix typo of methon (#2668) --- autoload/SpaceVim/layers/core/statusline.vim | 2 +- autoload/SpaceVim/layers/lang/java.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index c9bb07dd4..5a9b17385 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -601,7 +601,7 @@ function! SpaceVim#layers#core#statusline#config() abort call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'd'], 'call SpaceVim#layers#core#statusline#toggle_section("date")', \ 'toggle the date', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'i'], 'call SpaceVim#layers#core#statusline#toggle_section("input method")', - \ 'toggle the input methon', 1) + \ 'toggle the input method', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 't'], 'call SpaceVim#layers#core#statusline#toggle_section("time")', \ 'toggle the time', 1) call SpaceVim#mapping#space#def('nnoremap', ['t', 'm', 'p'], 'call SpaceVim#layers#core#statusline#toggle_section("cursorpos")', diff --git a/autoload/SpaceVim/layers/lang/java.vim b/autoload/SpaceVim/layers/lang/java.vim index dd9b021ae..f4f1cb41c 100644 --- a/autoload/SpaceVim/layers/lang/java.vim +++ b/autoload/SpaceVim/layers/lang/java.vim @@ -191,7 +191,7 @@ function! s:language_specified_mappings() abort " execute let g:_spacevim_mappings_space.l.r = {'name' : '+Run'} - " run main methon + " run main method call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'm'], 'JavaUnitTestMain', 'Run main method', 1) call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'c'], 'JavaUnitExec', 'Run current method', 1) call SpaceVim#mapping#space#langSPC('nmap', ['l','r', 'a'], 'JavaUnitTestAll', 'Run all test methods', 1) From 7539f3e10d0c1f8a25bbeb08c4b075582cc38105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E6=96=87=E5=BC=BA?= Date: Sun, 17 Mar 2019 08:14:22 +0800 Subject: [PATCH 162/179] fix typo (#2673) --- docs/cn/layers/gtags.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cn/layers/gtags.md b/docs/cn/layers/gtags.md index a3d115bf6..2e858cc62 100644 --- a/docs/cn/layers/gtags.md +++ b/docs/cn/layers/gtags.md @@ -119,7 +119,7 @@ echo export GTAGSLABEL=pygments >> .profile 在使用 gtags 之前,建议先新建 GTAGS 数据库,可通过如下两种方式新建数据库: - 在 SpaceVim 内,使用快捷键 `SPC m g c` 来新建 GTAGS 数据库, - 如果 GUN Global 不能直接支持当墙语言,可以选择 ctags 或者 pygments 作为生成数据库的后台工具。 + 如果 GUN Global 不能直接支持当前语言,可以选择 ctags 或者 pygments 作为生成数据库的后台工具。 - 在命令行,可以直接在项目根目录执行 gtags 命令。 ```sh From 37e616900837728aea2295f343a1146c3fc1d1a2 Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 17 Mar 2019 20:35:21 +0800 Subject: [PATCH 163/179] Change windows key binding and improve doc (#2674) --- autoload/SpaceVim/layers/tools.vim | 23 ++- autoload/SpaceVim/mapping/leader.vim | 35 ++-- config/plugins/neosnippet.vim | 5 - docs/cn/documentation.md | 211 ++++++++++++---------- docs/cn/quick-start-guide.md | 43 ++--- docs/conventions.md | 2 +- docs/documentation.md | 253 ++++++++++++++------------- 7 files changed, 307 insertions(+), 265 deletions(-) diff --git a/autoload/SpaceVim/layers/tools.vim b/autoload/SpaceVim/layers/tools.vim index 0032e4d09..33d08db32 100644 --- a/autoload/SpaceVim/layers/tools.vim +++ b/autoload/SpaceVim/layers/tools.vim @@ -20,7 +20,15 @@ function! SpaceVim#layers#tools#plugins() abort call add(plugins, ['itchyny/calendar.vim', { 'on_cmd' : 'Calendar'}]) call add(plugins, ['junegunn/limelight.vim', { 'on_cmd' : 'Limelight'}]) call add(plugins, ['junegunn/goyo.vim', { 'on_cmd' : 'Goyo', 'loadconf' : 1}]) - call add(plugins, ['MattesGroeger/vim-bookmarks', { 'on_map' : 'Bookmark', 'on_cmd' : 'BookmarkShowAll', 'loadconf_before' : 1}]) + call add(plugins, ['MattesGroeger/vim-bookmarks', { 'on_cmd' : + \ [ + \ 'BookmarkShowAll', + \ 'BookmarkToggle', + \ 'BookmarkAnnotate', + \ 'BookmarkNext', + \ 'BookmarkPrev', + \ ], + \ 'loadconf_before' : 1}]) let s:CMP = SpaceVim#api#import('vim#compatible') if s:CMP.has('python') call add(plugins, ['gregsexton/VimCalc', {'on_cmd' : 'Calc'}]) @@ -41,11 +49,13 @@ function! SpaceVim#layers#tools#config() abort \ 'Goyo', 'centered-buffer-mode', 1) call SpaceVim#mapping#space#def('nnoremap', ['w', 'C'], \ 'ChooseWin | Goyo', 'centered-buffer-mode(other windows)', 1) - nmap mm BookmarkToggle - nmap mi BookmarkAnnotate - nmap ma BookmarkShowAll - nmap mn BookmarkNext - nmap mp BookmarkPrev + + " bootmark key binding + nnoremap mm :BookmarkToggle + nnoremap mi :BookmarkAnnotate + nnoremap ma :BookmarkShowAll + nnoremap mn :BookmarkNext + nnoremap mp :BookmarkPrev nnoremap :MundoToggle augroup rainbow_lisp autocmd! @@ -63,7 +73,6 @@ function! SpaceVim#layers#tools#config() abort if maparg('', 'n') ==# '' nnoremap :Ydc endif - noremap :TlistToggle endfunction " vim:set et sw=2 cc=80: diff --git a/autoload/SpaceVim/mapping/leader.vim b/autoload/SpaceVim/mapping/leader.vim index 4be7cb4e6..43e8b17db 100644 --- a/autoload/SpaceVim/mapping/leader.vim +++ b/autoload/SpaceVim/mapping/leader.vim @@ -14,17 +14,6 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ a:key . '"' exe 'nmap ' .a:key . ' [Window]' let g:_spacevim_mappings_windows = {} - nnoremap [Window]p - \ :vsplit:wincmd w - let lnum = expand('') + s:lnum - 4 - let g:_spacevim_mappings_windows.p = ['vsplit | wincmd w', - \ 'vsplit vertically,switch to next window', - \ [ - \ '[WIN p ] is to split windows vertically, switch to the new window', - \ '', - \ 'Definition: ' . s:file . ':' . lnum, - \ ] - \ ] nnoremap [Window]v \ :split let lnum = expand('') + s:lnum - 4 @@ -36,13 +25,35 @@ function! SpaceVim#mapping#leader#defindWindowsLeader(key) abort \ 'Definition: ' . s:file . ':' . lnum, \ ] \ ] + nnoremap [Window]V + \ :split +bp + let lnum = expand('') + s:lnum - 4 + let g:_spacevim_mappings_windows.V = ['split +bp', + \ 'split previous buffer', + \ [ + \ '[WIN V] is to split previous buffer, switch to the new window', + \ '', + \ 'Definition: ' . s:file . ':' . lnum, + \ ] + \ ] nnoremap [Window]g \ :vsplit let lnum = expand('') + s:lnum - 4 let g:_spacevim_mappings_windows.g = ['vsplit', \ 'vsplit window', \ [ - \ '[WIN g] is to split windows vertically, switch to the new window', + \ '[WIN g] is to split previous buffer vertically, switch to the new window', + \ '', + \ 'Definition: ' . s:file . ':' . lnum, + \ ] + \ ] + nnoremap [Window]G + \ :vsplit +bp + let lnum = expand('') + s:lnum - 4 + let g:_spacevim_mappings_windows.G = ['vsplit +bp', + \ 'vsplit previous buffer', + \ [ + \ '[WIN G] is to split windows vertically, switch to the new window', \ '', \ 'Definition: ' . s:file . ':' . lnum, \ ] diff --git a/config/plugins/neosnippet.vim b/config/plugins/neosnippet.vim index ff6b94e37..cb257e095 100644 --- a/config/plugins/neosnippet.vim +++ b/config/plugins/neosnippet.vim @@ -20,15 +20,10 @@ if g:spacevim_force_global_config == 0 endif let g:neosnippet#enable_snipmate_compatibility = \ get(g:, 'neosnippet#enable_snipmate_compatibility', 1) -let g:neosnippet#enable_complete_done = - \ get(g:, 'neosnippet#enable_complete_done', 1) if !exists('g:neosnippet#completed_pairs') let g:neosnippet#completed_pairs = {} endif let g:neosnippet#completed_pairs.java = {'(' : ')'} -if g:neosnippet#enable_complete_done - let g:neopairs#enable = 0 -endif " vim:set et sw=2 cc=80: diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 19ed3adb7..f7267df59 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1,20 +1,21 @@ --- -title: "SpaceVim 中文手册" +title: "使用文档" description: "SpaceVim 是一个社区驱动的模块化 Vim 配置,以模块的方式组织和管理插件,为不同语言开发定制特定的模块,提供语法检查、自动补全、格式化、一键编译运行以及 REPL 和 DEBUG 支持。" redirect_from: "/README_zh_cn/" lang: cn --- -# SpaceVim 使用文档 +# 使用文档 - [核心思想](#核心思想) - [显著特性](#显著特性) - [运行截图](#运行截图) -- [谁将从 SpaceVim 中获益?](#谁将从-spacevim-中获益) -- [更新和回滚](#更新和回滚) - - [SpaceVim 自身更新](#spacevim-自身更新) +- [基本概念](#基本概念) +- [适用人群](#适用人群) +- [更新回滚](#更新回滚) + - [自身更新](#自身更新) - [更新插件](#更新插件) - [获取日志](#获取日志) - [用户配置](#用户配置) @@ -22,19 +23,18 @@ lang: cn - [Vim 兼容模式](#vim-兼容模式) - [私有模块](#私有模块) - [调试上游插件](#调试上游插件) -- [概念](#概念) -- [优雅的界面](#优雅的界面) +- [界面元素](#界面元素) - [颜色主题](#颜色主题) - [字体](#字体) - [界面元素切换](#界面元素切换) - [状态栏](#状态栏) - [标签栏](#标签栏) -- [常规快捷键](#常规快捷键) +- [基本操作](#基本操作) - [窗口管理器](#窗口管理器) - - [File Operations](#file-operations) - - [Editor UI](#editor-ui) - - [Native functions](#native-functions) - - [Bookmarks management](#bookmarks-management) + - [文件操作](#文件操作) + - [编辑器界面](#编辑器界面) + - [原生功能](#原生功能) + - [标签管理](#标签管理) - [Fuzzy finder](#fuzzy-finder) - [交互](#交互) - [快捷键](#快捷键) @@ -90,7 +90,7 @@ lang: cn - [错误处理](#错误处理) - [工程管理](#工程管理) - [在工程中搜索文件](#在工程中搜索文件) -- [EditorConfig](#editorconfig) +- [格式规范](#格式规范) - [Vim 服务器](#vim-服务器) - [Achievements](#achievements) - [issues](#issues) @@ -149,7 +149,17 @@ Neovim 运行在 iTerm2 上,采用 SpaceVim,配色为:_base16-solarized-da 想要查阅更多截图,请阅读 [issue #415](https://github.com/SpaceVim/SpaceVim/issues/415) -## 谁将从 SpaceVim 中获益? +## 基本概念 + +**临时快捷键菜单** + +SpaceVim 根据需要定义了很多临时快捷键,这可以避免需要重复某些操作时过多按下 `SPC` 前缀键。当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口,提示每一临时快捷键的功能。此外一些额外的辅助信息也将会显示出来。 + +文本移动临时快捷键: + +![Move Text Transient State](https://user-images.githubusercontent.com/13142418/28489559-4fbc1930-6ef8-11e7-9d5a-716fe8dbb881.png) + +## 适用人群 - **初级** Vim 用户 - 追求优雅界面的 Vim 用户 @@ -157,9 +167,9 @@ Neovim 运行在 iTerm2 上,采用 SpaceVim,配色为:_base16-solarized-da - 想要学习一种不一样的编辑文件方式的 Vim 用户 - 追求简单但是可高度配置系统的 Vim 用户 -## 更新和回滚 +## 更新回滚 -### SpaceVim 自身更新 +### 自身更新 可通过很多种方式来更新 SpaceVim 的核心文件。建议在更新 SpaceVim 之前,更新一下所有的插件。具体内容如下: @@ -334,17 +344,7 @@ function! myspacevim#before() abort endfunction ``` -## 概念 - -**临时快捷键菜单** - -SpaceVim 根据需要定义了很多临时快捷键,这可以避免需要重复某些操作时过多按下 `SPC` 前缀键。当临时快捷键启用时,会在窗口下方打开一个快捷键介绍窗口,提示每一临时快捷键的功能。此外一些额外的辅助信息也将会显示出来。 - -文本移动临时快捷键: - -![Move Text Transient State](https://user-images.githubusercontent.com/13142418/28489559-4fbc1930-6ef8-11e7-9d5a-716fe8dbb881.png) - -## 优雅的界面 +## 界面元素 SpaceVim 集成了多种实用的 UI 插件,如常用的文件树、语法树等插件,配色主题默认采用的是 gruvbox。 @@ -616,31 +616,34 @@ endfunction | `Ctrl-S-` | 向下移动光标下的标签页 | | `` | 跳至光标所对应的标签窗口 | -## 常规快捷键 +## 基本操作 ### 窗口管理器 -窗口管理器快捷键只可以在 Normal 模式下使用,默认的前缀按键为 `s`,可以在配置文件中通过修改 +窗口管理器快捷键只可以在 Normal 模式下使用,默认的前缀(`WIN`)按键为 `s`,可以在配置文件中通过修改 SpaceVim 选项 `window_leader` 的值来设为其它按键: -| 快捷键 | 功能描述 | -| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `q` | Smart buffer close | -| `s p` | Split nicely | -| `s v` | :split | -| `s g` | :vsplit | -| `s t` | Open new tab (:tabnew) | -| `s o` | Close other windows (:only) | -| `s x` | Remove buffer, leave blank window | -| `s q` | Remove current buffer, left buffer in the tabline will be displayed. If there is no buffer on the left, the right buffer will be displayed; if this is the last buffer in the tabline, then an empty buffer will be displayed. | -| `s Q` | Close current buffer (:close) | -| `` | Next window or tab | -| `Shift-` | Previous window or tab | -| ``+`sv` | Split with previous buffer | -| ``+`sg` | Vertically split with previous buffer | +```toml +[options] + windows_leader = "s" +``` -SpaceVim has mapped normal `q` as smart buffer close, the normal func of `q` -can be get by ` q r` +| 快捷键 | 功能描述 | +| ------------- | ------------------------------------ | +| `q` | 智能关闭当前窗口 | +| `WIN v` | 水平分屏 | +| `WIN V` | 水平分屏,并编辑上一个文件 | +| `WIN g` | 垂直分屏 | +| `WIN G` | 垂直分屏,并编辑上一个文件 | +| `WIN t` | 新建新的标签页 | +| `WIN o` | 关闭其他窗口 | +| `WIN x` | 关闭当前缓冲区,并保留新的空白缓冲区 | +| `WIN q` | 关闭当前缓冲区 | +| `WIN Q` | 关闭当前窗口 | +| `` | 跳至下一个窗口 | +| `Shift-` | 跳至上一个窗口 | + +Normal 模式下的按键 `q` 被用来快速关闭窗口,其原生的功能可以使用 ` q r` 来代替。 | 快捷键 | 模式 | 功能描述 | | ------------------- | ------------- | ------------------------------------------------------------------------------ | @@ -667,64 +670,78 @@ can be get by ` q r` | `Ctrl-b` | Command | Move cursor backward in command line | | `Ctrl-f` | Command | Move cursor forward in command line | -### File Operations +### 文件操作 -| Key | Mode | Action | -| --------------- | --------------------- | ------------------------------------------ | -| `SPC f s` | Normal/Visual | Write (:w) | -| `Ctrl-s` | Normal/Visual/Command | Write (:w) | -| `:w!!` | Command | Write as root (%!sudo tee > /dev/null %) | +| 按键 | 功能描述 | +| -------------------- | ------------------ | +| `SPC f s` / `Ctrl-s` | 保存文件 (:w) | +| `SPC f W` | 使用管理员模式保存 | -### Editor UI +### 编辑器界面 -| Key | Mode | Action | -| ------------------- | ------------- | ---------------------------------------------------------------- | -| `` | _All_ | Toggle tagbar | -| `` | _All_ | Toggle Vimfiler | -| `` + num | Normal | Jump to the buffer with the num index | -| `` + num | Normal | Jump to the buffer with the num index, this only works in Neovim | -| `Alt-h` / `` | Normal | Jump to left buffer in the tabline, this only works in Neovim | -| `Alt-l` / `` | Normal | Jump to Right buffer in the tabline, this only works in Neovim | -| ``+`ts` | Normal | Toggle spell-checker (:setlocal spell!) | -| ``+`tn` | Normal | Toggle line numbers (:setlocal nonumber!) | -| ``+`tl` | Normal | Toggle hidden characters (:setlocal nolist!) | -| ``+`th` | Normal | Toggle highlighted search (:set hlsearch!) | -| ``+`tw` | Normal | Toggle wrap (:setlocal wrap! breakindent!) | -| `g0` | Normal | Go to first tab (:tabfirst) | -| `g$` | Normal | Go to last tab (:tablast) | -| `gr` | Normal | Go to previous tab (:tabprevious) | -| `Ctrl-` | Normal | Move to split below (Ctrl-w j) | -| `Ctrl-` | Normal | Move to upper split (Ctrl-w k) | -| `Ctrl-` | Normal | Move to left split (Ctrl-w h) | -| `Ctrl-` | Normal | Move to right split (Ctrl-w l) | -| `*` | Visual | Search selection forwards | -| `#` | Visual | Search selection backwards | -| `, ` | Normal | Remove all spaces at EOL | -| `Ctrl-r` | Visual | Replace selection | -| ` l j` | Normal | Next on location list | -| ` l k` | Normal | Previous on location list | -| ` S` | Normal/Visual | Source selection | +| 按键 | 功能描述 | +| ------------------- | ---------------------------------------------------------------- | +| `` | Toggle tagbar | +| `` | Toggle Vimfiler | +| `` + num | Jump to the buffer with the num index | +| `` + num | Jump to the buffer with the num index, this only works in Neovim | +| `Alt-h` / `` | Jump to left buffer in the tabline, this only works in Neovim | +| `Alt-l` / `` | Jump to Right buffer in the tabline, this only works in Neovim | +| ` t s` | Toggle spell-checker (:setlocal spell!) | +| ` t n` | Toggle line numbers (:setlocal nonumber!) | +| ` t l` | Toggle hidden characters (:setlocal nolist!) | +| ` t h` | Toggle highlighted search (:set hlsearch!) | +| ` t w` | Toggle wrap (:setlocal wrap! breakindent!) | +| `g 0` | Go to first tab (:tabfirst) | +| `g $` | Go to last tab (:tablast) | +| `g r` | Go to previous tab (:tabprevious) | +| `Ctrl-` | Move to split below (Ctrl-w j) | +| `Ctrl-` | Move to upper split (Ctrl-w k) | +| `Ctrl-` | Move to left split (Ctrl-w h) | +| `Ctrl-` | Move to right split (Ctrl-w l) | +| `*` | Search selection forwards | +| `#` | Search selection backwards | +| `, ` | Remove all spaces at EOL | +| `Ctrl-r` | Replace selection | +| ` l j` | Next on location list | +| ` l k` | Previous on location list | +| ` S` | Source selection | -### Native functions +### 原生功能 -| 快捷键 | 模式 | 功能描述 | -| --------------- | ------ | -------------------------------- | -| ` q r` | Normal | Same as native `q` | -| ` q r/` | Normal | Same as native `q/`, open cmdwin | -| ` q r?` | Normal | Same as native `q?`, open cmdwin | -| ` q r:` | Normal | Same as native `q:`, open cmdwin | +| 快捷键 | 功能描述 | +| --------------- | --------------------------------- | +| ` q r` | 原生 `q` 快捷键 | +| ` q r/` | 原生 `q /` 快捷键,打开命令行窗口 | +| ` q r?` | 原生 `q ?` 快捷键,打开命令行窗口 | +| ` q r:` | 原生 `q :` 快捷键,打开命令行窗口 | -### Bookmarks management +### 标签管理 -| 快捷键 | 模式 | 功能描述 | -| ------- | ------ | ------------------------------- | -| `m`+`a` | Normal | 显示书签列表 | -| `m`+`m` | Normal | Toggle bookmark in current line | -| `m`+`n` | Normal | 跳至下一个书签 | -| `m`+`p` | Normal | 跳至前一个书签 | -| `m`+`i` | Normal | Annotate bookmark | +在浏览代码时,通常需要给指定位置添加标签,方便快速跳转,在 SpaceVim +中可以使用如下快捷键来管理标签。 这一功能需要载入 tools 模块: -As SpaceVim use above bookmarks mappings, so you can not use `a`, `m`, `n`, `p` or `i` registers to mark current position, but other registers should works will. If you really need to use these registers, you can add `nnoremap m m` to your custom configuration, then you use use `a` registers via `\ma` +```toml +[layers] + name = "tools" +``` + +| 快捷键 | 功能描述 | +| ------ | -------------------- | +| `m a` | 显示书签列表 | +| `m m` | 切换当前行标签状态 | +| `m n` | 跳至下一个书签 | +| `m p` | 跳至前一个书签 | +| `m i` | 给当前行标签添加说明 | + +正因为占用了以上几个快捷键,以下几个寄存器无法用来记忆当前位置了:`a`, `m`, `n`, `p`, `i`。 +当然,也可以在启动函数里将 ` m` 映射为 `m` 键,如此便可使用 ` m a` 来代替 `m a`。 + +```viml +function! myspacevim#before() abort + nnoremap m m +endfunction +``` ### Fuzzy finder @@ -1795,7 +1812,7 @@ SpaceVim 中的工程通过 vim-projectionisst 和 vim-rooter 进行管理。当 | `SPC p t` | find project root | | `SPC p p` | 显示所有工程 | -## EditorConfig +## 格式规范 SpaceVim has supported for [EditorConfig](http://editorconfig.org/), a configuration file to "define and maintain consistent coding styles between different editors and IDEs." diff --git a/docs/cn/quick-start-guide.md b/docs/cn/quick-start-guide.md index b1cd1673d..fd21f3bd9 100644 --- a/docs/cn/quick-start-guide.md +++ b/docs/cn/quick-start-guide.md @@ -5,31 +5,31 @@ lang: cn --- -# SpaceVim 入门指南 +# 入门指南 如果你从未使用过 SpaceVim,建议先阅读这篇简短的教程。这篇教程主要讲述: 如何安装 SpaceVim,SpaceVim 的入门配置以及 SpaceVim 常用学习资源。 -- [安装](#安装) +- [安装指南](#安装指南) - [Linux 或 macOS](#linux-或-macos) - [Windows](#windows) -- [在 Docker 中运行](#在-docker-中运行) -- [配置](#配置) -- [学习 SpaceVim](#学习-spacevim) -- [在线指南](#在线指南) +- [Docker 支持](#docker-支持) +- [基本配置](#基本配置) +- [在线教程](#在线教程) +- [其他资源](#其他资源) -### 安装 +## 安装指南 在安装 SpaceVim 之前,你需要确保电脑上已经安装了 `Git` 和 `cURL`。这两个工具用来 下载插件以及字体。 如果在终端中使用 Vim 或 Neovim,还需要设置终端的字体。 -#### Linux 或 macOS +### Linux 或 macOS ```sh curl -sLf https://spacevim.org/cn/install.sh | bash @@ -43,12 +43,12 @@ curl -sLf https://spacevim.org/cn/install.sh | bash curl -sLf https://spacevim.org/cn/install.sh | bash -s -- -h ``` -#### Windows +### Windows Windows 下最快捷的安装方法是下载安装脚本 [install.cmd](https://spacevim.org/cn/install.cmd) 并运行。 -### 在 Docker 中运行 +## Docker 支持 ```sh docker pull spacevim/spacevim @@ -58,11 +58,15 @@ docker run -it --rm spacevim/spacevim nvim 也可以通过挂载的方式载入本地配置: ```sh -docker run -it -v ~/.SpaceVim.d:/home/spacevim/.SpaceVim.d --rm spacevim/spacevim nvim +docker run + \ -it -v + \ ~/.SpaceVim.d:/home/spacevim/.SpaceVim.d + \ --rm + \ spacevim/spacevim nvim ``` -### 配置 +## 基本配置 SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单的配置示例。 如果需要查阅更多 SpaceVim 配置相关的信息,请阅读 SpaceVim 用户文档。 @@ -120,19 +124,12 @@ SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单 merged = false ``` -### 学习 SpaceVim - -- [SpaceVim 用户文档](../documentation/). SpaceVim 官方文档,包含了 SpaceVim 配置及使用的每一个细节,是熟悉和掌握 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 的基本使用教程,侧重于各种语言开发环境的搭建,可以理解为 SpaceVim 用户文档的精简版,主要包括以下内容: - [使用 SpaceVim 搭建基本的开发环境](../use-vim-as-ide/):涵盖一些窗口及文件的常规操作。 - 针对不同语言,一些基础的配置及使用技巧:
        @@ -142,3 +139,9 @@ SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单 {% endfor %}
      + +## 其他资源 + +- [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/conventions.md b/docs/conventions.md index 5b7fc05af..da5a35c73 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -288,7 +288,7 @@ autocommand BufEnter - Use capital case and angle brackets for keyboard buttons: ``, ``. - Use uppercase for custom leader: `SPC`, `WIN`, `UNITE`, `DENITE`. - Use space as delimiter for key sequences: `SPC t w`, ` f o`. -- Use `/` for alternative sequences: `` / ``. +- Use `/` for alternative sequences: `` / `Ctrl-n`. - Use `Ctrl-e` rather than `` in documentation. ## Vimscript Style diff --git a/docs/documentation.md b/docs/documentation.md index a851a67b9..64855bf26 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -3,7 +3,7 @@ title: "Documentation" description: "General documentation about how to using SpaceVim, including the quick start guide and FAQs." --- -# SpaceVim Documentation +# Documentation @@ -649,21 +649,20 @@ can change it via `windows_leader` option: windows_leader = "s" ``` -| Key Bindings | Descriptions | -| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `q` | Smart buffer close | -| `WIN p` | Split nicely | -| `WIN v` | :split | -| `WIN g` | :vsplit | -| `WIN t` | Open new tab (:tabnew) | -| `WIN o` | Close other windows (:only) | -| `WIN x` | Remove buffer, leave blank window | -| `WIN q` | Remove current buffer, left buffer in the tabline will be displayed. If there is no buffer on the left, the right buffer will be displayed; if this is the last buffer in the tabline, then an empty buffer will be displayed. | -| `WIN Q` | Close current buffer (:close) | -| `` | Next window or tab | -| `Shift-Tab` | Previous window or tab | -| ` s v` | Split with previous buffer | -| ` s g` | Vertically split with previous buffer | +| Key Bindings | Descriptions | +| ------------ | ------------------------------------- | +| `q` | Smart buffer close | +| `WIN v` | :split | +| `WIN V` | Split with previous buffer | +| `WIN g` | :vsplit | +| `WIN G` | Vertically split with previous buffer | +| `WIN t` | Open new tab (:tabnew) | +| `WIN o` | Close other windows (:only) | +| `WIN x` | Remove buffer, leave blank window | +| `WIN q` | Remove current buffer | +| `WIN Q` | Close current buffer (:close) | +| `` | Next window or tab | +| `Shift-Tab` | Previous window or tab | SpaceVim has mapped normal `q` as smart buffer close, the normal func of `q` can be get by ` q r`, if you want to disable this feature, you can use `vimcompatible` mode. @@ -695,11 +694,11 @@ can be get by ` q r`, if you want to disable this feature, you can use ` ### File Operations -| Key Bindings | Descriptions | -| -------------- | ------------------------------------------ | -| `SPC f s` | Write (:w) | -| `Ctrl-s` | Write (:w) | -| `SPC f W` | Write as root (need sudo layer) | +| Key Bindings | Descriptions | +| ------------ | ------------------------------- | +| `SPC f s` | Write (:w) | +| `Ctrl-s` | Write (:w) | +| `SPC f W` | Write as root (need sudo layer) | ### Editor UI @@ -755,7 +754,14 @@ Bookmarks manager is included in `tools` layer, to use following key bindings, y | `m i` | Annotate bookmark | As SpaceVim use above bookmarks mappings, so you cannot use `a`, `m`, `n`, `p` or `i` registers to mark current position, but other registers should work well. -If you really need to use these registers, you can add `nnoremap m m` to your custom configuration, then you can use `a` registers via `\ma`. +If you really need to use these registers, you can map ` m` to `m` in your bootstrap function, +then you can use `a` registers via ` m a`. + +```viml +function! myspacevim#before() abort + nnoremap m m +endfunction +``` ### Fuzzy finder @@ -1117,6 +1123,7 @@ Files manipulation commands (start with f): | `SPC f S` | save all files | | `SPC f r` | open a recent file | | `SPC f t` | toggle file tree side bar | +| `SPC f d` | toggle disk manager in windows os | | `SPC f T` | show file tree side bar | | `SPC f y` | show and copy current file absolute path in the cmdline | @@ -1163,38 +1170,38 @@ you can use `filetree_direction` option: Navigation is centered on the `hjkl` keys with the hope of providing a fast navigation experience like in [vifm](https://github.com/vifm): -| Key Bindings | Descriptions | -| ------------------ | ------------------------------------------------- | -| `` / `SPC f t` | Toggle file explorer | -| **with in file tree** | | -| `` / `h` | go to parent node and collapse expanded directory | -| `` / `j` | select next file or directory | -| `` / `k` | select previous file or directory | -| `` / `l` | open selected file or expand directory | -| `N` | Create new file under corsor | -| `y y` | Copy file full path to system clipboard | -| `y Y` | Copy file to system clipboard | -| `P` | Paste file to the position under the cursor | -| `.` | toggle visible ignored files | -| `s v` | Split edit | -| `s g` | Vertical split edit | -| `p` | Preview | -| `i` | Switch to directory history | -| `v` | Quick look | -| `g x` | Execute with vimfiler associated | -| `'` | Toggle mark current line | -| `V` | Clear all marks | -| `Ctrl-r` | Redraw | +| Key Bindings | Descriptions | +| --------------------- | ------------------------------------------------- | +| `` / `SPC f t` | Toggle file explorer | +| **with in file tree** | | +| `` / `h` | go to parent node and collapse expanded directory | +| `` / `j` | select next file or directory | +| `` / `k` | select previous file or directory | +| `` / `l` | open selected file or expand directory | +| `N` | Create new file under corsor | +| `y y` | Copy file full path to system clipboard | +| `y Y` | Copy file to system clipboard | +| `P` | Paste file to the position under the cursor | +| `.` | toggle visible ignored files | +| `s v` | Split edit | +| `s g` | Vertical split edit | +| `p` | Preview | +| `i` | Switch to directory history | +| `v` | Quick look | +| `g x` | Execute with vimfiler associated | +| `'` | Toggle mark current line | +| `V` | Clear all marks | +| `Ctrl-r` | Redraw | ##### Open file with file tree. If only one file buffer is opened, a file is opened in the active window, otherwise we need to use vim-choosewin to select a window to open the file. -| Key Bindings | Descriptions | -| ---------------- | ----------------------------------------- | +| Key Bindings | Descriptions | +| --------------- | ----------------------------------------- | | `l` / `` | open file in one window | -| `sg` | open file in an vertically split window | -| `sv` | open file in an horizontally split window | +| `sg` | open file in an vertically split window | +| `sv` | open file in an horizontally split window | ### Commands starting with `g` @@ -1566,63 +1573,63 @@ In highlight symbol transient state: Text related commands (start with `x`): -| Key Bindings | Descriptions | -| --------------- | -------------------------------------------------------------------- | -| `SPC x a &` | align region at & | -| `SPC x a (` | align region at ( | -| `SPC x a )` | align region at ) | -| `SPC x a [` | align region at [ | -| `SPC x a ]` | align region at ] | -| `SPC x a {` | align region at { | -| `SPC x a }` | align region at } | -| `SPC x a ,` | align region at , | -| `SPC x a .` | align region at . (for numeric tables) | -| `SPC x a :` | align region at : | -| `SPC x a ;` | align region at ; | -| `SPC x a =` | align region at = | -| `SPC x a ¦` | align region at ¦ | -| `SPC x a |` | align region at \| | -| `SPC x a SPC` | align region at [SPC] | -| `SPC x a a` | align region (or guessed section) using default rules (TODO) | -| `SPC x a c` | align current indentation region using default rules (TODO) | -| `SPC x a l` | left-align with evil-lion (TODO) | -| `SPC x a L` | right-align with evil-lion (TODO) | -| `SPC x a r` | align region at user-specified regexp | -| `SPC x a o` | align region at operators `+-*/` | -| `SPC x c` | count the number of chars/words/lines in the selection region | -| `SPC x d w` | delete trailing whitespaces | -| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | -| `SPC x g l` | set lanuages used by translate commands (TODO) | -| `SPC x g t` | translate current word using Google Translate | -| `SPC x g T` | reverse source and target languages (TODO) | -| `SPC x i c` | change symbol style to `lowerCamelCase` | -| `SPC x i C` | change symbol style to `UpperCamelCase` | -| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | -| `SPC x i -` | change symbol style to `kebab-case` | -| `SPC x i k` | change symbol style to `kebab-case` | -| `SPC x i _` | change symbol style to `under_score` | -| `SPC x i u` | change symbol style to `under_score` | -| `SPC x i U` | change symbol style to `UP_CASE` | -| `SPC x j c` | set the justification to center | -| `SPC x j f` | set the justification to full (TODO) | -| `SPC x j l` | set the justification to left | -| `SPC x j n` | set the justification to none (TODO) | -| `SPC x j r` | set the justification to right | -| `SPC x J` | move down a line of text (enter transient state) | -| `SPC x K` | move up a line of text (enter transient state) | -| `SPC x l d` | duplicate line or region (TODO) | -| `SPC x l s` | sort lines (TODO) | -| `SPC x l u` | uniquify lines (TODO) | -| `SPC x o` | use avy to select a link in the frame and open it (TODO) | -| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | -| `SPC x t c` | swap (transpose) the current character with the previous one | -| `SPC x t w` | swap (transpose) the current word with the previous one | -| `SPC x t l` | swap (transpose) the current line with the previous one | -| `SPC x u` | set the selected text to lower case | -| `SPC x U` | set the selected text to upper case | -| `SPC x w c` | count the number of occurrences per word in the select region (TODO) | -| `SPC x w d` | show dictionary entry of word from wordnik.com (TODO) | -| `SPC x ` | indent or dedent a region rigidly (TODO) | +| Key Bindings | Descriptions | +| ------------- | -------------------------------------------------------------------- | +| `SPC x a &` | align region at & | +| `SPC x a (` | align region at ( | +| `SPC x a )` | align region at ) | +| `SPC x a [` | align region at [ | +| `SPC x a ]` | align region at ] | +| `SPC x a {` | align region at { | +| `SPC x a }` | align region at } | +| `SPC x a ,` | align region at , | +| `SPC x a .` | align region at . (for numeric tables) | +| `SPC x a :` | align region at : | +| `SPC x a ;` | align region at ; | +| `SPC x a =` | align region at = | +| `SPC x a ¦` | align region at ¦ | +| `SPC x a |` | align region at \| | +| `SPC x a SPC` | align region at [SPC] | +| `SPC x a a` | align region (or guessed section) using default rules (TODO) | +| `SPC x a c` | align current indentation region using default rules (TODO) | +| `SPC x a l` | left-align with evil-lion (TODO) | +| `SPC x a L` | right-align with evil-lion (TODO) | +| `SPC x a r` | align region at user-specified regexp | +| `SPC x a o` | align region at operators `+-*/` | +| `SPC x c` | count the number of chars/words/lines in the selection region | +| `SPC x d w` | delete trailing whitespaces | +| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | +| `SPC x g l` | set lanuages used by translate commands (TODO) | +| `SPC x g t` | translate current word using Google Translate | +| `SPC x g T` | reverse source and target languages (TODO) | +| `SPC x i c` | change symbol style to `lowerCamelCase` | +| `SPC x i C` | change symbol style to `UpperCamelCase` | +| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | +| `SPC x i -` | change symbol style to `kebab-case` | +| `SPC x i k` | change symbol style to `kebab-case` | +| `SPC x i _` | change symbol style to `under_score` | +| `SPC x i u` | change symbol style to `under_score` | +| `SPC x i U` | change symbol style to `UP_CASE` | +| `SPC x j c` | set the justification to center | +| `SPC x j f` | set the justification to full (TODO) | +| `SPC x j l` | set the justification to left | +| `SPC x j n` | set the justification to none (TODO) | +| `SPC x j r` | set the justification to right | +| `SPC x J` | move down a line of text (enter transient state) | +| `SPC x K` | move up a line of text (enter transient state) | +| `SPC x l d` | duplicate line or region (TODO) | +| `SPC x l s` | sort lines (TODO) | +| `SPC x l u` | uniquify lines (TODO) | +| `SPC x o` | use avy to select a link in the frame and open it (TODO) | +| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | +| `SPC x t c` | swap (transpose) the current character with the previous one | +| `SPC x t w` | swap (transpose) the current word with the previous one | +| `SPC x t l` | swap (transpose) the current line with the previous one | +| `SPC x u` | set the selected text to lower case | +| `SPC x U` | set the selected text to upper case | +| `SPC x w c` | count the number of occurrences per word in the select region (TODO) | +| `SPC x w d` | show dictionary entry of word from wordnik.com (TODO) | +| `SPC x ` | indent or dedent a region rigidly (TODO) | #### Text insertion commands @@ -1848,27 +1855,27 @@ Use `svc` to open a file in the existing Vim server, or use `nsvc` to open a fil ### issues -Achievements | Account ------ | ----- -[100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) -[1000th issue(PR)](https://github.com/SpaceVim/SpaceVim/issues/1000) | [sei40kr](https://github.com/sei40kr) -[2000th issue(PR)](https://github.com/SpaceVim/SpaceVim/issues/2000) | [nikolaussucher](https://github.com/nikolaussucher) +| Achievements | Account | +| --------------------------------------------------------------------- | --------------------------------------------------- | +| [100th issue(issue)](https://github.com/SpaceVim/SpaceVim/issues/100) | [BenBergman](https://github.com/BenBergman) | +| [1000th issue(PR)](https://github.com/SpaceVim/SpaceVim/issues/1000) | [sei40kr](https://github.com/sei40kr) | +| [2000th issue(PR)](https://github.com/SpaceVim/SpaceVim/issues/2000) | [nikolaussucher](https://github.com/nikolaussucher) | ### Stars, forks and watchers -Achievements | Account ------ | ----- -First stargazers | [monkeydterry](https://github.com/monkeydterry) -100th stargazers | [robertofarrell](https://github.com/robertofarrell) -1000th stargazers | [linsongze](https://github.com/linsongze) -2000th stargazers | [fated](https://github.com/fated) -3000th stargazers | [urso](https://github.com/urso) -4000th stargazers | [wanghe4096](https://github.com/wanghe4096) -5000th stargazers | [xxxxha](https://github.com/xxxxha) -6000th stargazers | [corenel](https://github.com/corenel) -7000th stargazers | [mohab1989](https://github.com/mohab1989) -8000th stargazers | [chocopowwwa](https://github.com/chocopowwwa) -9000th stargazers | [mffathurr](https://github.com/mffathurr) +| Achievements | Account | +| ----------------- | --------------------------------------------------- | +| First stargazers | [monkeydterry](https://github.com/monkeydterry) | +| 100th stargazers | [robertofarrell](https://github.com/robertofarrell) | +| 1000th stargazers | [linsongze](https://github.com/linsongze) | +| 2000th stargazers | [fated](https://github.com/fated) | +| 3000th stargazers | [urso](https://github.com/urso) | +| 4000th stargazers | [wanghe4096](https://github.com/wanghe4096) | +| 5000th stargazers | [xxxxha](https://github.com/xxxxha) | +| 6000th stargazers | [corenel](https://github.com/corenel) | +| 7000th stargazers | [mohab1989](https://github.com/mohab1989) | +| 8000th stargazers | [chocopowwwa](https://github.com/chocopowwwa) | +| 9000th stargazers | [mffathurr](https://github.com/mffathurr) | From 840fd21c9ec4d453be8c15cac6e379dd0bfe46cd Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Sun, 17 Mar 2019 22:03:27 +0800 Subject: [PATCH 164/179] Add: Count words in select region. (#2675) --- autoload/SpaceVim/layers/edit.vim | 8 ++- docs/cn/documentation.md | 114 +++++++++++++++--------------- docs/cn/layers/edit.md | 24 +++---- docs/documentation.md | 114 +++++++++++++++--------------- docs/layers/edit.md | 7 +- 5 files changed, 133 insertions(+), 134 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 034fc319b..8752f1daf 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -126,8 +126,12 @@ function! SpaceVim#layers#edit#config() abort \ . string(s:_function('s:set_justification_to')) . ', ["right"])', \ 'set-the-justification-to-right', 1) - call SpaceVim#mapping#space#def('vnoremap', ['x', 'u'], 'gu', 'set-the-selected-text-to-lower-case', 0) - call SpaceVim#mapping#space#def('vnoremap', ['x', 'U'], 'gU', 'set-the-selected-text-to-up-case', 0) + call SpaceVim#mapping#space#def('vnoremap', ['x', 'u'], 'gu', 'set the selected text to lower case', 0) + call SpaceVim#mapping#space#def('vnoremap', ['x', 'U'], 'gU', 'set the selected text to up case', 0) + + " word + let g:_spacevim_mappings_space.x.w = {'name' : '+word'} + call SpaceVim#mapping#space#def('vnoremap', ['x', 'w', 'c'], "normal! " . ":'<,'>s/\\\w\\+//gn" . "\", 'count the words in the select region', 1) let g:_spacevim_mappings_space.i = {'name' : '+Insertion'} let g:_spacevim_mappings_space.i.l = {'name' : '+Lorem-ipsum'} diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index f7267df59..6b81ebc31 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1557,63 +1557,63 @@ In highlight symbol transient state: 文本相关的命令 (以 `x` 开头): -| 快捷键 | 功能描述 | -| ------------- | -------------------------------------------------------------------- | -| `SPC x a &` | 基于分隔符 & 进行文本对齐 | -| `SPC x a (` | 基本分隔符 ( 进行文本对齐 | -| `SPC x a )` | 基本分隔符 ) 进行文本对齐 | -| `SPC x a [` | 基本分隔符 [ 进行文本对齐 | -| `SPC x a ]` | 基本分隔符 ] 进行文本对齐 | -| `SPC x a {` | 基本分隔符 { 进行文本对齐 | -| `SPC x a }` | 基本分隔符 } 进行文本对齐 | -| `SPC x a ,` | 基本分隔符 , 进行文本对齐 | -| `SPC x a .` | 基本分隔符 . 进行文本对齐(for numeric tables) | -| `SPC x a :` | 基本分隔符 : 进行文本对齐 | -| `SPC x a ;` | 基本分隔符 ; 进行文本对齐 | -| `SPC x a =` | 基本分隔符 = 进行文本对齐 | -| `SPC x a ¦` | 基本分隔符 ¦ 进行文本对齐 | -| `SPC x a |` | 基本分隔符 \| 进行文本对齐 | -| `SPC x a SPC` | 基本分隔符 进行文本对齐 | -| `SPC x a a` | align region (or guessed section) using default rules (TODO) | -| `SPC x a c` | align current indentation region using default rules (TODO) | -| `SPC x a l` | left-align with evil-lion (TODO) | -| `SPC x a L` | right-align with evil-lion (TODO) | -| `SPC x a r` | 基本用户自定义正则表达式进行文本对齐 | -| `SPC x a o` | align region at arithmetic operators `+-*/` | -| `SPC x c` | count the number of chars/words/lines in the selection region | -| `SPC x d w` | delete trailing whitespaces | -| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | -| `SPC x g l` | set lanuages used by translate commands (TODO) | -| `SPC x g t` | translate current word using Google Translate | -| `SPC x g T` | reverse source and target languages (TODO) | -| `SPC x i c` | change symbol style to `lowerCamelCase` | -| `SPC x i C` | change symbol style to `UpperCamelCase` | -| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | -| `SPC x i -` | change symbol style to `kebab-case` | -| `SPC x i k` | change symbol style to `kebab-case` | -| `SPC x i _` | change symbol style to `under_score` | -| `SPC x i u` | change symbol style to `under_score` | -| `SPC x i U` | change symbol style to `UP_CASE` | -| `SPC x j c` | 居中对齐当前段落 | -| `SPC x j f` | set the justification to full (TODO) | -| `SPC x j l` | 左对齐当前段落 | -| `SPC x j n` | set the justification to none (TODO) | -| `SPC x j r` | 右对齐当前段落 | -| `SPC x J` | move down a line of text (enter transient state) | -| `SPC x K` | move up a line of text (enter transient state) | -| `SPC x l d` | duplicate line or region (TODO) | -| `SPC x l s` | sort lines (TODO) | -| `SPC x l u` | uniquify lines (TODO) | -| `SPC x o` | use avy to select a link in the frame and open it (TODO) | -| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | -| `SPC x t c` | swap (transpose) the current character with the previous one | -| `SPC x t w` | swap (transpose) the current word with the previous one | -| `SPC x t l` | swap (transpose) the current line with the previous one | -| `SPC x u` | 将选中字符串转为小写 | -| `SPC x U` | 将选中字符串转为大写 | -| `SPC x w c` | count the number of occurrences per word in the select region (TODO) | -| `SPC x w d` | show dictionary entry of word from wordnik.com (TODO) | -| `SPC x ` | indent or dedent a region rigidly (TODO) | +| 快捷键 | 功能描述 | +| ------------- | ------------------------------------------------------------------ | +| `SPC x a &` | 基于分隔符 & 进行文本对齐 | +| `SPC x a (` | 基本分隔符 ( 进行文本对齐 | +| `SPC x a )` | 基本分隔符 ) 进行文本对齐 | +| `SPC x a [` | 基本分隔符 [ 进行文本对齐 | +| `SPC x a ]` | 基本分隔符 ] 进行文本对齐 | +| `SPC x a {` | 基本分隔符 { 进行文本对齐 | +| `SPC x a }` | 基本分隔符 } 进行文本对齐 | +| `SPC x a ,` | 基本分隔符 , 进行文本对齐 | +| `SPC x a .` | 基本分隔符 . 进行文本对齐(for numeric tables) | +| `SPC x a :` | 基本分隔符 : 进行文本对齐 | +| `SPC x a ;` | 基本分隔符 ; 进行文本对齐 | +| `SPC x a =` | 基本分隔符 = 进行文本对齐 | +| `SPC x a ¦` | 基本分隔符 ¦ 进行文本对齐 | +| `SPC x a |` | 基本分隔符 \| 进行文本对齐 | +| `SPC x a SPC` | 基本分隔符 进行文本对齐 | +| `SPC x a a` | align region (or guessed section) using default rules (TODO) | +| `SPC x a c` | align current indentation region using default rules (TODO) | +| `SPC x a l` | left-align with evil-lion (TODO) | +| `SPC x a L` | right-align with evil-lion (TODO) | +| `SPC x a r` | 基于用户自定义正则表达式进行文本对齐 | +| `SPC x a o` | align region at arithmetic operators `+-*/` | +| `SPC x c` | count the number of chars/words/lines in the selection region | +| `SPC x d w` | delete trailing whitespaces | +| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | +| `SPC x g l` | set lanuages used by translate commands (TODO) | +| `SPC x g t` | translate current word using Google Translate | +| `SPC x g T` | reverse source and target languages (TODO) | +| `SPC x i c` | change symbol style to `lowerCamelCase` | +| `SPC x i C` | change symbol style to `UpperCamelCase` | +| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | +| `SPC x i -` | change symbol style to `kebab-case` | +| `SPC x i k` | change symbol style to `kebab-case` | +| `SPC x i _` | change symbol style to `under_score` | +| `SPC x i u` | change symbol style to `under_score` | +| `SPC x i U` | change symbol style to `UP_CASE` | +| `SPC x j c` | 居中对齐当前段落 | +| `SPC x j f` | set the justification to full (TODO) | +| `SPC x j l` | 左对齐当前段落 | +| `SPC x j n` | set the justification to none (TODO) | +| `SPC x j r` | 右对齐当前段落 | +| `SPC x J` | move down a line of text (enter transient state) | +| `SPC x K` | move up a line of text (enter transient state) | +| `SPC x l d` | duplicate line or region (TODO) | +| `SPC x l s` | sort lines (TODO) | +| `SPC x l u` | uniquify lines (TODO) | +| `SPC x o` | use avy to select a link in the frame and open it (TODO) | +| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | +| `SPC x t c` | swap (transpose) the current character with the previous one | +| `SPC x t w` | swap (transpose) the current word with the previous one | +| `SPC x t l` | swap (transpose) the current line with the previous one | +| `SPC x u` | 将选中字符串转为小写 | +| `SPC x U` | 将选中字符串转为大写 | +| `SPC x w c` | 统计选中区域的单词数 | +| `SPC x w d` | show dictionary entry of word from wordnik.com (TODO) | +| `SPC x ` | indent or dedent a region rigidly (TODO) | #### 文本插入命令 diff --git a/docs/cn/layers/edit.md b/docs/cn/layers/edit.md index 7a3a3ba9b..be5ea0168 100644 --- a/docs/cn/layers/edit.md +++ b/docs/cn/layers/edit.md @@ -58,17 +58,15 @@ lang: cn - `)`: 对齐 `)` - `[SPC]`: 对齐 `[SPC]` - `o`: 对齐 `+ - * / % ^` 等 -- `r`: 对齐用户输入的正则 +- `r`: 对齐用户输入的正则表达式 -| 快捷键 | 功能描述 | -| ------------ | ------------------------------------ | -| `SPC x j c` | 居中对齐当前段落 | -| `SPC x j f` | set the justification to full (TODO) | -| `SPC x j l` | 左对齐当前段落 | -| `SPC x j n` | set the justification to none (TODO) | -| `SPC x j r` | 右对齐当前段落 | - -| 快捷键 | 功能描述 | -| --------- | -------------------- | -| `SPC x u` | 将选中字符串转为小写 | -| `SPC x U` | 将选中字符串转为大写 | +| 快捷键 | 功能描述 | +| ----------- | ------------------------------------ | +| `SPC x j c` | 居中对齐当前段落 | +| `SPC x j f` | set the justification to full (TODO) | +| `SPC x j l` | 左对齐当前段落 | +| `SPC x j n` | set the justification to none (TODO) | +| `SPC x j r` | 右对齐当前段落 | +| `SPC x u` | 将选中字符串转为小写 | +| `SPC x U` | 将选中字符串转为大写 | +| `SPC x w c` | 统计选中区域的单词数 | diff --git a/docs/documentation.md b/docs/documentation.md index 64855bf26..68880d0a7 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1573,63 +1573,63 @@ In highlight symbol transient state: Text related commands (start with `x`): -| Key Bindings | Descriptions | -| ------------- | -------------------------------------------------------------------- | -| `SPC x a &` | align region at & | -| `SPC x a (` | align region at ( | -| `SPC x a )` | align region at ) | -| `SPC x a [` | align region at [ | -| `SPC x a ]` | align region at ] | -| `SPC x a {` | align region at { | -| `SPC x a }` | align region at } | -| `SPC x a ,` | align region at , | -| `SPC x a .` | align region at . (for numeric tables) | -| `SPC x a :` | align region at : | -| `SPC x a ;` | align region at ; | -| `SPC x a =` | align region at = | -| `SPC x a ¦` | align region at ¦ | -| `SPC x a |` | align region at \| | -| `SPC x a SPC` | align region at [SPC] | -| `SPC x a a` | align region (or guessed section) using default rules (TODO) | -| `SPC x a c` | align current indentation region using default rules (TODO) | -| `SPC x a l` | left-align with evil-lion (TODO) | -| `SPC x a L` | right-align with evil-lion (TODO) | -| `SPC x a r` | align region at user-specified regexp | -| `SPC x a o` | align region at operators `+-*/` | -| `SPC x c` | count the number of chars/words/lines in the selection region | -| `SPC x d w` | delete trailing whitespaces | -| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | -| `SPC x g l` | set lanuages used by translate commands (TODO) | -| `SPC x g t` | translate current word using Google Translate | -| `SPC x g T` | reverse source and target languages (TODO) | -| `SPC x i c` | change symbol style to `lowerCamelCase` | -| `SPC x i C` | change symbol style to `UpperCamelCase` | -| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | -| `SPC x i -` | change symbol style to `kebab-case` | -| `SPC x i k` | change symbol style to `kebab-case` | -| `SPC x i _` | change symbol style to `under_score` | -| `SPC x i u` | change symbol style to `under_score` | -| `SPC x i U` | change symbol style to `UP_CASE` | -| `SPC x j c` | set the justification to center | -| `SPC x j f` | set the justification to full (TODO) | -| `SPC x j l` | set the justification to left | -| `SPC x j n` | set the justification to none (TODO) | -| `SPC x j r` | set the justification to right | -| `SPC x J` | move down a line of text (enter transient state) | -| `SPC x K` | move up a line of text (enter transient state) | -| `SPC x l d` | duplicate line or region (TODO) | -| `SPC x l s` | sort lines (TODO) | -| `SPC x l u` | uniquify lines (TODO) | -| `SPC x o` | use avy to select a link in the frame and open it (TODO) | -| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | -| `SPC x t c` | swap (transpose) the current character with the previous one | -| `SPC x t w` | swap (transpose) the current word with the previous one | -| `SPC x t l` | swap (transpose) the current line with the previous one | -| `SPC x u` | set the selected text to lower case | -| `SPC x U` | set the selected text to upper case | -| `SPC x w c` | count the number of occurrences per word in the select region (TODO) | -| `SPC x w d` | show dictionary entry of word from wordnik.com (TODO) | -| `SPC x ` | indent or dedent a region rigidly (TODO) | +| Key Bindings | Descriptions | +| ------------- | ------------------------------------------------------------------ | +| `SPC x a &` | align region at & | +| `SPC x a (` | align region at ( | +| `SPC x a )` | align region at ) | +| `SPC x a [` | align region at [ | +| `SPC x a ]` | align region at ] | +| `SPC x a {` | align region at { | +| `SPC x a }` | align region at } | +| `SPC x a ,` | align region at , | +| `SPC x a .` | align region at . (for numeric tables) | +| `SPC x a :` | align region at : | +| `SPC x a ;` | align region at ; | +| `SPC x a =` | align region at = | +| `SPC x a ¦` | align region at ¦ | +| `SPC x a |` | align region at \| | +| `SPC x a SPC` | align region at [SPC] | +| `SPC x a a` | align region (or guessed section) using default rules (TODO) | +| `SPC x a c` | align current indentation region using default rules (TODO) | +| `SPC x a l` | left-align with evil-lion (TODO) | +| `SPC x a L` | right-align with evil-lion (TODO) | +| `SPC x a r` | align region at user-specified regexp | +| `SPC x a o` | align region at operators `+-*/` etc | +| `SPC x c` | count the number of chars/words/lines in the selection region | +| `SPC x d w` | delete trailing whitespaces | +| `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | +| `SPC x g l` | set lanuages used by translate commands (TODO) | +| `SPC x g t` | translate current word using Google Translate | +| `SPC x g T` | reverse source and target languages (TODO) | +| `SPC x i c` | change symbol style to `lowerCamelCase` | +| `SPC x i C` | change symbol style to `UpperCamelCase` | +| `SPC x i i` | cycle symbol naming styles (i to keep cycling) | +| `SPC x i -` | change symbol style to `kebab-case` | +| `SPC x i k` | change symbol style to `kebab-case` | +| `SPC x i _` | change symbol style to `under_score` | +| `SPC x i u` | change symbol style to `under_score` | +| `SPC x i U` | change symbol style to `UP_CASE` | +| `SPC x j c` | set the justification to center | +| `SPC x j f` | set the justification to full (TODO) | +| `SPC x j l` | set the justification to left | +| `SPC x j n` | set the justification to none (TODO) | +| `SPC x j r` | set the justification to right | +| `SPC x J` | move down a line of text (enter transient state) | +| `SPC x K` | move up a line of text (enter transient state) | +| `SPC x l d` | duplicate line or region (TODO) | +| `SPC x l s` | sort lines (TODO) | +| `SPC x l u` | uniquify lines (TODO) | +| `SPC x o` | use avy to select a link in the frame and open it (TODO) | +| `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | +| `SPC x t c` | swap (transpose) the current character with the previous one | +| `SPC x t w` | swap (transpose) the current word with the previous one | +| `SPC x t l` | swap (transpose) the current line with the previous one | +| `SPC x u` | set the selected text to lower case | +| `SPC x U` | set the selected text to upper case | +| `SPC x w c` | count the words in the select region | +| `SPC x w d` | show dictionary entry of word from wordnik.com (TODO) | +| `SPC x ` | indent or dedent a region rigidly (TODO) | #### Text insertion commands diff --git a/docs/layers/edit.md b/docs/layers/edit.md index 85c42f97c..2468733a2 100644 --- a/docs/layers/edit.md +++ b/docs/layers/edit.md @@ -35,7 +35,7 @@ This layer provides many edit key bindings for SpaceVim, and also provides more ## Key bindings | Key bindings | Descraptions | -| -------------------- | -------------------------------- | +| --------------------- | -------------------------------- | | `SPC x a {delimiter}` | align content based on delimiter | **default delimiters** @@ -58,7 +58,6 @@ This layer provides many edit key bindings for SpaceVim, and also provides more - `o`: align `+ - * / % ^` etc. - `r`: align user specified regular expression. - | Key bindings | Descraptions | | ------------ | ------------------------------------ | | `SPC x j c` | set the justification to center | @@ -66,8 +65,6 @@ This layer provides many edit key bindings for SpaceVim, and also provides more | `SPC x j l` | set the justification to left | | `SPC x j n` | set the justification to none (TODO) | | `SPC x j r` | set the justification to right | - -| Key bindings | Descraptions | -| ------------ | ------------------------------------ | | `SPC x u` | set the selected text to lower case | | `SPC x U` | set the selected text to upper case | +| `SPC x w c` | count the words in the select region | From 95cbed444ab08985a1f28016971686e9916a811f Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 17 Mar 2019 22:51:55 +0800 Subject: [PATCH 165/179] Fix guide for denite layer (#2676) --- autoload/SpaceVim/layers/denite.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/denite.vim b/autoload/SpaceVim/layers/denite.vim index 476faeeae..1e94a5ec8 100644 --- a/autoload/SpaceVim/layers/denite.vim +++ b/autoload/SpaceVim/layers/denite.vim @@ -242,7 +242,7 @@ function! s:defind_fuzzy_finder() abort \ ] \ ] nnoremap f :Denite menu:CustomKeyMaps - let g:_spacevim_mappings.f[''] = ['Denite menu:CustomKeyMaps', + let g:_spacevim_mappings.f['[SPC]'] = ['Denite menu:CustomKeyMaps', \ 'fuzzy find custom key bindings', \ [ \ '[Leader f SPC] is to fuzzy find custom key bindings', From 06df3932962baa36d34d5c02b3c8f8e497fec48e Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sun, 17 Mar 2019 23:15:02 +0800 Subject: [PATCH 166/179] Fix defx option (#2677) --- config/plugins/defx.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/plugins/defx.vim b/config/plugins/defx.vim index 565143320..1df893cbf 100644 --- a/config/plugins/defx.vim +++ b/config/plugins/defx.vim @@ -57,6 +57,8 @@ function! s:defx_init() setl nonumber setl norelativenumber setl listchars= + setl nofoldenable + setl foldmethod=manual silent! nunmap silent! nunmap From d7d957957eac8d0970b0ecd60c625afd358cdfdf Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Mon, 18 Mar 2019 00:12:11 +0800 Subject: [PATCH 167/179] Add rust layer option (#2678) --- autoload/SpaceVim/layers/lang/rust.vim | 12 +++++++++++- docs/cn/layers/lang/rust.md | 5 +++++ docs/layers/lang/rust.md | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/rust.vim b/autoload/SpaceVim/layers/lang/rust.vim index 67a661541..77db6ef0f 100644 --- a/autoload/SpaceVim/layers/lang/rust.vim +++ b/autoload/SpaceVim/layers/lang/rust.vim @@ -52,10 +52,12 @@ function! SpaceVim#layers#lang#rust#plugins() abort return plugins endfunction +let s:recommended_style = 0 + function! SpaceVim#layers#lang#rust#config() abort let g:racer_experimental_completer = 1 let g:racer_cmd = get(g:, 'racer_cmd', $HOME . '/.cargo/bin/racer') - + let g:rust_recommended_style = s:recommended_style if SpaceVim#layers#lsp#check_filetype('rust') call SpaceVim#mapping#gd#add('rust', \ function('SpaceVim#lsp#go_to_def')) @@ -74,6 +76,14 @@ function! SpaceVim#layers#lang#rust#config() abort \ function('s:language_specified_mappings')) endfunction +function! SpaceVim#layers#rust#lang#set_variable(var) abort + + let s:recommended_style = get(a:var, + \ 'recommended-style', + \ s:recommended_style) + +endfunction + function! s:language_specified_mappings() abort call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 's'], \ '(rust-def-split)', 'rust-def-split', 0) diff --git a/docs/cn/layers/lang/rust.md b/docs/cn/layers/lang/rust.md index ed00f813b..09a1e0b0b 100644 --- a/docs/cn/layers/lang/rust.md +++ b/docs/cn/layers/lang/rust.md @@ -11,6 +11,7 @@ lang: cn - [模块简介](#模块简介) - [功能特性](#功能特性) - [启用模块](#启用模块) +- [模块选项](#模块选项) - [快捷键](#快捷键) - [运行当前脚本](#运行当前脚本) @@ -37,6 +38,10 @@ lang: cn name = "lang#rust" ``` +## 模块选项 + +- `recommended-style`: 启用/禁用 rust 推荐的代码规范,该选项默认已禁用。 + ## 快捷键 | 快捷键 | 功能描述 | diff --git a/docs/layers/lang/rust.md b/docs/layers/lang/rust.md index d12f4ffe3..80355ebc8 100644 --- a/docs/layers/lang/rust.md +++ b/docs/layers/lang/rust.md @@ -11,6 +11,7 @@ description: "This layer is for Rust development, provide autocompletion, syntax - [Features](#features) - [Install](#install) - [Layer](#layer) +- [Layer options](#layer-options) - [Key bindings](#key-bindings) - [Code runner](#code-runner) @@ -43,6 +44,10 @@ To use this configuration layer, update custom configuration file with: name = "lang#rust" ``` +## Layer options + +- `recommended-style`: Enable/Disable recommended code style for rust. This option is disabled by default. + ## Key bindings | Key bindings | Descriptions | From ca06b27c0401873cb7b71736aa3e0a9b5bebf3e1 Mon Sep 17 00:00:00 2001 From: Tai-Lin Date: Sun, 17 Mar 2019 19:45:39 -0400 Subject: [PATCH 168/179] Update installation step in lang#go (#2679) --- docs/layers/lang/go.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/layers/lang/go.md b/docs/layers/lang/go.md index 6fa4bdb85..bf1af186a 100644 --- a/docs/layers/lang/go.md +++ b/docs/layers/lang/go.md @@ -27,6 +27,8 @@ To use this configuration layer, update custom configuration file with: name = "lang#go" ``` +After the installation, run `:GoInstallBinaries` inside vim. + ## Features - auto-completion From 99d0631576400b329220e5650eccea7a2d78ac70 Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Mon, 18 Mar 2019 14:33:42 +0800 Subject: [PATCH 169/179] Fix: fix function of SPC f d to match its documentation. (#2682) * Fix: fix function of SPC f d to match it's documentation. * Doc: fix typos. --- autoload/SpaceVim/layers/core.vim | 12 ++++++++- docs/cn/documentation.md | 5 ++-- docs/documentation.md | 42 +++++++++++++++---------------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index bbf1d9f82..e127dfa1a 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -173,7 +173,9 @@ function! SpaceVim#layers#core#config() abort call SpaceVim#mapping#space#def('nnoremap', ['f', 'F'], 'normal! gf', 'open-cursor-file', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', '/'], 'call SpaceVim#plugins#find#open()', 'find-files', 1) if s:SYS.isWindows - call SpaceVim#mapping#space#def('nnoremap', ['f', 'd'], 'call SpaceVim#plugins#windisk#open()', 'open-windisk-manager', 1) + call SpaceVim#mapping#space#def('nnoremap', ['f', 'd'], 'call call(' + \ . string(s:_function('s:ToggleWinDiskManager')) . ', [])', + \ 'toggle Windows disk manager', 1) endif if g:spacevim_filemanager ==# 'vimfiler' call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler | doautocmd WinEnter', 'toggle_file_tree', 1) @@ -430,6 +432,14 @@ function! s:safe_erase_buffer() abort redraw! endfunction +function! s:ToggleWinDiskManager() abort + if bufexists("__windisk__") + execute 'bd "__windisk__"' + else + call SpaceVim#plugins#windisk#open() + endif +endfunction + function! s:open_message_buffer() abort vertical topleft edit __Message_Buffer__ setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonumber norelativenumber diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index 6b81ebc31..b74c19f9c 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1002,7 +1002,7 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的 | 快捷键 | 功能描述 | | ---------------------------------------- | ------------------------------------------------------------------------------ | -| `SPC w`` | 在同一标签内进行窗口切换 | +| `SPC w ` | 在同一标签内进行窗口切换 | | `SPC w =` | 对齐分离的窗口 | | `SPC w b` | force the focus back to the minibuffer (TODO) | | `SPC w c` | 进入阅读模式,浏览当前窗口 (需要 tools 模块) | @@ -1104,7 +1104,8 @@ Buffer 操作相关快捷键都是以 `SPC b` 为前缀的: | `SPC f r` | 打开文件历史 | | `SPC f t` | 切换侧栏文件树 | | `SPC f T` | 打开文件树侧栏 | -| `SPC f y` | 复制当前文件,并且显示当前文件路径 | +| `SPC f d` | Windows 下显示/隐藏磁盘管理器 | +| `SPC f y` | 复制并显示当前文件的绝对路径 | ##### Vim 和 SpaceVim 相关文件 diff --git a/docs/documentation.md b/docs/documentation.md index 68880d0a7..e2c898e05 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1105,27 +1105,27 @@ In SpaceVim, there are many special buffers, these buffers are created by plugin Files manipulation commands (start with f): -| Key Bindings | Descriptions | -| ------------ | -------------------------------------------------------------- | -| `SPC f /` | Find files with `find` command | -| `SPC f b` | go to file bookmarks | -| `SPC f c` | copy current file to a different location(TODO) | -| `SPC f C d` | convert file from unix to dos encoding | -| `SPC f C u` | convert file from dos to unix encoding | -| `SPC f D` | delete a file and the associated buffer (ask for confirmation) | -| `SPC f E` | open a file with elevated privileges (sudo layer) (TODO) | -| `SPC f W` | save a file with elevated privileges (sudo layer) | -| `SPC f f` | open file | -| `SPC f F` | try to open the file under point | -| `SPC f o` | open a file using the default external program(TODO) | -| `SPC f R` | rename the current file(TODO) | -| `SPC f s` | save a file | -| `SPC f S` | save all files | -| `SPC f r` | open a recent file | -| `SPC f t` | toggle file tree side bar | -| `SPC f d` | toggle disk manager in windows os | -| `SPC f T` | show file tree side bar | -| `SPC f y` | show and copy current file absolute path in the cmdline | +| Key Bindings | Descriptions | +| ------------ | --------------------------------------------------------- | +| `SPC f /` | Find files with `find` command | +| `SPC f b` | go to file bookmarks | +| `SPC f c` | copy current file to a different location(TODO) | +| `SPC f C d` | convert file from unix to dos encoding | +| `SPC f C u` | convert file from dos to unix encoding | +| `SPC f D` | delete a file and the associated buffer with confirmation | +| `SPC f E` | open a file with elevated privileges (sudo layer) (TODO) | +| `SPC f W` | save a file with elevated privileges (sudo layer) | +| `SPC f f` | open file | +| `SPC f F` | try to open the file under point | +| `SPC f o` | open a file using the default external program(TODO) | +| `SPC f R` | rename the current file(TODO) | +| `SPC f s` | save a file | +| `SPC f S` | save all files | +| `SPC f r` | open a recent file | +| `SPC f t` | toggle file tree side bar | +| `SPC f T` | show file tree side bar | +| `SPC f d` | toggle disk manager in Windows OS | +| `SPC f y` | show and copy current file absolute path in the cmdline | ##### Vim and SpaceVim files From cc023acfba3fdd10eab230dae2307615498175da Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Tue, 19 Mar 2019 13:32:05 +0800 Subject: [PATCH 170/179] Add 3 key bindings SPC x t C, SPC x t W, SPC x t L (#2684) * Add: add 3 new key bindings and document the same. * Doc: sort key bindings. * Doc: fix a typo. * Fix: optimize. --- autoload/SpaceVim/layers/edit.vim | 60 ++++++++++++---- docs/cn/documentation.md | 115 +++++++++++++++--------------- docs/documentation.md | 3 + 3 files changed, 107 insertions(+), 71 deletions(-) diff --git a/autoload/SpaceVim/layers/edit.vim b/autoload/SpaceVim/layers/edit.vim index 8752f1daf..7b8274c9e 100644 --- a/autoload/SpaceVim/layers/edit.vim +++ b/autoload/SpaceVim/layers/edit.vim @@ -184,36 +184,66 @@ function! SpaceVim#layers#edit#config() abort call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'l'], 'call call(' \ . string(s:_function('s:transpose_with_previous')) . ', ["line"])', \ 'swap current line with previous one', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'C'], 'call call(' + \ . string(s:_function('s:transpose_with_next')) . ', ["character"])', + \ 'swap current character with next one', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'W'], 'call call(' + \ . string(s:_function('s:transpose_with_next')) . ', ["word"])', + \ 'swap current word with next one', 1) + call SpaceVim#mapping#space#def('nnoremap', ['x', 't', 'L'], 'call call(' + \ . string(s:_function('s:transpose_with_next')) . ', ["line"])', + \ 'swap current line with next one', 1) endfunction function! s:transpose_with_previous(type) abort + let l:save_register = @" if a:type ==# 'line' if line('.') > 1 - let l:save_register = @" normal! kddp - let @" = l:save_register endif elseif a:type ==# 'word' - let save_register = @k - normal! "kyiw - let cw = @k - normal! ge"kyiw - let tw = @k - if cw !=# tw - let @k = cw - normal! viw"kp - let @k = tw - normal! eviw"kp + normal! yiw + let l:cw = @" + normal! geyiw + let l:tw = @" + if l:cw !=# l:tw + let @" = l:cw + normal! viwp + let @" = l:tw + normal! eviwp endif - let @k = save_register elseif a:type ==# 'character' if col('.') > 1 - let l:save_register = @" normal! hxp - let @" = l:save_register endif endif + let @" = l:save_register +endfunction + +function! s:transpose_with_next(type) abort + let l:save_register = @" + if a:type ==# 'line' + if line('.') < line('$') + normal! ddp + endif + elseif a:type ==# 'word' + normal! yiw + let l:cw = @" + normal! wyiw + let l:nw = @" + if l:cw !=# l:nw + let @" = l:cw + normal! viwp + let @" = l:nw + normal! geviwp + endif + elseif a:type ==# 'character' + if col('.') < col('$')-1 + normal! xp + endif + endif + let @" = l:save_register endfunction function! s:move_text_down_transient_state() abort diff --git a/docs/cn/documentation.md b/docs/cn/documentation.md index b74c19f9c..e02f5f0ba 100644 --- a/docs/cn/documentation.md +++ b/docs/cn/documentation.md @@ -1000,43 +1000,43 @@ Denite/Unite 是一个强大的信息筛选浏览器,这类似于 Emacs 中的 窗口操作相关快捷键(以 `SPC w` 为前缀): -| 快捷键 | 功能描述 | -| ---------------------------------------- | ------------------------------------------------------------------------------ | -| `SPC w ` | 在同一标签内进行窗口切换 | -| `SPC w =` | 对齐分离的窗口 | -| `SPC w b` | force the focus back to the minibuffer (TODO) | -| `SPC w c` | 进入阅读模式,浏览当前窗口 (需要 tools 模块) | -| `SPC w C` | 选择某一个窗口,并且进入阅读模式 (需要 tools 模块) | -| `SPC w d` | 删除一个窗口 | -| `SPC u SPC w d` | delete a window and its current buffer (does not delete the file) (TODO) | -| `SPC w D` | 选择一个窗口并关闭 | -| `SPC u SPC w D` | delete another window and its current buffer using vim-choosewin (TODO) | -| `SPC w t` | toggle window dedication (dedicated window cannot be reused by a mode) (TODO) | -| `SPC w f` | toggle follow mode (TODO) | -| `SPC w F` | 新建一个新的标签页 | -| `SPC w h` | 移至左边窗口 | -| `SPC w H` | 将窗口向左移动 | -| `SPC w j` | 移至下方窗口 | -| `SPC w J` | 将窗口向下移动 | -| `SPC w k` | 移至上方窗口 | -| `SPC w K` | 将窗口向上移动 | -| `SPC w l` | 移至右方窗口 | -| `SPC w L` | 将窗口向右移动 | -| `SPC w m` | 最大化/最小化窗口(最大化相当于关闭其它窗口)(TODO, now only support maximize) | -| `SPC w M` | 选择窗口进行替换 | -| `SPC w o` | 按序切换标签页 | -| `SPC w p m` | open messages buffer in a popup window (TODO) | -| `SPC w p p` | close the current sticky popup window (TODO) | -| `SPC w r` | 顺序切换窗口 | -| `SPC w R` | 逆序切换窗口 | -| `SPC w s` / `SPC w -` | 水平分割窗口 | -| `SPC w S` | 水平分割窗口,并切换至新窗口 | -| `SPC w u` | undo window layout (used to effectively undo a closed window) (TODO) | -| `SPC w U` | redo window layout (TODO) | -| `SPC w v` / `SPC w /` | 垂直分离窗口 | -| `SPC w V` | 垂直分离窗口,并切换至新窗口 | -| `SPC w w` | 切换至前一窗口 | -| `SPC w W` | 选择一个窗口 | +| 快捷键 | 功能描述 | +| --------------------- | ------------------------------------------------------------------------------ | +| `SPC w ` | 在同一标签内进行窗口切换 | +| `SPC w =` | 对齐分离的窗口 | +| `SPC w b` | force the focus back to the minibuffer (TODO) | +| `SPC w c` | 进入阅读模式,浏览当前窗口 (需要 tools 模块) | +| `SPC w C` | 选择某一个窗口,并且进入阅读模式 (需要 tools 模块) | +| `SPC w d` | 删除一个窗口 | +| `SPC u SPC w d` | delete a window and its current buffer (does not delete the file) (TODO) | +| `SPC w D` | 选择一个窗口并关闭 | +| `SPC u SPC w D` | delete another window and its current buffer using vim-choosewin (TODO) | +| `SPC w t` | toggle window dedication (dedicated window cannot be reused by a mode) (TODO) | +| `SPC w f` | toggle follow mode (TODO) | +| `SPC w F` | 新建一个新的标签页 | +| `SPC w h` | 移至左边窗口 | +| `SPC w H` | 将窗口向左移动 | +| `SPC w j` | 移至下方窗口 | +| `SPC w J` | 将窗口向下移动 | +| `SPC w k` | 移至上方窗口 | +| `SPC w K` | 将窗口向上移动 | +| `SPC w l` | 移至右方窗口 | +| `SPC w L` | 将窗口向右移动 | +| `SPC w m` | 最大化/最小化窗口(最大化相当于关闭其它窗口)(TODO, now only support maximize) | +| `SPC w M` | 选择窗口进行替换 | +| `SPC w o` | 按序切换标签页 | +| `SPC w p m` | open messages buffer in a popup window (TODO) | +| `SPC w p p` | close the current sticky popup window (TODO) | +| `SPC w r` | 顺序切换窗口 | +| `SPC w R` | 逆序切换窗口 | +| `SPC w s` / `SPC w -` | 水平分割窗口 | +| `SPC w S` | 水平分割窗口,并切换至新窗口 | +| `SPC w u` | undo window layout (used to effectively undo a closed window) (TODO) | +| `SPC w U` | redo window layout (TODO) | +| `SPC w v` / `SPC w /` | 垂直分离窗口 | +| `SPC w V` | 垂直分离窗口,并切换至新窗口 | +| `SPC w w` | 切换至前一窗口 | +| `SPC w W` | 选择一个窗口 | #### 文件和 Buffer 操作 @@ -1580,12 +1580,12 @@ In highlight symbol transient state: | `SPC x a l` | left-align with evil-lion (TODO) | | `SPC x a L` | right-align with evil-lion (TODO) | | `SPC x a r` | 基于用户自定义正则表达式进行文本对齐 | -| `SPC x a o` | align region at arithmetic operators `+-*/` | -| `SPC x c` | count the number of chars/words/lines in the selection region | -| `SPC x d w` | delete trailing whitespaces | +| `SPC x a o` | 对齐算术运算符 `+-*/` | +| `SPC x c` | 统计选中区域的字符/单词/行数 | +| `SPC x d w` | 删除行尾空白字符 | | `SPC x d SPC` | Delete all spaces and tabs around point, leaving one space | | `SPC x g l` | set lanuages used by translate commands (TODO) | -| `SPC x g t` | translate current word using Google Translate | +| `SPC x g t` | 使用 Google Translate 翻译当前单词 | | `SPC x g T` | reverse source and target languages (TODO) | | `SPC x i c` | change symbol style to `lowerCamelCase` | | `SPC x i C` | change symbol style to `UpperCamelCase` | @@ -1600,16 +1600,19 @@ In highlight symbol transient state: | `SPC x j l` | 左对齐当前段落 | | `SPC x j n` | set the justification to none (TODO) | | `SPC x j r` | 右对齐当前段落 | -| `SPC x J` | move down a line of text (enter transient state) | -| `SPC x K` | move up a line of text (enter transient state) | +| `SPC x J` | 将当前行向下移动一行并进入临时快捷键状态 | +| `SPC x K` | 将当前行向上移动一行并进入临时快捷键状态 | | `SPC x l d` | duplicate line or region (TODO) | | `SPC x l s` | sort lines (TODO) | | `SPC x l u` | uniquify lines (TODO) | | `SPC x o` | use avy to select a link in the frame and open it (TODO) | | `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | -| `SPC x t c` | swap (transpose) the current character with the previous one | -| `SPC x t w` | swap (transpose) the current word with the previous one | -| `SPC x t l` | swap (transpose) the current line with the previous one | +| `SPC x t c` | 交换当前字符和前一个字符的位置 | +| `SPC x t C` | 交换当前字符和后一个字符的位置 | +| `SPC x t w` | 交换当前单词和前一个单词的位置 | +| `SPC x t W` | 交换当前单词和后一个单词的位置 | +| `SPC x t l` | 交换当前行和前一行的位置 | +| `SPC x t L` | 交换当前行和后一行的位置 | | `SPC x u` | 将选中字符串转为小写 | | `SPC x U` | 将选中字符串转为大写 | | `SPC x w c` | 统计选中区域的单词数 | @@ -1637,18 +1640,18 @@ In highlight symbol transient state: #### 增加或减小数字 -| 快捷键 | 功能描述 | -| --------- | -------------------------------------------------- | -| `SPC n +` | 为光标下的数字加 1 并进入 initiate transient state | -| `SPC n -` | 为光标下的数字减 1 并进入 initiate transient state | +| 快捷键 | 功能描述 | +| --------- | ---------------------------------------- | +| `SPC n +` | 为光标下的数字加 1 并进入 临时快捷键状态 | +| `SPC n -` | 为光标下的数字减 1 并进入 临时快捷键状态 | -In transient state: +在临时快捷键模式下: -| 快捷键 | 功能描述 | -| ---------- | -------------------- | -| `+` | 为光标下的数字加 1 | -| `-` | 为光标下的数字减 1 | -| 其它任意键 | 离开 transient state | +| 快捷键 | 功能描述 | +| ---------- | ------------------ | +| `+` | 为光标下的数字加 1 | +| `-` | 为光标下的数字减 1 | +| 其它任意键 | 离开临时快捷键状态 | **提示:** 如果你想为光标下的数字所增加的值大于 `1`,你可以使用前缀参数。例如:`10 SPC n +` 将为光标下的数字加 `10`。 diff --git a/docs/documentation.md b/docs/documentation.md index e2c898e05..3b6dd2fde 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -1623,8 +1623,11 @@ Text related commands (start with `x`): | `SPC x o` | use avy to select a link in the frame and open it (TODO) | | `SPC x O` | use avy to select multiple links in the frame and open them (TODO) | | `SPC x t c` | swap (transpose) the current character with the previous one | +| `SPC x t C` | swap (transpose) the current character with the next one | | `SPC x t w` | swap (transpose) the current word with the previous one | +| `SPC x t W` | swap (transpose) the current word with the next one | | `SPC x t l` | swap (transpose) the current line with the previous one | +| `SPC x t L` | swap (transpose) the current line with the next one | | `SPC x u` | set the selected text to lower case | | `SPC x U` | set the selected text to upper case | | `SPC x w c` | count the words in the select region | From dc5dd57e9ccf423651e9e2230362af2c31e5794a Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 20 Mar 2019 20:50:42 +0800 Subject: [PATCH 171/179] Fix rust layer (#2690) --- autoload/SpaceVim/layers/lang/rust.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/layers/lang/rust.vim b/autoload/SpaceVim/layers/lang/rust.vim index 77db6ef0f..1e4298dd7 100644 --- a/autoload/SpaceVim/layers/lang/rust.vim +++ b/autoload/SpaceVim/layers/lang/rust.vim @@ -76,7 +76,7 @@ function! SpaceVim#layers#lang#rust#config() abort \ function('s:language_specified_mappings')) endfunction -function! SpaceVim#layers#rust#lang#set_variable(var) abort +function! SpaceVim#layers#lang#rust#set_variable(var) abort let s:recommended_style = get(a:var, \ 'recommended-style', From befbb4f9a89edf7aa913a9e5057b4bed501546a6 Mon Sep 17 00:00:00 2001 From: Nikolaus Sucher Date: Wed, 20 Mar 2019 08:52:37 -0400 Subject: [PATCH 172/179] Update nerdtree.vim (#2685) With "leftabove" nerdtree only appears on the right. After I changed it to "left" it is working again. --- config/plugins/nerdtree.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/plugins/nerdtree.vim b/config/plugins/nerdtree.vim index e6f8b731a..298f8ef11 100644 --- a/config/plugins/nerdtree.vim +++ b/config/plugins/nerdtree.vim @@ -2,7 +2,7 @@ let s:VCOP = SpaceVim#api#import('vim#compatible') if g:spacevim_filetree_direction ==# 'right' let g:NERDTreeWinPos = 'rightbelow' else - let g:NERDTreeWinPos = 'leftabove' + let g:NERDTreeWinPos = 'left' endif let g:NERDTreeWinSize=get(g:,'NERDTreeWinSize',31) let g:NERDTreeChDirMode=get(g:,'NERDTreeChDirMode',1) From c3c41ca0f036ee53937f9413278615c888e36f5c Mon Sep 17 00:00:00 2001 From: AlanDing <395577197@qq.com> Date: Sat, 23 Mar 2019 20:42:41 +0800 Subject: [PATCH 173/179] fix defx mapping l and c (#2693) * fix defx key binding l * fix defx key binding c --- config/plugins/defx.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/plugins/defx.vim b/config/plugins/defx.vim index 1df893cbf..768fe0d2c 100644 --- a/config/plugins/defx.vim +++ b/config/plugins/defx.vim @@ -83,7 +83,7 @@ function! s:defx_init() " Define mappings nnoremap gx \ defx#do_action('execute_system') - nnoremap yy + nnoremap c \ defx#do_action('copy') nnoremap q \ defx#do_action('quit') @@ -95,7 +95,7 @@ function! s:defx_init() nnoremap defx#do_action('call', 'DefxSmartH') nnoremap l \ defx#is_directory() ? - \ defx#do_action('open_tree') . 'j' : defx#do_action('open') + \ defx#do_action('open_tree') . 'j' : defx#do_action('drop') nnoremap \ defx#is_directory() ? \ defx#do_action('open_tree') . 'j' : defx#do_action('open') From 5e8a168add6486572ac46c1b3b9cf87cc21e4d5e Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sat, 23 Mar 2019 21:22:13 +0800 Subject: [PATCH 174/179] fix Vimfiler defx support (#2691) * Fix SPC j d * Fix windisk for defx * Add s t key binding for defx * remove key binding * Fix wiki --- autoload/SpaceVim/layers/core.vim | 19 +++++++++++++++---- autoload/SpaceVim/plugins/windisk.vim | 7 ++++++- config/plugins/defx.vim | 6 +++++- config/plugins/vimfiler.vim | 3 --- wiki/en/Following-HEAD.md | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/autoload/SpaceVim/layers/core.vim b/autoload/SpaceVim/layers/core.vim index e127dfa1a..c183ec147 100644 --- a/autoload/SpaceVim/layers/core.vim +++ b/autoload/SpaceVim/layers/core.vim @@ -98,8 +98,17 @@ function! SpaceVim#layers#core#config() abort call SpaceVim#mapping#space#def('nnoremap', ['j', '$'], 'm`g_', 'push mark and goto end of line', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'b'], '', 'jump backward', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'f'], '', 'jump forward', 0) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1) - call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1) + + " file tree key bindings + if g:spacevim_filemanager ==# 'vimfiler' + call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'VimFiler -no-split', 'Explore current directory', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'VimFiler', 'Explore current directory (other window)', 1) + elseif g:spacevim_filemanager ==# 'nerdtree' + elseif g:spacevim_filemanager ==# 'defx' + call SpaceVim#mapping#space#def('nnoremap', ['j', 'd'], 'let g:_spacevim_autoclose_defx = 0 | Defx -split=no | let g:_spacevim_autoclose_defx = 1', 'Explore current directory', 1) + call SpaceVim#mapping#space#def('nnoremap', ['j', 'D'], 'Defx', 'Explore current directory (other window)', 1) + endif + call SpaceVim#mapping#space#def('nmap', ['j', 'j'], '(easymotion-overwin-f)', 'jump to a character', 0) call SpaceVim#mapping#space#def('nmap', ['j', 'J'], '(easymotion-overwin-f2)', 'jump to a suite of two characters', 0) call SpaceVim#mapping#space#def('nnoremap', ['j', 'k'], 'j==', 'go to next line and indent', 0) @@ -174,9 +183,11 @@ function! SpaceVim#layers#core#config() abort call SpaceVim#mapping#space#def('nnoremap', ['f', '/'], 'call SpaceVim#plugins#find#open()', 'find-files', 1) if s:SYS.isWindows call SpaceVim#mapping#space#def('nnoremap', ['f', 'd'], 'call call(' - \ . string(s:_function('s:ToggleWinDiskManager')) . ', [])', - \ 'toggle Windows disk manager', 1) + \ . string(s:_function('s:ToggleWinDiskManager')) . ', [])', + \ 'toggle Windows disk manager', 1) endif + + " file tree key bindings if g:spacevim_filemanager ==# 'vimfiler' call SpaceVim#mapping#space#def('nnoremap', ['f', 't'], 'VimFiler | doautocmd WinEnter', 'toggle_file_tree', 1) call SpaceVim#mapping#space#def('nnoremap', ['f', 'T'], 'VimFiler -no-toggle | doautocmd WinEnter', 'show_file_tree', 1) diff --git a/autoload/SpaceVim/plugins/windisk.vim b/autoload/SpaceVim/plugins/windisk.vim index 6824b447d..c9864cb91 100644 --- a/autoload/SpaceVim/plugins/windisk.vim +++ b/autoload/SpaceVim/plugins/windisk.vim @@ -35,7 +35,12 @@ endf function! s:open_disk(d) abort call s:close_disk_buffer() - exe 'VimFiler -no-toggle ' . a:d + if g:spacevim_filemanager ==# 'vimfiler' + exe 'VimFiler -no-toggle ' . a:d + elseif g:spacevim_filemanager ==# 'nerdtree' + elseif g:spacevim_filemanager ==# 'defx' + exe 'Defx -no-toggle ' . a:d + endif doautocmd WinEnter endfunction diff --git a/config/plugins/defx.vim b/config/plugins/defx.vim index 768fe0d2c..c5a271500 100644 --- a/config/plugins/defx.vim +++ b/config/plugins/defx.vim @@ -36,12 +36,14 @@ call defx#custom#column('filename', { \ 'opened_icon': '', \ }) +let g:_spacevim_autoclose_defx = 1 + augroup vfinit au! autocmd FileType defx call s:defx_init() " auto close last defx windows autocmd BufEnter * nested if - \ (!has('vim_starting') && winnr('$') == 1 + \ (!has('vim_starting') && winnr('$') == 1 && g:_spacevim_autoclose_defx \ && &filetype ==# 'defx') | \ call s:close_last_vimfiler_windows() | endif augroup END @@ -109,6 +111,8 @@ function! s:defx_init() \ defx#do_action('drop', 'vsplit') nnoremap sv \ defx#do_action('drop', 'split') + nnoremap st + \ defx#do_action('drop', 'tabedit') nnoremap p \ defx#do_action('open', 'pedit') nnoremap N diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim index ab64f1e3e..f8b3a505e 100644 --- a/config/plugins/vimfiler.vim +++ b/config/plugins/vimfiler.vim @@ -92,9 +92,6 @@ function! s:vimfilerinit() silent! nunmap - silent! nunmap s - nnoremap gr :Denite grep:=selected() -buffer-name=grep - nnoremap gf :Denite file_rec:=selected() - nnoremap gd :call change_vim_current_dir() nnoremap sg :call vimfiler_vsplit() nnoremap sv :call vimfiler_split() nnoremap st vimfiler#do_action('tabswitch') diff --git a/wiki/en/Following-HEAD.md b/wiki/en/Following-HEAD.md index bb0e924cf..72361cc24 100644 --- a/wiki/en/Following-HEAD.md +++ b/wiki/en/Following-HEAD.md @@ -85,4 +85,4 @@ The next release is v1.1.0: SpaceVim releases v1.0.0 at 2018-12-26, please check the release page: -- [SpaceVim releases v0.9.0](https://spacevim.org/SpaceVim-release-v1.0.0/) for all the details +- [SpaceVim releases v1.0.0](https://spacevim.org/SpaceVim-release-v1.0.0/) for all the details From 724c73a8cf13766156d59ee6b51eef1d3a5f7fef Mon Sep 17 00:00:00 2001 From: Shidong Wang Date: Sat, 23 Mar 2019 21:44:27 +0800 Subject: [PATCH 175/179] Fix yarked action --- config/plugins/defx.vim | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/config/plugins/defx.vim b/config/plugins/defx.vim index c5a271500..123afa022 100644 --- a/config/plugins/defx.vim +++ b/config/plugins/defx.vim @@ -121,8 +121,7 @@ function! s:defx_init() \ defx#do_action('remove') nnoremap r \ defx#do_action('rename') - nnoremap yy - \ defx#do_action('yank_path') + nnoremap yy defx#do_action('call', 'DefxYarkPath') nnoremap . \ defx#do_action('toggle_ignored_files') nnoremap ~ @@ -144,7 +143,7 @@ function! DefxSmartH(_) if defx#is_opened_tree() return defx#call_action('close_tree') endif - + " parent is root? let s:candidate = defx#get_candidate() let s:parent = fnamemodify(s:candidate['action__path'], s:candidate['is_directory'] ? ':p:h:h' : ':p:h') @@ -152,14 +151,20 @@ function! DefxSmartH(_) if s:trim_right(s:parent, sep) == s:trim_right(b:defx.paths[0], sep) return defx#call_action('cd', ['..']) endif - + " move to parent. call defx#call_action('search', s:parent) - + " if you want close_tree immediately, enable below line. call defx#call_action('close_tree') endfunction +function! DefxYarkPath(_) abort + let candidate = defx#get_candidate() + let @+ = candidate['action__path'] + echo 'yarked: ' . @+ +endfunction + function! s:trim_right(str, trim) return substitute(a:str, printf('%s$', a:trim), '', 'g') endfunction From 0950b4f29a365885d42271290e9174db0aee3ae4 Mon Sep 17 00:00:00 2001 From: Lin Kun Date: Sun, 24 Mar 2019 06:33:48 +0800 Subject: [PATCH 176/179] Fix: add the missing parameter '...' (#2695) --- autoload/SpaceVim/mapping.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/SpaceVim/mapping.vim b/autoload/SpaceVim/mapping.vim index fc2758b90..6d2337007 100644 --- a/autoload/SpaceVim/mapping.vim +++ b/autoload/SpaceVim/mapping.vim @@ -147,7 +147,7 @@ function! SpaceVim#mapping#vertical_split_previous_buffer(...) abort endif endfunction -function! SpaceVim#mapping#close_current_buffer() abort +function! SpaceVim#mapping#close_current_buffer(...) abort let buffers = get(g:, '_spacevim_list_buffers', []) let bn = bufnr('%') let f = '' From e12830d47b4d9759802852549883c375d8b8b2e2 Mon Sep 17 00:00:00 2001 From: Arnold Chand <3767728+thecreativenobody@users.noreply.github.com> Date: Tue, 26 Mar 2019 06:40:30 -0400 Subject: [PATCH 177/179] Update language-server-protocol.md (#2700) --- docs/layers/language-server-protocol.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/layers/language-server-protocol.md b/docs/layers/language-server-protocol.md index aba7f2871..544524e0a 100644 --- a/docs/layers/language-server-protocol.md +++ b/docs/layers/language-server-protocol.md @@ -22,7 +22,7 @@ This layers adds extensive support for [language-server-protocol](https://micros This layer is a heavy wallpaper of [LanguageClient-neovim](https://github.com/SpaceVim/LanguageClient-neovim) (an old fork), The upstream is rewritten by rust. -We also include [vim-lsp](https://github.com/prabirshrestha/vim-lsp), which is wrote in pure vim script. +We also include [vim-lsp](https://github.com/prabirshrestha/vim-lsp), which is written in pure vim script. Note that if `coc` is used as autocomplete method in the `autocomplete` layer, it will be used as lsp client. From bdb76f152a60b91d82dc26ae584aa5b42220adbf Mon Sep 17 00:00:00 2001 From: Stefan Lendl Date: Tue, 26 Mar 2019 15:35:14 +0100 Subject: [PATCH 178/179] Update denite to use file/rec instead of file_rec (#2702) --- autoload/SpaceVim/layers/denite.vim | 6 +++--- config/plugins/denite.vim | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autoload/SpaceVim/layers/denite.vim b/autoload/SpaceVim/layers/denite.vim index 1e94a5ec8..7be9e490a 100644 --- a/autoload/SpaceVim/layers/denite.vim +++ b/autoload/SpaceVim/layers/denite.vim @@ -111,7 +111,7 @@ function! SpaceVim#layers#denite#config() abort let lnum = expand('') + s:lnum - 1 call SpaceVim#mapping#space#def('nnoremap', ['f', 'f'], 'call call(' - \ . string(s:_function('s:warp_denite')) . ', ["DeniteBufferDir file_rec"])', + \ . string(s:_function('s:warp_denite')) . ', ["DeniteBufferDir file/rec"])', \ ['Find files in the directory of the current buffer', \ [ \ '[SPC f f] is to find files in the directory of the current buffer', @@ -123,7 +123,7 @@ function! SpaceVim#layers#denite#config() abort let lnum = expand('') + s:lnum - 1 call SpaceVim#mapping#space#def('nnoremap', ['p', 'f'], 'call call(' - \ . string(s:_function('s:warp_denite')) . ', ["Denite file_rec"])', + \ . string(s:_function('s:warp_denite')) . ', ["Denite file/rec"])', \ ['find files in current project', \ [ \ '[SPC p f] is to find files in the root of the current project', @@ -132,7 +132,7 @@ function! SpaceVim#layers#denite#config() abort \ ] \ ], \ 1) - nnoremap :call warp_denite('Denite file_rec') + nnoremap :call warp_denite('Denite file/rec') let lnum = expand('') + s:lnum - 1 diff --git a/config/plugins/denite.vim b/config/plugins/denite.vim index 7692e44b0..7d9b184d6 100644 --- a/config/plugins/denite.vim +++ b/config/plugins/denite.vim @@ -36,13 +36,13 @@ if !s:sys.isWindows if executable('rg') " For ripgrep " Note: It is slower than ag - call denite#custom#var('file_rec', 'command', + call denite#custom#var('file/rec', 'command', \ ['rg', '--hidden', '--files', '--glob', '!.git', '--glob', ''] \ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'rg') \ ) elseif executable('ag') - " Change file_rec command. - call denite#custom#var('file_rec', 'command', + " Change file/rec command. + call denite#custom#var('file/rec', 'command', \ ['ag' , '--nocolor', '--nogroup', '-g', ''] \ + zvim#util#Generate_ignore(g:spacevim_wildignore, 'ag') \ ) @@ -51,13 +51,13 @@ else if executable('pt') " For Pt(the platinum searcher) " NOTE: It also supports windows. - call denite#custom#var('file_rec', 'command', + call denite#custom#var('file/rec', 'command', \ ['pt', '--nocolor', '--ignore', '.git', '--hidden', '-g=', '']) endif endif -call denite#custom#alias('source', 'file_rec/git', 'file_rec') -call denite#custom#var('file_rec/git', 'command', +call denite#custom#alias('source', 'file/rec/git', 'file/rec') +call denite#custom#var('file/rec/git', 'command', \ ['git', 'ls-files', '-co', '--exclude-standard']) " FIND and GREP COMMANDS From 0271cd890a4f7ac18f9d9be85244ab130656a09a Mon Sep 17 00:00:00 2001 From: SallySoul Date: Wed, 27 Mar 2019 23:41:52 -0700 Subject: [PATCH 179/179] Could we add a lang#processing? (#2696) * :gift: Add first pass of lang#processing * Add processing.md --- autoload/SpaceVim/layers/lang/processing.vim | 49 ++++++++++++++++++ docs/layers/lang/processing.md | 54 ++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 autoload/SpaceVim/layers/lang/processing.vim create mode 100644 docs/layers/lang/processing.md diff --git a/autoload/SpaceVim/layers/lang/processing.vim b/autoload/SpaceVim/layers/lang/processing.vim new file mode 100644 index 000000000..21329cdde --- /dev/null +++ b/autoload/SpaceVim/layers/lang/processing.vim @@ -0,0 +1,49 @@ +"============================================================================= +" processing.vim --- SpaceVim lang#processing layer +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Russell Bentley < russell.w.bentley at icloud.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +"" +" @section lang#processing, layer-lang-processing +" @parentsection layers +" This layer is for Processing development: +" https://processing.org +" +" This is based on the work from https://github.com/sophacles/vim-processing +" +" Requirements: +" +" 1. You will need a copy of processing-java. The best way to do this is to get a copy of the Processing IDE from https://processing.org/download/ +" +" Once you have it, run it, and then select Tools -> install +" "processing-java" +" +" @subsection Mappings +" > +" Mode Key Function +" ----------------------------------------------- +" normal SPC l r execute current sketch +" < + +function! SpaceVim#layers#lang#processing#plugins() abort + let plugins = [ + \ ['sophacles/vim-processing', { 'on_ft' : 'processing' }], + \ ] + return plugins +endfunction + +function! SpaceVim#layers#lang#processing#config() abort + let runner = 'processing-java --force --output=/tmp/vim-processing --sketch=$(pwd)/$(dirname %s) --run' + call SpaceVim#plugins#runner#reg_runner('processing', runner) + call SpaceVim#mapping#space#regesit_lang_mappings('processing', + \ function('s:language_specified_mappings')) +endfunction + +function! s:language_specified_mappings() abort + call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'], + \ 'call SpaceVim#plugins#runner#open()', 'execute current file', 1) +endfunction + diff --git a/docs/layers/lang/processing.md b/docs/layers/lang/processing.md new file mode 100644 index 000000000..faa98a1c4 --- /dev/null +++ b/docs/layers/lang/processing.md @@ -0,0 +1,54 @@ +--- +title: "SpaceVim lang#processing layer" +description: "This layer is for working on Processing sketches. It provides sytnax checking and an app runner" +--- + +# [Available Layers](../../) >> lang#processing + + + +- [Description](#description) +- [Features](#features) +- [Install](#install) + - [Layer](#layer) +- [Key bindings](#key-bindings) + - [Code runner](#code-runner) + + + +## Description + +This layer is for working on Processing sketches. +It builds on top of the existing vim plugin [sophacles/vim-processing](https://github.com/sophacles/vim-processing). + +## Features + +- Syntax highlighting and indent +- Run sketches asynchonously + +## Install + +You will need to install the `processing-java` tool. +This is best done via the Processing IDE which can be obtained from the [processing website](https://processing.org/download/). +Once you have the IDE, you can select Tools -> install "processing-java". + +### Layer + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#processing" +``` + +## Key bindings + +| Key bindings | Descriptions | +| --------------- | -------------------------------- | +| `SPC l r` | Run your sketch | + +### Code runner + +You can build and run your sketch with `SPC l r`. +The sketch to run is decided based on the directory of you current buffer. +Note that the sketch is run asynchonously, so you are free to continue editing while it is running.