1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:20:06 +08:00

Add lang#d layer (#2923)

This commit is contained in:
Wang Shidong 2019-07-05 22:59:13 +08:00 committed by GitHub
parent 50761ff92b
commit 04893990f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 377 additions and 273 deletions

View File

@ -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

View File

@ -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 = '^<!-- SpaceVim follow HEAD en start -->$'
let s:AUTODOC.end = '^<!-- SpaceVim follow HEAD en 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 = '^<!-- SpaceVim follow HEAD en start -->$'
let s:AUTODOC.end = '^<!-- SpaceVim follow HEAD en 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

View File

@ -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 <buffer> call <SID>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 <buffer> call <SID>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

View File

@ -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

View File

@ -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

View File

@ -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 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |

36
docs/cn/layers/lang/d.md Normal file
View File

@ -0,0 +1,36 @@
---
title: "SpaceVim lang#d 模块"
description: "这一模块为 d 开发提供支持,包括语法高亮、自动补全、一键运行等特性。"
lang: cn
---
# [可用模块](../../) >> lang#d
<!-- vim-markdown-toc GFM -->
- [模块简介](#模块简介)
- [启用模块](#启用模块)
- [快捷键](#快捷键)
- [运行当前脚本](#运行当前脚本)
<!-- vim-markdown-toc -->
## 模块简介
这一模块为在 SpaceVim 中进行 d 开发提供了支持。
## 启用模块
可通过在配置文件内加入如下配置来启用该模块:
```toml
[[layers]]
name = "lang#d"
```
## 快捷键
### 运行当前脚本
在编辑 d 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。

View File

@ -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:

View File

@ -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. |

39
docs/layers/lang/d.md Normal file
View File

@ -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
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
- [Features](#features)
- [Key bindings](#key-bindings)
- [Running current script](#running-current-script)
<!-- vim-markdown-toc -->
## 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.

View File

@ -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