mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
Add repl support for d lang (#2924)
This commit is contained in:
parent
04893990f0
commit
88cba94a09
@ -19,9 +19,23 @@ endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#d#config() abort
|
||||
call SpaceVim#plugins#runner#reg_runner('d', 'dmd -run %s')
|
||||
call SpaceVim#plugins#repl#reg('d', 'dub run drepl')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('d', 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("d")',
|
||||
\ '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
|
||||
|
@ -12,6 +12,7 @@ lang: cn
|
||||
- [启用模块](#启用模块)
|
||||
- [快捷键](#快捷键)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
- [交互式编程](#交互式编程)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -28,9 +29,26 @@ lang: cn
|
||||
name = "lang#d"
|
||||
```
|
||||
|
||||
安装D语言交互式编程工具:
|
||||
|
||||
```sh
|
||||
dub fetch drepl
|
||||
```
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 d 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||
|
||||
### 交互式编程
|
||||
|
||||
启动 `dub run drepl` 交互进程,快捷键为: `SPC l s i`。
|
||||
|
||||
将代码传输给 REPL 进程执行:
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| ----------- | ----------------------- |
|
||||
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||
|
@ -11,8 +11,8 @@ lang: cn
|
||||
- [模块简介](#模块简介)
|
||||
- [启用模块](#启用模块)
|
||||
- [快捷键](#快捷键)
|
||||
- [交互式编程](#交互式编程)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
- [交互式编程](#交互式编程)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -31,6 +31,10 @@ lang: cn
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 pact 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||
|
||||
### 交互式编程
|
||||
|
||||
启动 `pact` 交互进程,快捷键为: `SPC l s i`。
|
||||
@ -42,8 +46,3 @@ lang: cn
|
||||
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 pact 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||
|
||||
|
@ -12,6 +12,7 @@ description: "This layer is for d development, provide syntax checking, code run
|
||||
- [Features](#features)
|
||||
- [Key bindings](#key-bindings)
|
||||
- [Running current script](#running-current-script)
|
||||
- [Inferior REPL process](#inferior-repl-process)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
@ -27,9 +28,17 @@ To use this configuration layer, update custom configuration file with:
|
||||
[[layers]]
|
||||
name = "lang#d"
|
||||
```
|
||||
|
||||
Install the REPL tool for D language.
|
||||
|
||||
```sh
|
||||
dub fetch drepl
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- code runner
|
||||
- repl support
|
||||
|
||||
## Key bindings
|
||||
|
||||
@ -37,3 +46,15 @@ To use this configuration layer, update custom configuration file with:
|
||||
|
||||
To running a d 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 `dub run drepl` 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