From 04893990f02256215c1b17044e978bbccfc429eb Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Fri, 5 Jul 2019 22:59:13 +0800 Subject: [PATCH] Add lang#d layer (#2923) --- .SpaceVim.d/README.md | 12 +- .../autoload/SpaceVim/dev/followHEAD.vim | 124 +++++----- .../autoload/SpaceVim/dev/issuemanager.vim | 82 +++---- autoload/SpaceVim/api/neovim/gui.vim | 86 +++---- autoload/SpaceVim/layers/lang/d.vim | 27 +++ docs/cn/layers.md | 3 +- docs/cn/layers/lang/d.md | 36 +++ docs/install.cmd | 216 +++++++++--------- docs/layers.md | 1 + docs/layers/lang/d.md | 39 ++++ test/plugin/a.vader | 24 +- 11 files changed, 377 insertions(+), 273 deletions(-) create mode 100644 autoload/SpaceVim/layers/lang/d.vim create mode 100644 docs/cn/layers/lang/d.md create mode 100644 docs/layers/lang/d.md diff --git a/.SpaceVim.d/README.md b/.SpaceVim.d/README.md index 434f05755..1bad5adb8 100644 --- a/.SpaceVim.d/README.md +++ b/.SpaceVim.d/README.md @@ -1,6 +1,6 @@ -# SpaceVim development - -## Bumb version - -1. change the value of `g:spacevim_version` -2. change version in docs/install.sh, docs/install.cmd, docs/cn/install.sh, docs/cn/install.cmd +# SpaceVim development + +## Bumb version + +1. change the value of `g:spacevim_version` +2. change version in docs/install.sh, docs/install.cmd, docs/cn/install.sh, docs/cn/install.cmd diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim b/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim index 8ea592cdb..afebf0774 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim @@ -1,62 +1,62 @@ -"============================================================================= -" followHEAD.vim --- generate follow HEAD page -" Copyright (c) 2016-2017 Wang Shidong & Contributors -" Author: Wang Shidong < wsdjeg at 163.com > -" URL: https://spacevim.org -" License: GPLv3 -"============================================================================= - -let s:AUTODOC = SpaceVim#api#import('dev#autodoc') -let s:AUTODOC.begin = '^$' -let s:AUTODOC.end = '^$' - -function! s:generate_content() abort - let content = s:follow_head_content() - return content -endfunction - -let s:AUTODOC.content_func = function('s:generate_content') -let s:AUTODOC.autoformat = 1 - -let s:lang = 'en' -function! SpaceVim#dev#followHEAD#update(lang) abort - let s:lang = a:lang - call s:AUTODOC.update() -endfunction - - -function! s:list_closed_prs(owner, repo, page) abort - return github#api#util#Get('repos/' . a:owner . '/' . a:repo . '/issues?state=closed&page=' . a:page , []) -endfunction - -function! s:get_list_of_PRs() abort - let prs = [] - for i in range(1, 2) - let issues = s:list_closed_prs('SpaceVim','SpaceVim', i) - call extend(prs, - \ filter(issues, - \ "v:val['number'] > " - \ . SpaceVim#dev#releases#last_release_number() - \ . " && v:val['number'] < " - \ . SpaceVim#dev#releases#current_release_number() - \ . " && index(SpaceVim#dev#releases#unmerged_prs_since_current_release(), v:val['number']) == -1 " - \ )) - endfor - for i in SpaceVim#dev#releases#get_unmerged_prs() - let pr = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', i) - if get(pr, 'state', '') ==# 'closed' - call add(prs, pr) - endif - endfor - return filter(prs, "has_key(v:val, 'pull_request')") -endfunction - -let s:prs = [] -function! s:follow_head_content() abort - let md = [] - if s:prs == [] - let s:prs =s:get_list_of_PRs() - endif - let md = md + SpaceVim#dev#releases#parser_prs(s:prs, s:lang) - return md -endfunction +"============================================================================= +" followHEAD.vim --- generate follow HEAD page +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +let s:AUTODOC = SpaceVim#api#import('dev#autodoc') +let s:AUTODOC.begin = '^$' +let s:AUTODOC.end = '^$' + +function! s:generate_content() abort + let content = s:follow_head_content() + return content +endfunction + +let s:AUTODOC.content_func = function('s:generate_content') +let s:AUTODOC.autoformat = 1 + +let s:lang = 'en' +function! SpaceVim#dev#followHEAD#update(lang) abort + let s:lang = a:lang + call s:AUTODOC.update() +endfunction + + +function! s:list_closed_prs(owner, repo, page) abort + return github#api#util#Get('repos/' . a:owner . '/' . a:repo . '/issues?state=closed&page=' . a:page , []) +endfunction + +function! s:get_list_of_PRs() abort + let prs = [] + for i in range(1, 2) + let issues = s:list_closed_prs('SpaceVim','SpaceVim', i) + call extend(prs, + \ filter(issues, + \ "v:val['number'] > " + \ . SpaceVim#dev#releases#last_release_number() + \ . " && v:val['number'] < " + \ . SpaceVim#dev#releases#current_release_number() + \ . " && index(SpaceVim#dev#releases#unmerged_prs_since_current_release(), v:val['number']) == -1 " + \ )) + endfor + for i in SpaceVim#dev#releases#get_unmerged_prs() + let pr = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', i) + if get(pr, 'state', '') ==# 'closed' + call add(prs, pr) + endif + endfor + return filter(prs, "has_key(v:val, 'pull_request')") +endfunction + +let s:prs = [] +function! s:follow_head_content() abort + let md = [] + if s:prs == [] + let s:prs =s:get_list_of_PRs() + endif + let md = md + SpaceVim#dev#releases#parser_prs(s:prs, s:lang) + return md +endfunction diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/issuemanager.vim b/.SpaceVim.d/autoload/SpaceVim/dev/issuemanager.vim index 9ab3b227e..1d4a62b2e 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/issuemanager.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/issuemanager.vim @@ -1,41 +1,41 @@ -"============================================================================= -" issuemanager.vim --- issue manager for SpaceVim development -" Copyright (c) 2016-2017 Wang Shidong & Contributors -" Author: Wang Shidong < wsdjeg at 163.com > -" URL: https://spacevim.org -" License: GPLv3 -"============================================================================= - -function! SpaceVim#dev#issuemanager#edit(id) abort - let issue = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', a:id) - exe 'silent tabnew ++ff=unix ' . tempname() . '/issue_' . a:id . '.md' - let content = split(issue.body, "\n") - let b:current_issue = issue - call setline(1, map(content, "substitute(v:val, ' $', '', 'g')")) - augroup spacevim_dev_issuemanager - autocmd! - autocmd BufWritePost call update_issue() - augroup END -endfunction - - -function! s:update_issue() abort - let issue = get(b:, 'current_issue', {}) - if !empty(issue) - let new = {'title' : issue.title, - \ 'body' : join(getline(1, '$'), "\n")} - redraw - call inputsave() - let username = input('github username:') - let password = input('github password:') - call inputrestore() - let respons = github#api#issues#Edit('SpaceVim', 'SpaceVim', issue.number, username, password, new) - normal! : - if !empty(respons) && get(respons, 'number', 0) == issue.number - echon 'Issue ' . issue.number . ' has been updated!' - elseif !empty(respons) - let msg = get(respons, 'message', '') - echon 'Failed to update issue ' . issue.number . ':' . msg - endif - endif -endfunction +"============================================================================= +" issuemanager.vim --- issue manager for SpaceVim development +" Copyright (c) 2016-2017 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +function! SpaceVim#dev#issuemanager#edit(id) abort + let issue = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', a:id) + exe 'silent tabnew ++ff=unix ' . tempname() . '/issue_' . a:id . '.md' + let content = split(issue.body, "\n") + let b:current_issue = issue + call setline(1, map(content, "substitute(v:val, ' $', '', 'g')")) + augroup spacevim_dev_issuemanager + autocmd! + autocmd BufWritePost call update_issue() + augroup END +endfunction + + +function! s:update_issue() abort + let issue = get(b:, 'current_issue', {}) + if !empty(issue) + let new = {'title' : issue.title, + \ 'body' : join(getline(1, '$'), "\n")} + redraw + call inputsave() + let username = input('github username:') + let password = input('github password:') + call inputrestore() + let respons = github#api#issues#Edit('SpaceVim', 'SpaceVim', issue.number, username, password, new) + normal! : + if !empty(respons) && get(respons, 'number', 0) == issue.number + echon 'Issue ' . issue.number . ' has been updated!' + elseif !empty(respons) + let msg = get(respons, 'message', '') + echon 'Failed to update issue ' . issue.number . ':' . msg + endif + endif +endfunction diff --git a/autoload/SpaceVim/api/neovim/gui.vim b/autoload/SpaceVim/api/neovim/gui.vim index b9d2e4707..d957f97b1 100644 --- a/autoload/SpaceVim/api/neovim/gui.vim +++ b/autoload/SpaceVim/api/neovim/gui.vim @@ -1,43 +1,43 @@ -"============================================================================= -" gui.vim --- gui api for SpaceVim -" Copyright (c) 2016-2019 Wang Shidong & Contributors -" Author: Wang Shidong < wsdjeg at 163.com > -" URL: https://spacevim.org -" License: GPLv3 -"============================================================================= - - -let s:self = {} - - -function! s:self.gui_name() abort - if !has('nvim-0.3') - return '' - endif - - let uis = nvim_list_uis() - if len(uis) == 0 - echoerr "No UIs are attached" - return - endif - - " Use the last UI in the list - let ui_chan = uis[-1].chan - let info = nvim_get_chan_info(ui_chan) - return get(info.client, 'name', '') -endfunction - - -function! s:self.toggle_tabline(enable) abort - call rpcnotify(0, 'Gui', 'Option', 'Tabline', a:enable) -endfunction - -function! s:self.toggle_popupmenu(enable) abort - call rpcnotify(0, 'Gui', 'Option', 'Popupmenu', a:enable) -endfunction - -function! SpaceVim#api#neovim#gui#get() - - return deepcopy(s:self) - -endfunction +"============================================================================= +" gui.vim --- gui api for SpaceVim +" Copyright (c) 2016-2019 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg at 163.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +let s:self = {} + + +function! s:self.gui_name() abort + if !has('nvim-0.3') + return '' + endif + + let uis = nvim_list_uis() + if len(uis) == 0 + echoerr "No UIs are attached" + return + endif + + " Use the last UI in the list + let ui_chan = uis[-1].chan + let info = nvim_get_chan_info(ui_chan) + return get(info.client, 'name', '') +endfunction + + +function! s:self.toggle_tabline(enable) abort + call rpcnotify(0, 'Gui', 'Option', 'Tabline', a:enable) +endfunction + +function! s:self.toggle_popupmenu(enable) abort + call rpcnotify(0, 'Gui', 'Option', 'Popupmenu', a:enable) +endfunction + +function! SpaceVim#api#neovim#gui#get() + + return deepcopy(s:self) + +endfunction diff --git a/autoload/SpaceVim/layers/lang/d.vim b/autoload/SpaceVim/layers/lang/d.vim new file mode 100644 index 000000000..e2786482c --- /dev/null +++ b/autoload/SpaceVim/layers/lang/d.vim @@ -0,0 +1,27 @@ +"============================================================================= +" d.vim --- D programming language support +" Copyright (c) 2016-2019 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg@outlook.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +function! SpaceVim#layers#lang#d#plugins() abort + let plugins = [] + call add(plugins, ['wsdjeg/vim-dlang', {'merged' : 0}]) + if g:spacevim_autocomplete_method ==# 'deoplete' + call add(plugins, ['landaire/deoplete-d', {'merged' : 0}]) + endif + return plugins +endfunction + + +function! SpaceVim#layers#lang#d#config() abort + call SpaceVim#plugins#runner#reg_runner('d', 'dmd -run %s') + call SpaceVim#mapping#space#regesit_lang_mappings('d', 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) +endfunction diff --git a/docs/cn/layers.md b/docs/cn/layers.md index 21b8f65c4..751ad4f1d 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -89,6 +89,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [lang#c](lang/c/) | 这一模块为 SpaceVim 提供了 C/C++/Object-C 的开发支持,包括代码补全、语法检查等特性。 | | [lang#clojure](lang/clojure/) | 这一模块为 SpaceVim 提供了 Clojure 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#csharp](lang/csharp/) | 这一模块为 SpaceVim 提供了 CSharp 的开发支持,包括代码高亮、对齐、补全等特性。 | +| [lang#d](lang/d/) | 这一模块为 d 开发提供支持,包括语法高亮、自动补全、一键运行等特性。 | | [lang#dart](lang/dart/) | 这一模块为 SpaceVim 提供了 Dart 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#dockerfile](lang/dockerfile/) | 这一模块为 SpaceVim 提供了 Dockerfile 编辑的部分功能支持,包括语法高亮和自动补全。 | | [lang#elixir](lang/elixir/) | 这一模块为 SpaceVim 提供了 Elixir 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | @@ -101,7 +102,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [lang#haskell](lang/haskell/) | 这一模块为 SpaceVim 提供了 Haskell 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#html](lang/html/) | 这一模块为 SpaceVim 提供了 HTML 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#hy](lang/hy/) | 这一模块为 hy 开发提供支持,包括交互式编程、一键运行等特性。 | -| [lang#ipynb](lang/ipynb/) | 该模块为SpaceVim添加了 Jupyter Notebook 支持,包括语法高亮、代码折叠等特点。 | +| [lang#ipynb](lang/ipynb/) | 该模块为 SpaceVim 添加了 Jupyter Notebook 支持,包括语法高亮、代码折叠等特点。 | | [lang#java](lang/java/) | 这一模块为 Java 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#javascript](lang/javascript/) | 这一模块为 JavaScript 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#julia](lang/julia/) | 这一模块为 Julia 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | diff --git a/docs/cn/layers/lang/d.md b/docs/cn/layers/lang/d.md new file mode 100644 index 000000000..01f3e0bb1 --- /dev/null +++ b/docs/cn/layers/lang/d.md @@ -0,0 +1,36 @@ +--- +title: "SpaceVim lang#d 模块" +description: "这一模块为 d 开发提供支持,包括语法高亮、自动补全、一键运行等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#d + + + +- [模块简介](#模块简介) +- [启用模块](#启用模块) +- [快捷键](#快捷键) + - [运行当前脚本](#运行当前脚本) + + + +## 模块简介 + +这一模块为在 SpaceVim 中进行 d 开发提供了支持。 + +## 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#d" +``` + +## 快捷键 + +### 运行当前脚本 + +在编辑 d 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + diff --git a/docs/install.cmd b/docs/install.cmd index c416945bf..97f933e44 100644 --- a/docs/install.cmd +++ b/docs/install.cmd @@ -1,108 +1,108 @@ -@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF - -echo " /###### /## /##/## " -echo " /##__ ## | ## | #|__/ " -echo " | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### " -echo " | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ##" -echo " \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ##" -echo " /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ##" -echo " | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ##" -echo " \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/" -echo " | ## " -echo " | ## " -echo " |__/ " -echo " version : 1.2.0-dev by : spacevim.org " - -Push-Location ~ - -$app_name = "SpaceVim" -$repo_url = "https://github.com/SpaceVim/SpaceVim.git" -$repo_name = "SpaceVim" -$repo_path = "$HOME\.SpaceVim" - -Function Pause ($Message = "Press any key to continue . . . ") { - if ((Test-Path variable:psISE) -and $psISE) { - $Shell = New-Object -ComObject "WScript.Shell" - $Button = $Shell.Popup("Click OK to continue.", 0, "Script Paused", 0) - } else { - Write-Host -NoNewline $Message - [void][System.Console]::ReadKey($true) - Write-Host - } -} - -echo "==> Starting Testing Procedure..." -echo "" -sleep 1 - - -echo "==> Testing git" -if (Get-Command "git" -ErrorAction SilentlyContinue) { - git version - echo "[OK] Test successfully. Moving to next..." - sleep 1 -} else { - echo "" - echo "[ERROR] Unable to find 'git.exe' in your PATH" - echo ">>> Ready to Exit......" - Pause - exit -} - -echo "" - -echo "==> Testing vim" -if (Get-Command "gvim" -ErrorAction SilentlyContinue) { - echo ($(vim --version) -split '\n')[0] - echo "[OK] Test successfully. Moving to next..." - sleep 1 -} else { - echo "[WARNING] Unable to find 'gvim.exe' in your PATH. But intallation still can continue..." - echo "" - echo "[WARNING] Please install gvim later or make your PATH correctly set! " - Pause -} - -echo "<== Testing Procedure Completed. Moving to next..." -sleep 1 -echo "" -echo "" - -if (!(Test-Path "$HOME\.SpaceVim")) { - echo "==> Trying to clone $app_name" - git clone $repo_url $repo_path -} else { - echo "==> Trying to update $app_name" - Push-Location $repo_path - git pull origin master -} - -echo "" - -if (!(Test-Path "$HOME\vimfiles")) { - cmd /c mklink $HOME\vimfiles $repo_path -} else { - echo "[OK] vimfiles already exists" - sleep 1 -} -echo "" - -if (!(Test-Path "$HOME\AppData\Local\nvim")) { - cmd /c mklink "$HOME\AppData\Local\nvim" $repo_path -} else { - echo "[OK] $HOME\AppData\Local\nvim already exists" - sleep 1 -} - -echo "" -echo "Almost done!" -echo "==============================================================================" -echo "== Open GVim and it will install the plugins automatically ==" -echo "==============================================================================" -echo "" -echo "That's it. Thanks for installing $app_name. Enjoy!" -echo "" - -Pause - -# vim:set ft=ps1: +@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF + +echo " /###### /## /##/## " +echo " /##__ ## | ## | #|__/ " +echo " | ## \__/ /###### /###### /####### /######| ## | ##/##/######/#### " +echo " | ###### /##__ ##|____ ##/##_____//##__ #| ## / ##| #| ##_ ##_ ##" +echo " \____ #| ## \ ## /######| ## | ########\ ## ##/| #| ## \ ## \ ##" +echo " /## \ #| ## | ##/##__ #| ## | ##_____/ \ ###/ | #| ## | ## | ##" +echo " | ######| #######| ######| ######| ####### \ #/ | #| ## | ## | ##" +echo " \______/| ##____/ \_______/\_______/\_______/ \_/ |__|__/ |__/ |__/" +echo " | ## " +echo " | ## " +echo " |__/ " +echo " version : 1.2.0-dev by : spacevim.org " + +Push-Location ~ + +$app_name = "SpaceVim" +$repo_url = "https://github.com/SpaceVim/SpaceVim.git" +$repo_name = "SpaceVim" +$repo_path = "$HOME\.SpaceVim" + +Function Pause ($Message = "Press any key to continue . . . ") { + if ((Test-Path variable:psISE) -and $psISE) { + $Shell = New-Object -ComObject "WScript.Shell" + $Button = $Shell.Popup("Click OK to continue.", 0, "Script Paused", 0) + } else { + Write-Host -NoNewline $Message + [void][System.Console]::ReadKey($true) + Write-Host + } +} + +echo "==> Starting Testing Procedure..." +echo "" +sleep 1 + + +echo "==> Testing git" +if (Get-Command "git" -ErrorAction SilentlyContinue) { + git version + echo "[OK] Test successfully. Moving to next..." + sleep 1 +} else { + echo "" + echo "[ERROR] Unable to find 'git.exe' in your PATH" + echo ">>> Ready to Exit......" + Pause + exit +} + +echo "" + +echo "==> Testing vim" +if (Get-Command "gvim" -ErrorAction SilentlyContinue) { + echo ($(vim --version) -split '\n')[0] + echo "[OK] Test successfully. Moving to next..." + sleep 1 +} else { + echo "[WARNING] Unable to find 'gvim.exe' in your PATH. But intallation still can continue..." + echo "" + echo "[WARNING] Please install gvim later or make your PATH correctly set! " + Pause +} + +echo "<== Testing Procedure Completed. Moving to next..." +sleep 1 +echo "" +echo "" + +if (!(Test-Path "$HOME\.SpaceVim")) { + echo "==> Trying to clone $app_name" + git clone $repo_url $repo_path +} else { + echo "==> Trying to update $app_name" + Push-Location $repo_path + git pull origin master +} + +echo "" + +if (!(Test-Path "$HOME\vimfiles")) { + cmd /c mklink $HOME\vimfiles $repo_path +} else { + echo "[OK] vimfiles already exists" + sleep 1 +} +echo "" + +if (!(Test-Path "$HOME\AppData\Local\nvim")) { + cmd /c mklink "$HOME\AppData\Local\nvim" $repo_path +} else { + echo "[OK] $HOME\AppData\Local\nvim already exists" + sleep 1 +} + +echo "" +echo "Almost done!" +echo "==============================================================================" +echo "== Open GVim and it will install the plugins automatically ==" +echo "==============================================================================" +echo "" +echo "That's it. Thanks for installing $app_name. Enjoy!" +echo "" + +Pause + +# vim:set ft=ps1: diff --git a/docs/layers.md b/docs/layers.md index c14e03c79..5e69cdbed 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -96,6 +96,7 @@ Some layers are enabled by default. The following example shows how to disable ` | [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#d](lang/d/) | This layer is for d development, provide syntax checking, code runner support for d file. | | [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. | diff --git a/docs/layers/lang/d.md b/docs/layers/lang/d.md new file mode 100644 index 000000000..e5f8c3c68 --- /dev/null +++ b/docs/layers/lang/d.md @@ -0,0 +1,39 @@ +--- +title: "SpaceVim lang#d layer" +description: "This layer is for d development, provide syntax checking, code runner support for d file." +--- + +# [Available Layers](../../) >> lang#d + + + +- [Description](#description) +- [Install](#install) +- [Features](#features) +- [Key bindings](#key-bindings) + - [Running current script](#running-current-script) + + + +## Description + +This layer is for d development. + +## Install + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#d" +``` +## Features + +- code runner + +## Key bindings + +### Running current script + +To running a d file, 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/test/plugin/a.vader b/test/plugin/a.vader index 922809363..0aa2fc144 100644 --- a/test/plugin/a.vader +++ b/test/plugin/a.vader @@ -1,12 +1,12 @@ -Execute ( SpaceVim plugin: a.vim ): - call SpaceVim#plugins#a#set_config_name('.projections.json') - let root = SpaceVim#plugins#a#get_root() - AssertEqual SpaceVim#plugins#a#get_alt('docs/index.md', root), 'docs/cn/index.md' - AssertEqual SpaceVim#plugins#a#get_alt('docs/cn/index.md', root), 'docs/index.md' - AssertEqual SpaceVim#plugins#a#get_alt('docs/api/job.md', root), 'docs/cn/api/job.md' - AssertEqual SpaceVim#plugins#a#get_alt('docs/cn/api/job.md', root), 'docs/api/job.md' - AssertEqual SpaceVim#plugins#a#get_alt('wiki/en/Project-layout.md', root), 'wiki/cn/Project-layout.md' - AssertEqual SpaceVim#plugins#a#get_alt('wiki/cn/Project-layout.md', root), 'wiki/en/Project-layout.md' - AssertEqual SpaceVim#plugins#a#get_alt('docs/_posts/2018-09-28-use-vim-as-ide.md', root), 'docs/_posts/2018-09-27-use-vim-as-ide.md' - unlet root - +Execute ( SpaceVim plugin: a.vim ): + call SpaceVim#plugins#a#set_config_name('.projections.json') + let root = SpaceVim#plugins#a#get_root() + AssertEqual SpaceVim#plugins#a#get_alt('docs/index.md', root), 'docs/cn/index.md' + AssertEqual SpaceVim#plugins#a#get_alt('docs/cn/index.md', root), 'docs/index.md' + AssertEqual SpaceVim#plugins#a#get_alt('docs/api/job.md', root), 'docs/cn/api/job.md' + AssertEqual SpaceVim#plugins#a#get_alt('docs/cn/api/job.md', root), 'docs/api/job.md' + AssertEqual SpaceVim#plugins#a#get_alt('wiki/en/Project-layout.md', root), 'wiki/cn/Project-layout.md' + AssertEqual SpaceVim#plugins#a#get_alt('wiki/cn/Project-layout.md', root), 'wiki/en/Project-layout.md' + AssertEqual SpaceVim#plugins#a#get_alt('docs/_posts/2018-09-28-use-vim-as-ide.md', root), 'docs/_posts/2018-09-27-use-vim-as-ide.md' + unlet root +