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

Add: add new layer lang#j (#3032)

This commit is contained in:
Wang Shidong 2019-09-04 13:57:38 +08:00 committed by GitHub
parent bef3683c1b
commit 4d6ebb590e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,46 @@
"=============================================================================
" j.vim --- lang#j layer
" Copyright (c) 2016-2019 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
function! SpaceVim#layers#lang#j#plugins() abort
let plugins = []
call add(plugins, ['wsdjeg/j', { 'merged' : 0}])
return plugins
endfunction
let s:jconsole_bin = 'jconsole'
function! SpaceVim#layers#lang#j#config() abort
call SpaceVim#plugins#repl#reg('j', shellescape(s:jconsole_bin))
call SpaceVim#plugins#runner#reg_runner('j', shellescape(s:jconsole_bin) . ' %s')
call SpaceVim#mapping#space#regesit_lang_mappings('j', function('s:language_specified_mappings'))
endfunction
function! SpaceVim#layers#lang#j#set_variable(var) abort
let s:jconsole_bin = get(a:var, 'jconsole-bin', s:jconsole_bin)
endfunction
function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
call SpaceVim#mapping#space#langSPC('nmap', ['l','b'], 'call SpaceVim#api#import("job").start("jhs")', 'open browser IDE', 1)
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
\ 'call SpaceVim#plugins#repl#start("j")',
\ '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

@ -105,6 +105,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
| [lang#html](lang/html/) | 这一模块为 SpaceVim 提供了 HTML 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#hy](lang/hy/) | 这一模块为 hy 开发提供支持,包括交互式编程、一键运行等特性。 |
| [lang#ipynb](lang/ipynb/) | 该模块为 SpaceVim 添加了 Jupyter Notebook 支持,包括语法高亮、代码折叠等特点。 |
| [lang#j](lang/j/) | 这一模块为 j 开发提供支持,包括交互式编程和语法高亮。 |
| [lang#java](lang/java/) | 这一模块为 Java 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#javascript](lang/javascript/) | 这一模块为 JavaScript 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#julia](lang/julia/) | 这一模块为 Julia 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |

47
docs/cn/layers/lang/j.md Normal file
View File

@ -0,0 +1,47 @@
---
title: "SpaceVim lang#j 模块"
description: "这一模块为 j 开发提供支持,包括交互式编程和语法高亮。"
lang: cn
---
# [可用模块](../../) >> lang#j
<!-- vim-markdown-toc GFM -->
- [模块简介](#模块简介)
- [启用模块](#启用模块)
- [快捷键](#快捷键)
- [交互式编程](#交互式编程)
<!-- vim-markdown-toc -->
## 模块简介
这一模块为在 SpaceVim 中进行 j 开发提供了支持。
## 启用模块
可通过在配置文件内加入如下配置来启用该模块:
```toml
[[layers]]
name = "lang#j"
```
## 快捷键
| 快捷键 | 功能描述 |
| --------- | -------------- |
| `SPC l b` | 打开网页版 IDE |
### 交互式编程
启动 `jconsole` 交互进程,快捷键为: `SPC l s i`
将代码传输给 REPL 进程执行:
| 快捷键 | 功能描述 |
| ----------- | ----------------------- |
| `SPC l s b` | 发送整个文件内容至 REPL |
| `SPC l s l` | 发送当前行内容至 REPL |
| `SPC l s s` | 发送已选中的内容至 REPL |

View File

@ -113,6 +113,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. |
| [lang#hy](lang/hy/) | This layer is for hy development, provide syntax checking, code runner and repl support for hy file. |
| [lang#ipynb](lang/ipynb/) | This layer adds Jupyter Notebook support to SpaceVim |
| [lang#j](lang/j/) | This layer is for j development, provide syntax checking and repl support for j file. |
| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. |
| [lang#javascript](lang/javascript/) | This layer provides JavaScript development support for SpaceVim, including code completion, syntax highlighting and syntax checking |
| [lang#julia](lang/julia/) | This layer is for Julia development, provide autocompletion, syntax checking and code formatting |

51
docs/layers/lang/j.md Normal file
View File

@ -0,0 +1,51 @@
---
title: "SpaceVim lang#j layer"
description: "This layer is for j development, provide syntax checking and repl support for j file."
---
# [Available Layers](../../) >> lang#j
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Install](#install)
- [Features](#features)
- [Key bindings](#key-bindings)
- [Inferior REPL process](#inferior-repl-process)
<!-- vim-markdown-toc -->
## Description
This layer is for [j language](https://www.jsoftware.com/#/) development.
## Install
To use this configuration layer, update custom configuration file with:
```toml
[[layers]]
name = "lang#j"
```
## Features
- repl support
## Key bindings
| Key Bindings | Descriptions |
| ------------ | ---------------- |
| `SPC l b` | open browser IDE |
### Inferior REPL process
Start a `jconsole` 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 |