From b1114b20b562871f0dc949672ba3ad3e4e17ef1b Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Wed, 26 Jun 2019 23:46:15 +0800 Subject: [PATCH] Add lang#livescript layer (#2913) --- autoload/SpaceVim/layers/lang/livescript.vim | 36 +++++++++++++ docs/cn/index.md | 7 +++ docs/cn/layers.md | 1 + docs/cn/layers/lang/livescript.md | 49 ++++++++++++++++++ docs/index.md | 7 +++ docs/layers.md | 3 +- docs/layers/lang/livescript.md | 53 ++++++++++++++++++++ docs/layers/lang/pact.md | 2 +- 8 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 autoload/SpaceVim/layers/lang/livescript.vim create mode 100644 docs/cn/layers/lang/livescript.md create mode 100644 docs/layers/lang/livescript.md diff --git a/autoload/SpaceVim/layers/lang/livescript.vim b/autoload/SpaceVim/layers/lang/livescript.vim new file mode 100644 index 000000000..64998d77d --- /dev/null +++ b/autoload/SpaceVim/layers/lang/livescript.vim @@ -0,0 +1,36 @@ +"============================================================================= +" livescript.vim --- LiveScript support in SpaceVim +" Copyright (c) 2016-2019 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg@outlook.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + +function! SpaceVim#layers#lang#livescript#plugins() abort + let plugins = [] + call add(plugins, ['wsdjeg/vim-livescript', { 'merged' : 0}]) + return plugins +endfunction + +function! SpaceVim#layers#lang#livescript#config() abort + call SpaceVim#plugins#repl#reg('livescript', 'lsc') + call SpaceVim#plugins#runner#reg_runner('livescript', 'lsc %s') + call SpaceVim#mapping#space#regesit_lang_mappings('livescript', 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("livescript")', + \ '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/index.md b/docs/cn/index.md index 48a7552d3..6f20660da 100644 --- a/docs/cn/index.md +++ b/docs/cn/index.md @@ -53,6 +53,13 @@ SpaceVim 是一个社区驱动的模块化的 Vim IDE,以模块的方式组织 是的,通过模块的方式,将各种功能封装成相应的模块,对多种语言提供了语言开发模块,目标是尝试模拟简易的集成开发环境。 +- SpaceVim 支持多少种编程语言? + +```sh +~/.SpaceVim> ls autoload/SpaceVim/layers/lang | wc -l +68 +``` + - SpaceVim 支持什么版本的 Vim/Neovim? 建议使用 Vim 7.4 或者 Neovim v0.1.7及其以上版本。 diff --git a/docs/cn/layers.md b/docs/cn/layers.md index 0e7cac0ec..d6aa45add 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -108,6 +108,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [lang#kotlin](lang/kotlin/) | 该模块为 SpaceVim 提供了 Kotlin 语言开发支持,包括语法高亮、语言服务器支持。 | | [lang#latex](lang/latex/) | 这一模块为 LaTex 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#lisp](lang/lisp/) | 这一模块为 Lisp 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | +| [lang#livescript](lang/livescript/) | 这一模块为 livescript 开发提供支持,包括交互式编程、一键运行等特性。 | | [lang#lua](lang/lua/) | 这一模块为 Lua 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#markdown](lang/markdown/) | 这一模块为 Markdown 编辑提供支持,包括格式化、自动生成文章目录、代码块等特性。 | | [lang#matlab](lang/matlab/) | 该模块为 SpaceVim 提供了 matlab 语言开发支持,包括语法高亮。 | diff --git a/docs/cn/layers/lang/livescript.md b/docs/cn/layers/lang/livescript.md new file mode 100644 index 000000000..cb0da8e06 --- /dev/null +++ b/docs/cn/layers/lang/livescript.md @@ -0,0 +1,49 @@ +--- +title: "SpaceVim lang#livescript 模块" +description: "这一模块为 livescript 开发提供支持,包括交互式编程、一键运行等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#livescript + + + +- [模块简介](#模块简介) +- [启用模块](#启用模块) +- [快捷键](#快捷键) + - [交互式编程](#交互式编程) + - [运行当前脚本](#运行当前脚本) + + + +## 模块简介 + +这一模块为在 SpaceVim 中进行 livescript 开发提供了支持。 + +## 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#livescript" +``` + +## 快捷键 + +### 交互式编程 + +启动 `lsc` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 功能描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | + +### 运行当前脚本 + +在编辑 livescript 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + diff --git a/docs/index.md b/docs/index.md index c8eda97c7..a2810a5ce 100644 --- a/docs/index.md +++ b/docs/index.md @@ -66,6 +66,13 @@ for development progress and the [roadmap](roadmap/) for high-level plans. With layers feature, this version of Vim distribution try to turn Vim/Neovim into an IDE for many languages. +- How many programming languages does SpaceVim support? + +```sh +~/.SpaceVim> ls autoload/SpaceVim/layers/lang | wc -l +68 +``` + - Which version of Vim/Neovim is needed? Vim 7.4/Neovim v0.1.7, and `+lua` or `+python3` is needed. diff --git a/docs/layers.md b/docs/layers.md index 23f9d6ba2..c77713062 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -116,12 +116,13 @@ Some layers are enabled by default. The following example shows how to disable ` | [lang#kotlin](lang/kotlin/) | This layer adds Kotlin language support to SpaceVim, including syntax highlighting, code runner and REPL support. | | [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#livescript](lang/livescript/) | This layer is for livescript development, provide syntax checking, code runner and repl support for livescript 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#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 hy file. | +| [lang#pact](lang/pact/) | This layer is for pact development, provide syntax checking, code runner and repl support for pact 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/livescript.md b/docs/layers/lang/livescript.md new file mode 100644 index 000000000..33350cea8 --- /dev/null +++ b/docs/layers/lang/livescript.md @@ -0,0 +1,53 @@ +--- +title: "SpaceVim lang#livescript layer" +description: "This layer is for livescript development, provide syntax checking, code runner and repl support for livescript file." +--- + +# [Available Layers](../../) >> lang#livescript + + + +- [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 livescript development. + +## Install + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#livescript" +``` +## Features + +- repl support +- code runner + +## Key bindings + +### Running current script + +To running a livescript 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 `lsc` 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 a4f51e341..194188fdd 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 hy file." +description: "This layer is for pact development, provide syntax checking, code runner and repl support for pact file." --- # [Available Layers](../../) >> lang#pact