mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-13 02:05:40 +08:00
Add repl support for vlang && doc (#2928)
This commit is contained in:
parent
522670cb1e
commit
cbf1a7938e
@ -14,10 +14,24 @@ function! SpaceVim#layers#lang#v#plugins() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#v#config() abort
|
||||
call SpaceVim#plugins#repl#reg('vlang', 'vrepl')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('vlang', function('s:language_specified_mappings'))
|
||||
call SpaceVim#plugins#runner#reg_runner('vlang', 'v run %s')
|
||||
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("vlang")',
|
||||
\ '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
|
||||
|
@ -135,6 +135,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
|
||||
| [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 的的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [language-server-protocol](language-server-protocol/) | 这一模块为 SpaceVim 提供了 language server protocol 的支持,提供更多语言相关服务。 |
|
||||
|
49
docs/cn/layers/lang/v.md
Normal file
49
docs/cn/layers/lang/v.md
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
title: "SpaceVim lang#v 模块"
|
||||
description: "这一模块为 v 开发提供支持,包括交互式编程、一键运行等特性。"
|
||||
lang: cn
|
||||
---
|
||||
|
||||
# [可用模块](../../) >> lang#v
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [模块简介](#模块简介)
|
||||
- [启用模块](#启用模块)
|
||||
- [快捷键](#快捷键)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
- [交互式编程](#交互式编程)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## 模块简介
|
||||
|
||||
这一模块为在 SpaceVim 中进行 v 开发提供了支持。
|
||||
|
||||
## 启用模块
|
||||
|
||||
可通过在配置文件内加入如下配置来启用该模块:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#v"
|
||||
```
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 v 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||
|
||||
### 交互式编程
|
||||
|
||||
启动 `vrepl` 交互进程,快捷键为: `SPC l s i`。
|
||||
|
||||
将代码传输给 REPL 进程执行:
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| ----------- | ----------------------- |
|
||||
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||
|
@ -144,6 +144,7 @@ Some layers are enabled by default. The following example shows how to disable `
|
||||
| [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 |
|
||||
| [language-server-protocol](language-server-protocol/) | This layers provides language server protocol for vim and neovim |
|
||||
|
53
docs/layers/lang/v.md
Normal file
53
docs/layers/lang/v.md
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
title: "SpaceVim lang#v layer"
|
||||
description: "This layer is for v development, provide syntax checking, code runner and repl support for v file."
|
||||
---
|
||||
|
||||
# [Available Layers](../../) >> lang#v
|
||||
|
||||
<!-- 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 v development.
|
||||
|
||||
## Install
|
||||
|
||||
To use this configuration layer, update custom configuration file with:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#v"
|
||||
```
|
||||
## Features
|
||||
|
||||
- repl support
|
||||
- code runner
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Running current script
|
||||
|
||||
To running a v 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 `vrepl` 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…
x
Reference in New Issue
Block a user