1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:10:05 +08:00

Add lang#pact layer (#2907)

This commit is contained in:
Wang Shidong 2019-06-23 14:32:44 +08:00 committed by GitHub
parent 8f32ca8740
commit 817fe3a4a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 141 additions and 0 deletions

View File

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

View File

@ -112,6 +112,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
| [lang#matlab](lang/matlab/) | 该模块为 SpaceVim 提供了 matlab 语言开发支持,包括语法高亮。 |
| [lang#nim](lang/nim/) | 该模块为 SpaceVim 提供 Nim 开发支持,包括语法高亮、代码补全、编译运行以及交互式编程等功能。 |
| [lang#ocaml](lang/ocaml/) | 这一模块为 OCaml 开发提供了支持,包括语法高亮、代码补全、以及定义处跳转等功能。 |
| [lang#pact](lang/pact/) | 这一模块为 pact 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#perl](lang/perl/) | 这一模块为 Perl 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#php](lang/php/) | 这一模块为 SpaceVim 提供了 PHP 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#plantuml](lang/plantuml/) | 这一模块为 SpaceVim 提供了 PlantUML 的开发支持,包括语法高亮、实时预览等特性。 |

View File

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

View File

@ -120,6 +120,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#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. |

53
docs/layers/lang/pact.md Normal file
View File

@ -0,0 +1,53 @@
---
title: "SpaceVim lang#pact layer"
description: "This layer is for pact development, provide syntax checking, code runner and repl support for tcl file."
---
# [Available Layers](../../) >> lang#pact
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
- [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 pact development.
## Install
To use this configuration layer, update custom configuration file with:
```toml
[[layers]]
name = "lang#pact"
```
## Features
- repl support
- code runner
## Key bindings
### Running current script
To running a pact 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 `pact` 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 |