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

Add lang#ring layer (#3311)

This commit is contained in:
Wang Shidong 2020-01-29 21:27:15 +08:00 committed by GitHub
parent cd1ac44984
commit de79995a34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 197 additions and 3 deletions

View File

@ -0,0 +1,48 @@
"=============================================================================
" ring.vim --- ring language 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#ring#plugins() abort
let plugins = []
call add(plugins, ['wsdjeg/vim-ring', { 'merged' : 0}])
return plugins
endfunction
let s:ring_repl = ''
function! SpaceVim#layers#lang#ring#config() abort
call SpaceVim#plugins#repl#reg('ring', 'ring ' . shellescape(s:ring_repl))
call SpaceVim#plugins#runner#reg_runner('ring', 'ring %s')
call SpaceVim#mapping#space#regesit_lang_mappings('ring', function('s:language_specified_mappings'))
endfunction
function! SpaceVim#layers#lang#ring#set_variable(opt) abort
let s:ring_repl = get(a:opt, 'ring_repl', s:ring_repl)
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("ring")',
\ '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
function! SpaceVim#layers#lang#ring#get_options() abort
return ['ring_repl']
endfunction

View File

@ -89,6 +89,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
| [lang#autohotkey](lang/autohotkey/) | 这一模块为 SpaceVim 提供了 Autohotkey 的开发支持,包括语法高亮和自动补全等功能。 |
| [lang#batch](lang/batch/) | 这一模块为 batch 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#c](lang/c/) | 这一模块为 SpaceVim 提供了 C/C++/Object-C 的开发支持,包括代码补全、语法检查等特性。 |
| [lang#chapel](lang/chapel/) | 这一模块为 chapel 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#clojure](lang/clojure/) | 这一模块为 SpaceVim 提供了 Clojure 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#crystal](lang/crystal/) | 这一模块为 crystal 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#csharp](lang/csharp/) | 这一模块为 SpaceVim 提供了 CSharp 的开发支持,包括代码高亮、对齐、补全等特性。 |
@ -126,6 +127,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
| [lang#nim](lang/nim/) | 该模块为 SpaceVim 提供 Nim 开发支持,包括语法高亮、代码补全、编译运行以及交互式编程等功能。 |
| [lang#ocaml](lang/ocaml/) | 这一模块为 OCaml 开发提供了支持,包括语法高亮、代码补全、以及定义处跳转等功能。 |
| [lang#pact](lang/pact/) | 这一模块为 pact 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#pascal](lang/pascal/) | 这一模块为 pascal 开发提供支持,包括一键运行等特性。 |
| [lang#perl](lang/perl/) | 这一模块为 Perl 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#php](lang/php/) | 这一模块为 SpaceVim 提供了 PHP 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#plantuml](lang/plantuml/) | 这一模块为 SpaceVim 提供了 PlantUML 的开发支持,包括语法高亮、实时预览等特性。 |
@ -138,17 +140,20 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
| [lang#r](lang/r/) | 这一模块为 R 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#racket](lang/racket/) | 该模块为 SpaceVim 提供了 racket 语言开发支持,包括语法高亮、语言服务器支持。 |
| [lang#red](lang/red/) | 这一模块为 Red 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#ring](lang/ring/) | 这一模块为 ring 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#ruby](lang/ruby/) | 这一模块为 Ruby 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#rust](lang/rust/) | 这一模块为 Rust 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#scala](lang/scala/) | 这一模块为 Scala 开发提供支持,包括语法高亮,函数列表等特性。 |
| [lang#scheme](lang/scheme/) | 这一模块为 SpaceVim 提供了 Scheme 语言开发支持,包括语法高亮、语言服务器支持。 |
| [lang#sh](lang/sh/) | 这一模块为 SpaceVim 提供了 Shell Script 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#slim](lang/slim/) | 这一模块为 slim 开发提供支持,主要包括了语法高亮。 |
| [lang#swift](lang/swift/) | 这一模块为 SpaceVim 提供了 Swift 的开发支持,包括语法高亮、语法检查等特性。 |
| [lang#tcl](lang/tcl/) | 这一模块为 Tcl 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#typescript](lang/typescript/) | 这一模块为 SpaceVim 提供了 TypeScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#v](lang/v/) | 这一模块为 v 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#vim](lang/vim/) | 这一模块为 SpaceVim 提供了 Vimscript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#vue](lang/vue/) | 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#wolfram](lang/wolfram/) | 这一模块为 wolfram 开发提供支持,包括交互式编程、一键运行等特性。 |
| [language-server-protocol](language-server-protocol/) | 这一模块为 SpaceVim 提供了 language server protocol 的支持,提供更多语言相关服务。 |
| [leaderf](leaderf/) | 这一模块为 SpaceVim 提供了以 leaderf 为核心的异步模糊查找机制,支持模糊搜索文件、历史记录、函数列表等。 |
| [shell](shell/) | 这一模块为 SpaceVim 提供了终端集成特性,优化内置终端的使用体验。 |

View File

@ -0,0 +1,65 @@
---
title: "SpaceVim lang#ring 模块"
description: "这一模块为 ring 开发提供支持,包括交互式编程、一键运行等特性。"
lang: zh
---
# [可用模块](../../) >> lang#ring
<!-- vim-markdown-toc GFM -->
- [模块简介](#模块简介)
- [启用模块](#启用模块)
- [模块选项](#模块选项)
- [快捷键](#快捷键)
- [交互式编程](#交互式编程)
- [运行当前脚本](#运行当前脚本)
<!-- vim-markdown-toc -->
## 模块简介
这一模块为在 SpaceVim 中进行 ring 开发提供了支持。
## 启用模块
可通过在配置文件内加入如下配置来启用该模块:
```toml
[[layers]]
name = "lang#ring"
```
## 模块选项
该模块提供如下模块选项:
- `ring_repl`: 指定文件 `ringrepl.ring` 的具体位置。
例如:
```toml
[[layers]]
name = 'lang#ring'
ring_repl = 'D:\ringrepl\repl.ring'
```
## 快捷键
### 交互式编程
启动 `ring path/to/ringrepl.ring` 交互进程,快捷键为: `SPC l s i`
将代码传输给 REPL 进程执行:
| 快捷键 | 功能描述 |
| ----------- | ----------------------- |
| `SPC l s b` | 发送整个文件内容至 REPL |
| `SPC l s l` | 发送当前行内容至 REPL |
| `SPC l s s` | 发送已选中的内容至 REPL |
### 运行当前脚本
在编辑 ring 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。

View File

@ -76,12 +76,12 @@ Some layers are enabled by default. The following example shows how to disable `
| [core#tabline](core/tabline/) | SpaceVim core#tabline layer provides a better tabline for SpaceVim |
| [core](core/) | SpaceVim core layer provides many default key bindings and features. |
| [cscope](cscope/) | cscope layer provides a smart cscope and pycscope helper for SpaceVim, help users win at cscope |
| [ctrlspace](ctrlspace/) | This layer provides a customized CtrlSpace centric workflow |
| [ctrlp](ctrlp/) | This layers provide a heavily customized ctrlp centric work-flow |
| [ctrlspace](ctrlspace/) | This layer provides a customized CtrlSpace centric workflow |
| [debug](debug/) | This layer provide debug workflow support in SpaceVim |
| [default](default/) | SpaceVim default layer contains no plugins, but It provides some better default config for SpaceVim. |
| [denite](denite/) | This layers provide a heavily customized Denite centric work-flow |
| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text objects. |
| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. |
| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. |
| [format](format/) | Code formatting support for SpaceVim |
| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow |
@ -96,6 +96,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#autohotkey](lang/autohotkey/) | This layer adds AutohotKey language support to SpaceVim. |
| [lang#batch](lang/batch/) | This layer is for DOS batch file development, provide syntax highlighting, code runner and repl support for batch file. |
| [lang#c](lang/c/) | C/C++/Object-C language support for SpaceVim, include code completion, jump to definition, quick runner. |
| [lang#chapel](lang/chapel/) | This layer is for chapel development, provide syntax checking, code runner and repl support for chapel file. |
| [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#crystal](lang/crystal/) | This layer is for crystal development, provide syntax checking, code runner and repl support for crystal file. |
@ -133,8 +134,10 @@ Some layers are enabled by default. The following example shows how to disable `
| [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#nix](lang/nix/) | This layer adds Nix 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 pact file. |
| [lang#pascal](lang/pascal/) | This layer is for pascal development, provides syntax highlighting, code runner for pascal 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. |
@ -148,17 +151,20 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#r](lang/r/) | This layer is for R development, provide autocompletion, syntax checking and code format. |
| [lang#racket](lang/racket/) | This layer adds racket language support to SpaceVim, including syntax highlighting, code runner and REPL support. |
| [lang#red](lang/red/) | This layer is for Red development, provide autocompletion, syntax checking and code format. |
| [lang#ring](lang/ring/) | This layer is for ring development, provide syntax checking, code runner and repl support for ring file. |
| [lang#ruby](lang/ruby/) | This layer is for Ruby development, provide autocompletion, syntax checking, code format for Ruby file. |
| [lang#rust](lang/rust/) | This layer is for Rust development, provide autocompletion, syntax checking, code format for Rust file. |
| [lang#scala](lang/scala/) | This layer adds Scala language support to SpaceVim |
| [lang#scheme](lang/scheme/) | This layer adds Scheme language support to SpaceVim |
| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. |
| [lang#slim](lang/slim/) | This layer is for slim development, includes syntax highlighting for slim file. |
| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion, syntax highlighting |
| [lang#tcl](lang/tcl/) | This layer is for Tcl development, provide syntax checking, code runner and repl support for tcl file. |
| [lang#typescript](lang/typescript/) | This layer is for TypeScript development, includding code completion, Syntax lint, and doc generation. |
| [lang#v](lang/v/) | This layer is for v development, provide syntax checking, code runner and repl support for v file. |
| [lang#vim](lang/vim/) | This layer is for writting Vimscript, including code completion, syntax checking and buffer formatting |
| [lang#vue](lang/vue/) | This layer adds Vue language support to SpaceVim |
| [lang#wolfram](lang/wolfram/) | This layer is for walfram development, provide syntax checking, code runner and repl support for walfram file. |
| [language-server-protocol](language-server-protocol/) | This layers provides language server protocol for vim and neovim |
| [leaderf](leaderf/) | This layers provide a heavily customized LeaderF centric work-flow |
| [shell](shell/) | This layer provide shell support in SpaceVim |

70
docs/layers/lang/ring.md Normal file
View File

@ -0,0 +1,70 @@
---
title: "SpaceVim lang#ring layer"
description: "This layer is for ring development, provide syntax checking, code runner and repl support for ring file."
---
# [Available Layers](../../) >> lang#ring
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
- [Options](#options)
- [Features](#features)
- [Key bindings](#key-bindings)
- [Running current script](#running-current-script)
- [Inferior REPL process](#inferior-repl-process)
<!-- vim-markdown-toc -->
## Description
This layer is for ring development.
## Install
To use this configuration layer, update custom configuration file with:
```toml
[[layers]]
name = "lang#ring"
```
## Options
This layer provides following layer options:
- `ring_repl`: specific the the of `ringrepl.ring` file.
for example:
```toml
[[layers]]
name = 'lang#ring'
ring_repl = 'D:\ringrepl\repl.ring'
```
## Features
- repl support
- code runner
## Key bindings
### Running current script
To running a ring 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 `ring path/to/ringrepl.ring` 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 |

View File

@ -49,6 +49,7 @@
| R | [lang#r](https://spacevim.org/layers/lang/r/) |
| Racket | [lang#racket](https://spacevim.org/layers/lang/racket/) |
| Red | [lang#red](https://spacevim.org/layers/lang/red/) |
| Ring | [lang#ring](https://spacevim.org/layers/lang/ring) |
| Ruby | [lang#ruby](https://spacevim.org/layers/lang/ruby/) |
| Rust | [lang#rust](https://spacevim.org/layers/lang/rust/) |
| Scala | [lang#scala](https://spacevim.org/layers/lang/scala/) |
@ -209,7 +210,6 @@
| Q | |
| REBOL | |
| REXX | |
| Ring | |
| RPG | |
| S-PLUS | |
| S | |