mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 03:40:06 +08:00
Update doc for lang#sml layer (#3977)
This commit is contained in:
parent
fa70723018
commit
93fe791dac
@ -6,6 +6,7 @@
|
|||||||
" License: GPLv3
|
" License: GPLv3
|
||||||
"=============================================================================
|
"=============================================================================
|
||||||
|
|
||||||
|
scriptencoding utf-8
|
||||||
""
|
""
|
||||||
" @section lang#sml, layer-lang-sml
|
" @section lang#sml, layer-lang-sml
|
||||||
" @parentsection layers
|
" @parentsection layers
|
||||||
@ -54,11 +55,22 @@
|
|||||||
" smlnj_path = "/usr/local/smlnj/bin/sml"
|
" smlnj_path = "/usr/local/smlnj/bin/sml"
|
||||||
" mlton_path = "/usr/local/bin/mlton"
|
" mlton_path = "/usr/local/bin/mlton"
|
||||||
" repl_options = ''
|
" repl_options = ''
|
||||||
" conceal = 1
|
" enable_conceal = 1
|
||||||
" conceal_show_tick = 1
|
" enable_conceal_show_tick = 1
|
||||||
" auto_create_def_use = 'always'
|
" auto_create_def_use = 'always'
|
||||||
" <
|
" <
|
||||||
|
|
||||||
|
if exists('s:sml_file_head')
|
||||||
|
finish
|
||||||
|
else
|
||||||
|
let s:sml_file_head = ['']
|
||||||
|
let s:sml_repl_options = ''
|
||||||
|
let s:sml_enable_conceal = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#sml#plugins() abort
|
function! SpaceVim#layers#lang#sml#plugins() abort
|
||||||
let l:plugins = []
|
let l:plugins = []
|
||||||
call add(l:plugins, ['jez/vim-better-sml', { 'on_ft' : 'sml', 'build' : 'make' }])
|
call add(l:plugins, ['jez/vim-better-sml', { 'on_ft' : 'sml', 'build' : 'make' }])
|
||||||
@ -96,10 +108,10 @@ function! s:language_specified_mappings() abort
|
|||||||
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
|
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
|
||||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
|
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
|
||||||
\ "call SpaceVim#plugins#repl#start('sml')",
|
\ "call SpaceVim#plugins#repl#start('sml')",
|
||||||
\ "start REPL process", 1)
|
\ 'start REPL process', 1)
|
||||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'],
|
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'],
|
||||||
\ "call SpaceVim#plugins#repl#send('raw', getline('.') . ';')",
|
\ "call SpaceVim#plugins#repl#send('raw', getline('.') . ';')",
|
||||||
\ "send line and keep code buffer focused", 1)
|
\ 'send line and keep code buffer focused', 1)
|
||||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'],
|
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'],
|
||||||
\ 'call SpaceVim#plugins#repl#send("raw", join(getline(1, "$"), "\n") . ";")',
|
\ 'call SpaceVim#plugins#repl#send("raw", join(getline(1, "$"), "\n") . ";")',
|
||||||
\ 'send buffer and keep code buffer focused', 1)
|
\ 'send buffer and keep code buffer focused', 1)
|
||||||
@ -108,10 +120,6 @@ function! s:language_specified_mappings() abort
|
|||||||
\ 'send selection and keep code buffer focused', 1)
|
\ 'send selection and keep code buffer focused', 1)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:sml_file_head = ['']
|
|
||||||
let s:sml_repl_options = ''
|
|
||||||
let s:sml_enable_conceal = 0
|
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#sml#set_variable(var) abort
|
function! SpaceVim#layers#lang#sml#set_variable(var) abort
|
||||||
let g:sml_smlnj_executable = get(a:var, 'smlnj_path', 'sml')
|
let g:sml_smlnj_executable = get(a:var, 'smlnj_path', 'sml')
|
||||||
let g:sml_mlton_executable = get(a:var, 'mlton_path', 'mlton')
|
let g:sml_mlton_executable = get(a:var, 'mlton_path', 'mlton')
|
||||||
|
@ -153,23 +153,24 @@ CONTENTS *SpaceVim-contents*
|
|||||||
68. lang#scala...............................|SpaceVim-layer-lang-scala|
|
68. lang#scala...............................|SpaceVim-layer-lang-scala|
|
||||||
69. lang#scheme.............................|SpaceVim-layer-lang-scheme|
|
69. lang#scheme.............................|SpaceVim-layer-lang-scheme|
|
||||||
70. lang#sh.....................................|SpaceVim-layer-lang-sh|
|
70. lang#sh.....................................|SpaceVim-layer-lang-sh|
|
||||||
71. lang#swig................................|SpaceVim-layer-lang-swift|
|
71. lang#sml...................................|SpaceVim-layer-lang-sml|
|
||||||
72. lang#swig.................................|SpaceVim-layer-lang-swig|
|
72. lang#swig................................|SpaceVim-layer-lang-swift|
|
||||||
73. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
73. lang#swig.................................|SpaceVim-layer-lang-swig|
|
||||||
74. lang#toml.................................|SpaceVim-layer-lang-toml|
|
74. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
||||||
75. lang#typescript.....................|SpaceVim-layer-lang-typescript|
|
75. lang#toml.................................|SpaceVim-layer-lang-toml|
|
||||||
76. lang#v.......................................|SpaceVim-layer-lang-v|
|
76. lang#typescript.....................|SpaceVim-layer-lang-typescript|
|
||||||
77. lang#vbnet...............................|SpaceVim-layer-lang-vbnet|
|
77. lang#v.......................................|SpaceVim-layer-lang-v|
|
||||||
78. lang#xml...................................|SpaceVim-layer-lang-xml|
|
78. lang#vbnet...............................|SpaceVim-layer-lang-vbnet|
|
||||||
79. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
79. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||||
80. language server protocol........................|SpaceVim-layer-lsp|
|
80. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
||||||
81. leaderf.....................................|SpaceVim-layer-leaderf|
|
81. language server protocol........................|SpaceVim-layer-lsp|
|
||||||
82. operator...................................|SpaceVim-layer-operator|
|
82. leaderf.....................................|SpaceVim-layer-leaderf|
|
||||||
83. shell.........................................|SpaceVim-layer-shell|
|
83. operator...................................|SpaceVim-layer-operator|
|
||||||
84. test...........................................|SpaceVim-layer-test|
|
84. shell.........................................|SpaceVim-layer-shell|
|
||||||
85. tmux...........................................|SpaceVim-layer-tmux|
|
85. test...........................................|SpaceVim-layer-test|
|
||||||
86. tools#dash...............................|SpaceVim-layer-tools-dash|
|
86. tmux...........................................|SpaceVim-layer-tmux|
|
||||||
87. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
87. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||||
|
88. 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. repl............................................|SpaceVim-usage-repl|
|
2. repl............................................|SpaceVim-usage-repl|
|
||||||
@ -3262,6 +3263,55 @@ disabled by default, to enable this layer, add following snippet to your
|
|||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
LANG#SML *SpaceVim-layer-lang-sml*
|
||||||
|
|
||||||
|
This layer is for Standard ML development. This layer provides basic syntax
|
||||||
|
highlighting and code completion , and it is disabled by default, to enable
|
||||||
|
this layer, add following snippet to your |SpaceVim-options| file.
|
||||||
|
>
|
||||||
|
[[layers]]
|
||||||
|
name = 'lang#sml'
|
||||||
|
<
|
||||||
|
|
||||||
|
You can run `:SMLCheckHealth` to check whether the environment if OK.
|
||||||
|
|
||||||
|
LAYER OPTIONS
|
||||||
|
|
||||||
|
`smlnj_path`: Set the path to the smlnj executable, by default, it is `sml`.
|
||||||
|
|
||||||
|
`mlton_path`: Set the path to the mlton executable, by default, it is `mlton`.
|
||||||
|
|
||||||
|
`repl_options`: Options used for REPL, by default, it is ''.
|
||||||
|
|
||||||
|
`auto_create_def_use`: Whether to build def-use files on save automatically.
|
||||||
|
By default, it is `mlb`. Valid values is:
|
||||||
|
>
|
||||||
|
'mlb': Auto build def-use if there's a *.mlb file
|
||||||
|
'always': Always build def-use file
|
||||||
|
'never': Never build def-use file
|
||||||
|
<
|
||||||
|
|
||||||
|
`enable_conceal`: `0`/`1`. Whether to enable concealing for SML files. `0` by
|
||||||
|
defaults. `'a` becomes `α` (or `'α`). `fn` becomes `λ.`
|
||||||
|
|
||||||
|
`enable_conceal_show_tick`: `0`/`1`. When conceal is enabled, show `'α` for
|
||||||
|
`'a` instead of `α`. Helps for alignment. `0` by default.
|
||||||
|
|
||||||
|
`sml_file_head`: Template for new sml file.
|
||||||
|
|
||||||
|
Here is an example how to use above options:
|
||||||
|
>
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#sml"
|
||||||
|
smlnj_path = "/usr/local/smlnj/bin/sml"
|
||||||
|
mlton_path = "/usr/local/bin/mlton"
|
||||||
|
repl_options = ''
|
||||||
|
enable_conceal = 1
|
||||||
|
enable_conceal_show_tick = 1
|
||||||
|
auto_create_def_use = 'always'
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
LANG#SWIG *SpaceVim-layer-lang-swift*
|
LANG#SWIG *SpaceVim-layer-lang-swift*
|
||||||
|
|
||||||
|
@ -156,6 +156,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
|
|||||||
| [lang#scheme](lang/scheme/) | 这一模块为 SpaceVim 提供了 Scheme 语言开发支持,包括语法高亮、语言服务器支持。 |
|
| [lang#scheme](lang/scheme/) | 这一模块为 SpaceVim 提供了 Scheme 语言开发支持,包括语法高亮、语言服务器支持。 |
|
||||||
| [lang#sh](lang/sh/) | 这一模块为 SpaceVim 提供了 Shell Script 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
| [lang#sh](lang/sh/) | 这一模块为 SpaceVim 提供了 Shell Script 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||||
| [lang#slim](lang/slim/) | 这一模块为 slim 开发提供支持,主要包括了语法高亮。 |
|
| [lang#slim](lang/slim/) | 这一模块为 slim 开发提供支持,主要包括了语法高亮。 |
|
||||||
|
| [lang#sml](lang/sml/) | 这一模块为 Standard ML 开发提供支持,包括交互式编程、一键运行等特性。 |
|
||||||
| [lang#swift](lang/swift/) | 这一模块为 SpaceVim 提供了 Swift 的开发支持,包括语法高亮、语法检查等特性。 |
|
| [lang#swift](lang/swift/) | 这一模块为 SpaceVim 提供了 Swift 的开发支持,包括语法高亮、语法检查等特性。 |
|
||||||
| [lang#tcl](lang/tcl/) | 这一模块为 Tcl 开发提供支持,包括交互式编程、一键运行等特性。 |
|
| [lang#tcl](lang/tcl/) | 这一模块为 Tcl 开发提供支持,包括交互式编程、一键运行等特性。 |
|
||||||
| [lang#toml](lang/toml/) | 这一模块为 toml 开发提供支持,主要包括语法高亮、对齐等特性 |
|
| [lang#toml](lang/toml/) | 这一模块为 toml 开发提供支持,主要包括语法高亮、对齐等特性 |
|
||||||
|
66
docs/cn/layers/lang/sml.md
Normal file
66
docs/cn/layers/lang/sml.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#sml 模块"
|
||||||
|
description: "这一模块为 Standard ML 开发提供支持,包括交互式编程、一键运行等特性。"
|
||||||
|
lang: zh
|
||||||
|
---
|
||||||
|
|
||||||
|
# [可用模块](../../) >> lang#sml
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
|
- [模块简介](#模块简介)
|
||||||
|
- [启用模块](#启用模块)
|
||||||
|
- [模块选项](#模块选项)
|
||||||
|
- [快捷键](#快捷键)
|
||||||
|
- [交互式编程](#交互式编程)
|
||||||
|
- [运行当前脚本](#运行当前脚本)
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
|
## 模块简介
|
||||||
|
|
||||||
|
这一模块为在 SpaceVim 中进行 Standard ML 开发提供了支持。
|
||||||
|
|
||||||
|
## 启用模块
|
||||||
|
|
||||||
|
可通过在配置文件内加入如下配置来启用该模块:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#sml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 模块选项
|
||||||
|
|
||||||
|
- `smlnj_path`: 设置 `smlnj` 可执行文件路径, 默认是 `sml`
|
||||||
|
- `mlton_path`: 设置 `mlton` 可执行文件路径, 默认是 `mlton`
|
||||||
|
- `repl_options`: 设置交互式命令启动选项,默认为 `''`
|
||||||
|
- `auto_create_def_use`: 设置保存文件时,是否自动生成 `def-use` 文件,默认的值为 `mlb`。
|
||||||
|
可以使用的值包括:
|
||||||
|
- `mlb`: 仅当有 `*.mlb` 文件时,自动生成 `def-use` 文件
|
||||||
|
- `always`: 总是生成 `def-use` 文件
|
||||||
|
- `never`: 从不生成 `def-use` 文件
|
||||||
|
- `enable_conceal`: `true`/`false`. 设置是否为SML 文件启用 concealing 特性,默认为禁用。
|
||||||
|
`'a` 显示为 `α` (或者 `'α`). `fn` 显示为 `λ.`
|
||||||
|
- `enable_conceal_show_tick`: `true`/`false`,当启用 conceal 时,将 `'a` 显示为 `'α` 而非 `α`,默认为 `false`
|
||||||
|
- `sml_file_head`: 设置新建 sml 文件时的默认文件头模板
|
||||||
|
|
||||||
|
## 快捷键
|
||||||
|
|
||||||
|
### 交互式编程
|
||||||
|
|
||||||
|
启动 `sml` 交互进程,快捷键为: `SPC l s i`。
|
||||||
|
|
||||||
|
将代码传输给 REPL 进程执行:
|
||||||
|
|
||||||
|
| 快捷键 | 功能描述 |
|
||||||
|
| ----------- | ----------------------- |
|
||||||
|
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||||
|
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||||
|
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||||
|
|
||||||
|
### 运行当前脚本
|
||||||
|
|
||||||
|
在编辑 sml 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||||
|
|
||||||
|
|
@ -84,7 +84,7 @@ Some layers are enabled by default. The following example shows how to disable `
|
|||||||
| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. |
|
| [edit](edit/) | Improve code edit expr in SpaceVim, provide more text opjects. |
|
||||||
| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. |
|
| [floobits](floobits/) | This layer adds support for the peer programming tool floobits to SpaceVim. |
|
||||||
| [foldsearch](foldsearch/) | This layer provides functions that fold away lines that don't match a specific search pattern. |
|
| [foldsearch](foldsearch/) | This layer provides functions that fold away lines that don't match a specific search pattern. |
|
||||||
| [format](format/) | Code formatting support for SpaceVim |
|
| [format](format/) | Code formatting layer for SpaceVim, includes a variety of formatters for many filetypes |
|
||||||
| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow |
|
| [fzf](fzf/) | This layers provide a heavily customized fzf centric work-flow |
|
||||||
| [git](git/) | This layers adds extensive support for git |
|
| [git](git/) | This layers adds extensive support for git |
|
||||||
| [github](github/) | This layer provides GitHub integration for SpaceVim |
|
| [github](github/) | This layer provides GitHub integration for SpaceVim |
|
||||||
@ -166,6 +166,7 @@ Some layers are enabled by default. The following example shows how to disable `
|
|||||||
| [lang#scheme](lang/scheme/) | This layer adds Scheme language support to SpaceVim |
|
| [lang#scheme](lang/scheme/) | This layer adds Scheme language support to SpaceVim |
|
||||||
| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. |
|
| [lang#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. |
|
||||||
| [lang#slim](lang/slim/) | This layer is for slim development, includes syntax highlighting for slim file. |
|
| [lang#slim](lang/slim/) | This layer is for slim development, includes syntax highlighting for slim file. |
|
||||||
|
| [lang#sml](lang/sml/) | This layer is for Standard ML development, provide syntax highlighting and repl support for sml file. |
|
||||||
| [lang#swift](lang/swift/) | swift language support for SpaceVim, includes code completion, syntax highlighting |
|
| [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#tcl](lang/tcl/) | This layer is for Tcl development, provide syntax checking, code runner and repl support for tcl file. |
|
||||||
| [lang#toml](lang/toml/) | This layer is for toml development, provide syntax checking, indent etc. |
|
| [lang#toml](lang/toml/) | This layer is for toml development, provide syntax checking, indent etc. |
|
||||||
|
69
docs/layers/lang/sml.md
Normal file
69
docs/layers/lang/sml.md
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#sml layer"
|
||||||
|
description: "This layer is for Standard ML development, provide syntax highlighting and repl support for sml file."
|
||||||
|
---
|
||||||
|
|
||||||
|
# [Available Layers](../../) >> lang#sml
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
|
- [Description](#description)
|
||||||
|
- [Install](#install)
|
||||||
|
- [Layer options](#layer-options)
|
||||||
|
- [Key bindings](#key-bindings)
|
||||||
|
- [Running current script](#running-current-script)
|
||||||
|
- [Inferior REPL process](#inferior-repl-process)
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This layer is for Standard ML development.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To use this configuration layer, update custom configuration file with:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[[layers]]
|
||||||
|
name = "lang#sml"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Layer options
|
||||||
|
|
||||||
|
- `smlnj_path`: Set the path to the smlnj executable, by default, it is `sml`.
|
||||||
|
- `mlton_path`: Set the path to the mlton executable, by default, it is `mlton`.
|
||||||
|
- `repl_options`: Options used for REPL, by default, it is ''.
|
||||||
|
- `auto_create_def_use`: Whether to build def-use files on save automatically.
|
||||||
|
By default, it is `mlb`. Valid values is:
|
||||||
|
- `mlb`: Auto build def-use if there's a `*.mlb` file
|
||||||
|
- `always`: Always build def-use file
|
||||||
|
- `never`: Never build def-use file
|
||||||
|
- `enable_conceal`: `true`/`false`. Whether to enable concealing for SML files. `false` by defaults.
|
||||||
|
`'a` becomes `α` (or `'α`). `fn` becomes `λ.`
|
||||||
|
- `enable_conceal_show_tick`: `true`/`false`. When conceal is enabled, show `'α` for `'a` instead of `α`.
|
||||||
|
Helps for alignment. `false` by default.
|
||||||
|
- `sml_file_head`: Template for new sml file.
|
||||||
|
|
||||||
|
|
||||||
|
## Key bindings
|
||||||
|
|
||||||
|
### Running current script
|
||||||
|
|
||||||
|
The key binding for running current sml file is `SPC l r`.
|
||||||
|
It will run current file without loss focus,
|
||||||
|
and the result will be shown in a runner buffer.
|
||||||
|
|
||||||
|
### Inferior REPL process
|
||||||
|
|
||||||
|
Start a `sml` 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