mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:40:05 +08:00
Add lang#goby layer (#3055)
This commit is contained in:
parent
ad8a7113f9
commit
7764c038c1
36
autoload/SpaceVim/layers/lang/goby.vim
Normal file
36
autoload/SpaceVim/layers/lang/goby.vim
Normal file
@ -0,0 +1,36 @@
|
||||
"=============================================================================
|
||||
" goby.vim --- goby 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#goby#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['wsdjeg/vim-goby', {'merged' : 0}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#goby#config() abort
|
||||
call SpaceVim#plugins#repl#reg('goby', 'goby -i')
|
||||
call SpaceVim#plugins#runner#reg_runner('goby', 'goby %s')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('goby', 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("goby")',
|
||||
\ '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
|
@ -38,6 +38,8 @@ endfunction
|
||||
function! SpaceVim#plugins#repl#send(type) abort
|
||||
if !exists('s:job_id')
|
||||
echom('Please start REPL via the key binding "SPC l s i" first.')
|
||||
elseif s:job_id == 0
|
||||
echom('please retart the REPL')
|
||||
else
|
||||
if a:type ==# 'line'
|
||||
call s:JOB.send(s:job_id, [getline('.'), ''])
|
||||
@ -130,6 +132,7 @@ function! s:on_exit(job_id, data, event) abort
|
||||
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, done)
|
||||
endif
|
||||
call s:update_statusline()
|
||||
let s:job_id = 0
|
||||
endfunction
|
||||
|
||||
function! s:update_statusline() abort
|
||||
|
@ -99,6 +99,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
|
||||
| [lang#extra](lang/extra/) | 这一模块为 SpaceVim 提供了一些不常见的语言添加语法支持,主要包括语法高亮、对齐等特性。 |
|
||||
| [lang#fsharp](lang/fsharp/) | 这一模块为 SpaceVim 提供了 FSharp 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#go](lang/go/) | 这一模块为 SpaceVim 提供了 Go 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#goby](lang/goby/) | 这一模块为 goby 开发提供支持,包括交互式编程、一键运行等特性。 |
|
||||
| [lang#groovy](lang/groovy/) | 这一模块为 Groovy 开发提供支持,包括交互式编程、一键运行等特性。 |
|
||||
| [lang#hack](lang/hack/) | 这一模块为 hack 开发提供支持,包括交互式编程、一键运行等特性。 |
|
||||
| [lang#haskell](lang/haskell/) | 这一模块为 SpaceVim 提供了 Haskell 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
|
50
docs/cn/layers/lang/goby.md
Normal file
50
docs/cn/layers/lang/goby.md
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
title: "SpaceVim lang#goby 模块"
|
||||
description: "这一模块为 goby 开发提供支持,包括交互式编程、一键运行等特性。"
|
||||
lang: cn
|
||||
---
|
||||
|
||||
# [可用模块](../../) >> lang#goby
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [模块简介](#模块简介)
|
||||
- [启用模块](#启用模块)
|
||||
- [快捷键](#快捷键)
|
||||
- [交互式编程](#交互式编程)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## 模块简介
|
||||
|
||||
这一模块为在 SpaceVim 中进行 goby 开发提供了支持。
|
||||
|
||||
## 启用模块
|
||||
|
||||
可通过在配置文件内加入如下配置来启用该模块:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#goby"
|
||||
```
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 交互式编程
|
||||
|
||||
启动 `goby -i` 交互进程,快捷键为: `SPC l s i`。
|
||||
|
||||
将代码传输给 REPL 进程执行:
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| ----------- | ----------------------- |
|
||||
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 goby 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||
|
||||
|
@ -106,6 +106,7 @@ Some layers are enabled by default. The following example shows how to disable `
|
||||
| [lang#extra](lang/extra/) | This layer adds extra language support to SpaceVim |
|
||||
| [lang#fsharp](lang/fsharp/) | This layer adds FSharp language support to SpaceVim |
|
||||
| [lang#go](lang/go/) | This layer is for golang development. It also provides additional language-specific key mappings. |
|
||||
| [lang#goby](lang/goby/) | This layer is for goby development, provide syntax checking, code runner and repl support for goby file. |
|
||||
| [lang#graphql](lang/graphql/) | This layer adds GraphQL file support to SpaceVim |
|
||||
| [lang#groovy](lang/groovy/) | This layer is for Groovy development, provide syntax checking, code runner and repl support for groovy file. |
|
||||
| [lang#hack](lang/hack/) | This layer is for hack development, provide syntax checking, code runner and repl support for hack file. |
|
||||
|
54
docs/layers/lang/goby.md
Normal file
54
docs/layers/lang/goby.md
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
title: "SpaceVim lang#goby layer"
|
||||
description: "This layer is for goby development, provide syntax checking, code runner and repl support for goby file."
|
||||
---
|
||||
|
||||
# [Available Layers](../../) >> lang#goby
|
||||
|
||||
<!-- 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 goby development.
|
||||
|
||||
## Install
|
||||
|
||||
To use this configuration layer, update custom configuration file with:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#goby"
|
||||
```
|
||||
## Features
|
||||
|
||||
- repl support
|
||||
- code runner
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Running current script
|
||||
|
||||
To running a goby 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 `goby -i` 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 |
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user