diff --git a/autoload/SpaceVim/layers/lang/batch.vim b/autoload/SpaceVim/layers/lang/batch.vim new file mode 100644 index 000000000..fe9cbc733 --- /dev/null +++ b/autoload/SpaceVim/layers/lang/batch.vim @@ -0,0 +1,37 @@ +"============================================================================= +" batch.vim --- MS-DOS batch file support +" Copyright (c) 2016-2019 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg@outlook.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +function! SpaceVim#layers#lang#batch#plugins() abort + let plugins = [] + call add(plugins, ['wsdjeg/vim-batch', { 'merged' : 0}]) + return plugins +endfunction + +function! SpaceVim#layers#lang#batch#config() abort + call SpaceVim#plugins#repl#reg('batch', 'cmd') + call SpaceVim#plugins#runner#reg_runner('batch', 'cmd /c %s') + call SpaceVim#mapping#space#regesit_lang_mappings('batch', 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("batch")', + \ '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/batch.md b/docs/cn/layers/lang/batch.md new file mode 100644 index 000000000..82c58774d --- /dev/null +++ b/docs/cn/layers/lang/batch.md @@ -0,0 +1,50 @@ +--- +title: "SpaceVim lang#batch 模块" +description: "这一模块为 batch 开发提供支持,包括交互式编程、一键运行等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#batch + + + +- [模块简介](#模块简介) +- [启用模块](#启用模块) +- [快捷键](#快捷键) + - [交互式编程](#交互式编程) + - [运行当前脚本](#运行当前脚本) + + + +## 模块简介 + +这一模块为在 SpaceVim 中进行 batch 开发提供了支持。 + +## 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#batch" +``` + +## 快捷键 + +### 交互式编程 + +启动 `cmd` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 功能描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | + +### 运行当前脚本 + +在编辑 batch 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + + diff --git a/docs/layers/lang/batch.md b/docs/layers/lang/batch.md new file mode 100644 index 000000000..63d078efd --- /dev/null +++ b/docs/layers/lang/batch.md @@ -0,0 +1,55 @@ +--- +title: "SpaceVim lang#batch layer" +description: "This layer is for DOS batch file development, provide syntax highlighting, code runner and repl support for batch file." +--- + +# [Available Layers](../../) >> lang#batch + + + +- [Description](#description) +- [Install](#install) +- [Features](#features) +- [Key bindings](#key-bindings) + - [Running current script](#running-current-script) + - [Inferior REPL process](#inferior-repl-process) + + + +## Description + +This layer is for DOS batch file development, which provides syntax highlighting, code runner and repl support for batch file. + +## Install + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#batch" +``` +## Features + +- repl support +- code runner + +## Key bindings + +### Running current script + +To running a batch file, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. + +### Inferior REPL process + +Start a `cmd` inferior REPL process with `SPC l s i`. + +Send code to inferior process commands: + +| Key Bindings | Descriptions | +| ------------ | ------------------------------------------------ | +| `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 | + + + diff --git a/wiki/en/programming-languages.md b/wiki/en/programming-languages.md index 20f89e6e5..1fdf94df0 100644 --- a/wiki/en/programming-languages.md +++ b/wiki/en/programming-languages.md @@ -10,6 +10,7 @@ | Dart | lang#dart | | Elixir | lang#elixir | | Elm | lang#elm | +| DOS batch | lang#batch | | F# | lang#fsharp | | Go | lang#go | | Goby | lang#goby | @@ -172,7 +173,6 @@ | MOO | | | Moto | | | MQL4: MQL4, MQL5 | | -| MS-DOS batch | | | MUMPS | | | NATURAL | | | Nemerle | |