diff --git a/autoload/SpaceVim/layers/lang/hy.vim b/autoload/SpaceVim/layers/lang/hy.vim new file mode 100644 index 000000000..f19c17f90 --- /dev/null +++ b/autoload/SpaceVim/layers/lang/hy.vim @@ -0,0 +1,37 @@ +"============================================================================= +" hy.vim --- hy language support for SpaceVim +" Copyright (c) 2016-2019 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg@outlook.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +function! SpaceVim#layers#lang#hy#plugins() abort + let plugins = [] + call add(plugins, ['hylang/vim-hy', { 'merged' : 0}]) + return plugins +endfunction + +function! SpaceVim#layers#lang#hy#config() abort + call SpaceVim#plugins#repl#reg('hy', 'hy') + call SpaceVim#plugins#runner#reg_runner('hy', 'hy %s') + call SpaceVim#mapping#space#regesit_lang_mappings('hy', 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("hy")', + \ '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 e6742210e..0e7cac0ec 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -100,6 +100,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [lang#groovy](lang/groovy/) | 这一模块为 Groovy 开发提供支持,包括交互式编程、一键运行等特性。 | | [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#java](lang/java/) | 这一模块为 Java 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#javascript](lang/javascript/) | 这一模块为 JavaScript 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | diff --git a/docs/cn/layers/lang/hy.md b/docs/cn/layers/lang/hy.md new file mode 100644 index 000000000..3ea1054f3 --- /dev/null +++ b/docs/cn/layers/lang/hy.md @@ -0,0 +1,49 @@ +--- +title: "SpaceVim lang#hy 模块" +description: "这一模块为 hy 开发提供支持,包括交互式编程、一键运行等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#hy + + + +- [模块简介](#模块简介) +- [启用模块](#启用模块) +- [快捷键](#快捷键) + - [交互式编程](#交互式编程) + - [运行当前脚本](#运行当前脚本) + + + +## 模块简介 + +这一模块为在 SpaceVim 中进行 hy 开发提供了支持。 + +## 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#hy" +``` + +## 快捷键 + +### 交互式编程 + +启动 `hy` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 功能描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | + +### 运行当前脚本 + +在编辑 hy 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + diff --git a/docs/layers.md b/docs/layers.md index 0e0925bf6..23f9d6ba2 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -108,6 +108,7 @@ Some layers are enabled by default. The following example shows how to disable ` | [lang#groovy](lang/groovy/) | This layer is for Groovy development, provide syntax checking, code runner and repl support for groovy file. | | [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#hy](lang/hy/) | This layer is for hy development, provide syntax checking, code runner and repl support for hy file. | | [lang#ipynb](lang/ipynb/) | This layer adds Jupyter Notebook support to SpaceVim | | [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 | @@ -120,7 +121,7 @@ Some layers are enabled by default. The following example shows how to disable ` | [lang#matlab](lang/matlab/) | This layer adds matlab language support to SpaceVim, including syntax highlighting. | | [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#pact](lang/pact/) | This layer is for pact development, provide syntax checking, code runner and repl support for tcl file. | +| [lang#pact](lang/pact/) | This layer is for pact development, provide syntax checking, code runner and repl support for hy file. | | [lang#perl](lang/perl/) | This layer is for Perl development, provide autocompletion, syntax checking, code format for Perl file. | | [lang#php](lang/php/) | PHP language support, including code completion, syntax lint and code runner | | [lang#plantuml](lang/plantuml/) | This layer is for PlantUML development, syntax highlighting for PlantUML file. | diff --git a/docs/layers/lang/hy.md b/docs/layers/lang/hy.md new file mode 100644 index 000000000..7a882d19c --- /dev/null +++ b/docs/layers/lang/hy.md @@ -0,0 +1,53 @@ +--- +title: "SpaceVim lang#hy layer" +description: "This layer is for hy development, provide syntax checking, code runner and repl support for hy file." +--- + +# [Available Layers](../../) >> lang#hy + + + +- [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 hy development. + +## Install + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#hy" +``` +## Features + +- repl support +- code runner + +## Key bindings + +### Running current script + +To running a hy 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 `hy` 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/docs/layers/lang/pact.md b/docs/layers/lang/pact.md index b1cd0c1ce..a4f51e341 100644 --- a/docs/layers/lang/pact.md +++ b/docs/layers/lang/pact.md @@ -1,6 +1,6 @@ --- title: "SpaceVim lang#pact layer" -description: "This layer is for pact development, provide syntax checking, code runner and repl support for tcl file." +description: "This layer is for pact development, provide syntax checking, code runner and repl support for hy file." --- # [Available Layers](../../) >> lang#pact