mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-09 10:00:04 +08:00
Add lang#moonscript layer (#3704)
This commit is contained in:
parent
f95d7f5959
commit
543a9913e8
65
autoload/SpaceVim/layers/lang/moonscript.vim
Normal file
65
autoload/SpaceVim/layers/lang/moonscript.vim
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
"=============================================================================
|
||||||
|
" moonscript.vim --- moonscript support for SpaceVim
|
||||||
|
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||||
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||||
|
" URL: https://spacevim.org
|
||||||
|
" License: GPLv3
|
||||||
|
"=============================================================================
|
||||||
|
|
||||||
|
""
|
||||||
|
" @section lang#moonscript, layer-lang-moonscript
|
||||||
|
" @parentsection layers
|
||||||
|
" This layer is for moonscript development, disabled by default, to enable this
|
||||||
|
" layer, add following snippet to your SpaceVim configuration file.
|
||||||
|
" >
|
||||||
|
" [[layers]]
|
||||||
|
" name = 'lang#moonscript'
|
||||||
|
" <
|
||||||
|
"
|
||||||
|
" @subsection Key bindings
|
||||||
|
" >
|
||||||
|
" Key Function
|
||||||
|
" -----------------------------
|
||||||
|
" SPC l r Run current moonscript
|
||||||
|
" <
|
||||||
|
"
|
||||||
|
" This layer also provides REPL support for moonscript, the key bindings are:
|
||||||
|
" >
|
||||||
|
" Key Function
|
||||||
|
" ---------------------------------------------
|
||||||
|
" SPC l s i Start a inferior REPL process
|
||||||
|
" SPC l s b send whole buffer
|
||||||
|
" SPC l s l send current line
|
||||||
|
" SPC l s s send selection text
|
||||||
|
" <
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
function! SpaceVim#layers#lang#moonscript#plugins() abort
|
||||||
|
let plugins = []
|
||||||
|
call add(plugins, ['leafo/moonscript-vim', {'merged' : 0}])
|
||||||
|
return plugins
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! SpaceVim#layers#lang#moonscript#config() abort
|
||||||
|
call SpaceVim#plugins#repl#reg('moon', 'mooni')
|
||||||
|
call SpaceVim#plugins#runner#reg_runner('moon', 'moon %s')
|
||||||
|
call SpaceVim#mapping#space#regesit_lang_mappings('moon', 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("moonscript")',
|
||||||
|
\ '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
|
104
doc/SpaceVim.txt
104
doc/SpaceVim.txt
@ -123,42 +123,43 @@ CONTENTS *SpaceVim-contents*
|
|||||||
47. lang#kotlin.............................|SpaceVim-layer-lang-kotlin|
|
47. lang#kotlin.............................|SpaceVim-layer-lang-kotlin|
|
||||||
48. lang#livescript.....................|SpaceVim-layer-lang-livescript|
|
48. lang#livescript.....................|SpaceVim-layer-lang-livescript|
|
||||||
49. lang#lua...................................|SpaceVim-layer-lang-lua|
|
49. lang#lua...................................|SpaceVim-layer-lang-lua|
|
||||||
50. lang#nim...................................|SpaceVim-layer-lang-nim|
|
50. lang#moonscript.....................|SpaceVim-layer-lang-moonscript|
|
||||||
51. lang#nix...................................|SpaceVim-layer-lang-nix|
|
51. lang#nim...................................|SpaceVim-layer-lang-nim|
|
||||||
52. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
|
52. lang#nix...................................|SpaceVim-layer-lang-nix|
|
||||||
53. lang#pact.................................|SpaceVim-layer-lang-pact|
|
53. lang#ocaml...............................|SpaceVim-layer-lang-ocaml|
|
||||||
54. lang#php...................................|SpaceVim-layer-lang-php|
|
54. lang#pact.................................|SpaceVim-layer-lang-pact|
|
||||||
55. lang#pony.................................|SpaceVim-layer-lang-pony|
|
55. lang#php...................................|SpaceVim-layer-lang-php|
|
||||||
56. lang#processing.....................|SpaceVim-layer-lang-processing|
|
56. lang#pony.................................|SpaceVim-layer-lang-pony|
|
||||||
57. lang#prolog.............................|SpaceVim-layer-lang-prolog|
|
57. lang#processing.....................|SpaceVim-layer-lang-processing|
|
||||||
58. lang#puppet.............................|SpaceVim-layer-lang-puppet|
|
58. lang#prolog.............................|SpaceVim-layer-lang-prolog|
|
||||||
59. lang#python.............................|SpaceVim-layer-lang-python|
|
59. lang#puppet.............................|SpaceVim-layer-lang-puppet|
|
||||||
60. lang#racket.............................|SpaceVim-layer-lang-racket|
|
60. lang#python.............................|SpaceVim-layer-lang-python|
|
||||||
61. lang#racket................................|SpaceVim-layer-lang-red|
|
61. lang#racket.............................|SpaceVim-layer-lang-racket|
|
||||||
62. lang#ring....................................|SpaceVim-layer-lang-r|
|
62. lang#racket................................|SpaceVim-layer-lang-red|
|
||||||
63. lang#ring.................................|SpaceVim-layer-lang-ring|
|
63. lang#ring....................................|SpaceVim-layer-lang-r|
|
||||||
64. lang#ruby.................................|SpaceVim-layer-lang-ruby|
|
64. lang#ring.................................|SpaceVim-layer-lang-ring|
|
||||||
65. lang#rust.................................|SpaceVim-layer-lang-rust|
|
65. lang#ruby.................................|SpaceVim-layer-lang-ruby|
|
||||||
66. lang#scala...............................|SpaceVim-layer-lang-scala|
|
66. lang#rust.................................|SpaceVim-layer-lang-rust|
|
||||||
67. lang#scheme.............................|SpaceVim-layer-lang-scheme|
|
67. lang#scala...............................|SpaceVim-layer-lang-scala|
|
||||||
68. lang#sh.....................................|SpaceVim-layer-lang-sh|
|
68. lang#scheme.............................|SpaceVim-layer-lang-scheme|
|
||||||
69. lang#swig................................|SpaceVim-layer-lang-swift|
|
69. lang#sh.....................................|SpaceVim-layer-lang-sh|
|
||||||
70. lang#swig.................................|SpaceVim-layer-lang-swig|
|
70. lang#swig................................|SpaceVim-layer-lang-swift|
|
||||||
71. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
71. lang#swig.................................|SpaceVim-layer-lang-swig|
|
||||||
72. lang#toml.................................|SpaceVim-layer-lang-toml|
|
72. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
||||||
73. lang#typescript.....................|SpaceVim-layer-lang-typescript|
|
73. lang#toml.................................|SpaceVim-layer-lang-toml|
|
||||||
74. lang#v.......................................|SpaceVim-layer-lang-v|
|
74. lang#typescript.....................|SpaceVim-layer-lang-typescript|
|
||||||
75. lang#vbnet...............................|SpaceVim-layer-lang-vbnet|
|
75. lang#v.......................................|SpaceVim-layer-lang-v|
|
||||||
76. lang#xml...................................|SpaceVim-layer-lang-xml|
|
76. lang#vbnet...............................|SpaceVim-layer-lang-vbnet|
|
||||||
77. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
77. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||||
78. language server protocol........................|SpaceVim-layer-lsp|
|
78. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
||||||
79. leaderf.....................................|SpaceVim-layer-leaderf|
|
79. language server protocol........................|SpaceVim-layer-lsp|
|
||||||
80. operator...................................|SpaceVim-layer-operator|
|
80. leaderf.....................................|SpaceVim-layer-leaderf|
|
||||||
81. shell.........................................|SpaceVim-layer-shell|
|
81. operator...................................|SpaceVim-layer-operator|
|
||||||
82. test...........................................|SpaceVim-layer-test|
|
82. shell.........................................|SpaceVim-layer-shell|
|
||||||
83. tmux...........................................|SpaceVim-layer-tmux|
|
83. test...........................................|SpaceVim-layer-test|
|
||||||
84. tools#dash...............................|SpaceVim-layer-tools-dash|
|
84. tmux...........................................|SpaceVim-layer-tmux|
|
||||||
85. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
85. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||||
|
86. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
||||||
7. Usage....................................................|SpaceVim-usage|
|
7. Usage....................................................|SpaceVim-usage|
|
||||||
1. custom_plugins........................|SpaceVim-usage-custom_plugins|
|
1. custom_plugins........................|SpaceVim-usage-custom_plugins|
|
||||||
2. tasks..........................................|SpaceVim-usage-tasks|
|
2. tasks..........................................|SpaceVim-usage-tasks|
|
||||||
@ -2269,7 +2270,7 @@ MAPPINGS
|
|||||||
|
|
||||||
Mode Key Function
|
Mode Key Function
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
normal SPC l g r run gradle run
|
normal SPC l g r run gradle run
|
||||||
normal SPC l g b run gradle build
|
normal SPC l g b run gradle build
|
||||||
normal SPC l g B run gradle clean build
|
normal SPC l g B run gradle clean build
|
||||||
normal SPC l g t run gradle test
|
normal SPC l g t run gradle test
|
||||||
@ -2478,6 +2479,35 @@ This layer also provides REPL support for lua, the key bindings are:
|
|||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
LANG#MOONSCRIPT *SpaceVim-layer-lang-moonscript*
|
||||||
|
|
||||||
|
This layer is for moonscript development, disabled by default, to enable this
|
||||||
|
layer, add following snippet to your SpaceVim configuration file.
|
||||||
|
>
|
||||||
|
[[layers]]
|
||||||
|
name = 'lang#moonscript'
|
||||||
|
<
|
||||||
|
|
||||||
|
KEY BINDINGS
|
||||||
|
|
||||||
|
>
|
||||||
|
Key Function
|
||||||
|
-----------------------------
|
||||||
|
SPC l r Run current moonscript
|
||||||
|
<
|
||||||
|
|
||||||
|
This layer also provides REPL support for moonscript, the key bindings are:
|
||||||
|
>
|
||||||
|
Key Function
|
||||||
|
---------------------------------------------
|
||||||
|
SPC l s i Start a inferior REPL process
|
||||||
|
SPC l s b send whole buffer
|
||||||
|
SPC l s l send current line
|
||||||
|
SPC l s s send selection text
|
||||||
|
<
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
LANG#NIM *SpaceVim-layer-lang-nim*
|
LANG#NIM *SpaceVim-layer-lang-nim*
|
||||||
|
|
||||||
|
49
docs/cn/layers/lang/moonscript.md
Normal file
49
docs/cn/layers/lang/moonscript.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#moonscript 模块"
|
||||||
|
description: "这一模块为 moonscript 开发提供支持,包括交互式编程、一键运行等特性。"
|
||||||
|
lang: zh
|
||||||
|
---
|
||||||
|
|
||||||
|
# [可用模块](../../) >> lang#moonscript
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
|
- [模块简介](#模块简介)
|
||||||
|
- [启用模块](#启用模块)
|
||||||
|
- [快捷键](#快捷键)
|
||||||
|
- [运行当前脚本](#运行当前脚本)
|
||||||
|
- [交互式编程](#交互式编程)
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
|
## 模块简介
|
||||||
|
|
||||||
|
这一模块为在 SpaceVim 中进行 moonscript 开发提供了支持。
|
||||||
|
|
||||||
|
## 启用模块
|
||||||
|
|
||||||
|
可通过在配置文件内加入如下配置来启用该模块:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#moonscript"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 快捷键
|
||||||
|
|
||||||
|
### 运行当前脚本
|
||||||
|
|
||||||
|
在编辑 moonscript 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||||
|
|
||||||
|
### 交互式编程
|
||||||
|
|
||||||
|
启动 `mooni` 交互进程,快捷键为: `SPC l s i`。
|
||||||
|
|
||||||
|
将代码传输给 REPL 进程执行:
|
||||||
|
|
||||||
|
| 快捷键 | 功能描述 |
|
||||||
|
| ----------- | ----------------------- |
|
||||||
|
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||||
|
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||||
|
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||||
|
|
54
docs/layers/lang/moonscript.md
Normal file
54
docs/layers/lang/moonscript.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#moonscript layer"
|
||||||
|
description: "This layer is for moonscript development, provide syntax checking, code runner and repl support for moonscript file."
|
||||||
|
---
|
||||||
|
|
||||||
|
# [Available Layers](../../) >> lang#moonscript
|
||||||
|
|
||||||
|
<!-- 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 moonscript development.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To use this configuration layer, update custom configuration file with:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#moonscript"
|
||||||
|
```
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- repl support
|
||||||
|
- code runner
|
||||||
|
|
||||||
|
## Key bindings
|
||||||
|
|
||||||
|
### Running current script
|
||||||
|
|
||||||
|
To running a moonscript 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 `mooni` 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