mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 20:00:05 +08:00
Add lang#wolfram layer (#3122)
This commit is contained in:
parent
00cd61249b
commit
7ad9f391d1
38
autoload/SpaceVim/layers/lang/wolfram.vim
Normal file
38
autoload/SpaceVim/layers/lang/wolfram.vim
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
"=============================================================================
|
||||||
|
" wolfram.vim --- wolfram language support in SpaceVim
|
||||||
|
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||||
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||||
|
" URL: https://spacevim.org
|
||||||
|
" License: GPLv3
|
||||||
|
"=============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
function! SpaceVim#layers#lang#wolfram#plugins() abort
|
||||||
|
let plugins = []
|
||||||
|
call add(plugins, ['wsdjeg/vim-wolfram', { 'merged' : 0}])
|
||||||
|
return plugins
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! SpaceVim#layers#lang#wolfram#config() abort
|
||||||
|
call SpaceVim#plugins#repl#reg('wolfram', 'wolframscript')
|
||||||
|
call SpaceVim#plugins#runner#reg_runner('wolfram', 'wolframscript %s')
|
||||||
|
call SpaceVim#mapping#space#regesit_lang_mappings('wolfram', 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("wolfram")',
|
||||||
|
\ '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
|
@ -9,6 +9,7 @@ project_repo_url: https://github.com/SpaceVim/SpaceVim
|
|||||||
url: https://spacevim.org
|
url: https://spacevim.org
|
||||||
logo: https://spacevim.org/SpaceVim.png
|
logo: https://spacevim.org/SpaceVim.png
|
||||||
permalink: /:title/
|
permalink: /:title/
|
||||||
|
lang: en
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- jekyll-redirect-from
|
- jekyll-redirect-from
|
||||||
|
50
docs/cn/layers/lang/wolfram.md
Normal file
50
docs/cn/layers/lang/wolfram.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#wolfram 模块"
|
||||||
|
description: "这一模块为 wolfram 开发提供支持,包括交互式编程、一键运行等特性。"
|
||||||
|
lang: zh
|
||||||
|
---
|
||||||
|
|
||||||
|
# [可用模块](../../) >> lang#wolfram
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
|
- [模块简介](#模块简介)
|
||||||
|
- [启用模块](#启用模块)
|
||||||
|
- [快捷键](#快捷键)
|
||||||
|
- [交互式编程](#交互式编程)
|
||||||
|
- [运行当前脚本](#运行当前脚本)
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
|
## 模块简介
|
||||||
|
|
||||||
|
这一模块为在 SpaceVim 中进行 wolfram 开发提供了支持。
|
||||||
|
|
||||||
|
## 启用模块
|
||||||
|
|
||||||
|
可通过在配置文件内加入如下配置来启用该模块:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#wolfram"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 快捷键
|
||||||
|
|
||||||
|
### 交互式编程
|
||||||
|
|
||||||
|
启动 `walframscript` 交互进程,快捷键为: `SPC l s i`。
|
||||||
|
|
||||||
|
将代码传输给 REPL 进程执行:
|
||||||
|
|
||||||
|
| 快捷键 | 功能描述 |
|
||||||
|
| ----------- | ----------------------- |
|
||||||
|
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||||
|
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||||
|
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||||
|
|
||||||
|
### 运行当前脚本
|
||||||
|
|
||||||
|
在编辑 wolfram 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||||
|
|
||||||
|
|
56
docs/layers/lang/wolfram.md
Normal file
56
docs/layers/lang/wolfram.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#walfram layer"
|
||||||
|
description: "This layer is for walfram development, provide syntax checking, code runner and repl support for walfram file."
|
||||||
|
---
|
||||||
|
|
||||||
|
# [Available Layers](../../) >> lang#walfram
|
||||||
|
|
||||||
|
<!-- 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
|
||||||
|
|
||||||
|
The [Wolfram](https://www.wolfram.com/language/) Language is a general multi-paradigm computational language
|
||||||
|
and this layer provides wolfram language syntax highlighting, code completion
|
||||||
|
and code runner etc.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To use this configuration layer, update custom configuration file with:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#walfram"
|
||||||
|
```
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- repl support
|
||||||
|
- code runner
|
||||||
|
|
||||||
|
## Key bindings
|
||||||
|
|
||||||
|
### Running current script
|
||||||
|
|
||||||
|
To running a walfram 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 `walframscript` 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