diff --git a/autoload/SpaceVim/layers/lang/tcl.vim b/autoload/SpaceVim/layers/lang/tcl.vim new file mode 100644 index 000000000..c70719938 --- /dev/null +++ b/autoload/SpaceVim/layers/lang/tcl.vim @@ -0,0 +1,70 @@ +"============================================================================= +" tcl.vim --- tcl language support for SpaceVim +" Copyright (c) 2016-2019 Wang Shidong & Contributors +" Author: Wang Shidong < wsdjeg@outlook.com > +" URL: https://spacevim.org +" License: GPLv3 +"============================================================================= + + +"" +" @section lang#tcl, layer-lang-tcl +" @parentsection layers +" This layer is for tcl development, disabled by default, to enable this +" layer, add following snippet to your SpaceVim configuration file. +" > +" [[layers]] +" name = 'lang#tcl' +" < +" +" @subsection Key bindings +" > +" Mode Key Function +" --------------------------------------------- +" normal SPC l r run current file +" < +" +" This layer also provides REPL support for tcl, 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#tcl#plugins() abort + let plugins = [] + + return plugins +endfunction + +function! SpaceVim#layers#lang#tcl#config() abort + call SpaceVim#plugins#repl#reg('tcl', 'tclsh') + call SpaceVim#plugins#runner#reg_runner('tcl', 'tclsh %s') + call SpaceVim#mapping#space#regesit_lang_mappings('tcl', 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("tcl")', + \ '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 + +" Tcl 教程 +" https://www.yiibai.com/tcl/tcl_basic_syntax.html +" +" 1. the default tcl shell command is tclsh diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 99ad57009..0259144d1 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -99,13 +99,14 @@ CONTENTS *SpaceVim-contents* 29. lang#python.............................|SpaceVim-layer-lang-python| 30. lang#rust.................................|SpaceVim-layer-lang-rust| 31. lang#scala...............................|SpaceVim-layer-lang-scala| - 32. lang#xml...................................|SpaceVim-layer-lang-xml| - 33. operator...................................|SpaceVim-layer-operator| - 34. shell.........................................|SpaceVim-layer-shell| - 35. test...........................................|SpaceVim-layer-test| - 36. tmux...........................................|SpaceVim-layer-tmux| - 37. tools#dash...............................|SpaceVim-layer-tools-dash| - 38. tools#zeal...............................|SpaceVim-layer-tools-zeal| + 32. lang#tcl...................................|SpaceVim-layer-lang-tcl| + 33. lang#xml...................................|SpaceVim-layer-lang-xml| + 34. operator...................................|SpaceVim-layer-operator| + 35. shell.........................................|SpaceVim-layer-shell| + 36. test...........................................|SpaceVim-layer-test| + 37. tmux...........................................|SpaceVim-layer-tmux| + 38. tools#dash...............................|SpaceVim-layer-tools-dash| + 39. tools#zeal...............................|SpaceVim-layer-tools-zeal| 7. API........................................................|SpaceVim-api| 1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu| 2. data#dict....................................|SpaceVim-api-data-dict| @@ -1850,6 +1851,35 @@ CODE FORMATTING [`scalafmt`](https://scalameta.org/scalafmt/docs/configuration.html) to format code. +============================================================================== +LANG#TCL *SpaceVim-layer-lang-tcl* + +This layer is for tcl development, disabled by default, to enable this layer, +add following snippet to your SpaceVim configuration file. +> + [[layers]] + name = 'lang#tcl' +< + +KEY BINDINGS + +> + Mode Key Function + --------------------------------------------- + normal SPC l r run current file +< + +This layer also provides REPL support for tcl, 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#XML *SpaceVim-layer-lang-xml* diff --git a/docs/cn/layers.md b/docs/cn/layers.md index 0247cdf1d..10a89d611 100644 --- a/docs/cn/layers.md +++ b/docs/cn/layers.md @@ -126,6 +126,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管 | [lang#scheme](lang/scheme/) | 这一模块为 SpaceVim 提供了 Scheme 语言开发支持,包括语法高亮、语言服务器支持。 | | [lang#sh](lang/sh/) | 这一模块为 SpaceVim 提供了 Shell Script 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#swift](lang/swift/) | 这一模块为 SpaceVim 提供了 Swift 的开发支持,包括语法高亮、语法检查等特性。 | +| [lang#tcl](lang/tcl/) | 这一模块为 Tcl 开发提供支持,包括交互式编程、一键运行等特性。 | | [lang#typescript](lang/typescript/) | 这一模块为 SpaceVim 提供了 TypeScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#vim](lang/vim/) | 这一模块为 SpaceVim 提供了 Vimscript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#vue](lang/vue/) | 这一模块为 SpaceVim 提供了 Vue 的的开发支持,包括代码补全、语法检查、代码格式化等特性。 | diff --git a/docs/cn/layers/lang/tcl.md b/docs/cn/layers/lang/tcl.md new file mode 100644 index 000000000..fe54b1c3c --- /dev/null +++ b/docs/cn/layers/lang/tcl.md @@ -0,0 +1,50 @@ +--- +title: "SpaceVim lang#tcl 模块" +description: "这一模块为 Tcl 开发提供支持,包括交互式编程、一键运行等特性。" +lang: cn +--- + +# [可用模块](../../) >> lang#tcl + + + +- [模块简介](#模块简介) +- [启用模块](#启用模块) +- [快捷键](#快捷键) + - [交互式编程](#交互式编程) + - [运行当前脚本](#运行当前脚本) + + + +## 模块简介 + +这一模块为在 SpaceVim 中进行 Tcl 开发提供了支持。 + +## 启用模块 + +可通过在配置文件内加入如下配置来启用该模块: + +```toml +[[layers]] + name = "lang#tcl" +``` + +## 快捷键 + +### 交互式编程 + +启动 `tclsh` 交互进程,快捷键为: `SPC l s i`。 + +将代码传输给 REPL 进程执行: + +| 快捷键 | 功能描述 | +| ----------- | ----------------------- | +| `SPC l s b` | 发送整个文件内容至 REPL | +| `SPC l s l` | 发送当前行内容至 REPL | +| `SPC l s s` | 发送已选中的内容至 REPL | + +### 运行当前脚本 + +在编辑 Tcl 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。 + + diff --git a/docs/layers.md b/docs/layers.md index f028f2db4..ba0afd173 100644 --- a/docs/layers.md +++ b/docs/layers.md @@ -135,6 +135,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#sh](lang/sh/) | Shell script development layer, provides autocompletion, syntax checking, code format for bash and zsh script. | | [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#typescript](lang/typescript/) | This layer is for TypeScript development, includding code completion, Syntax lint, and doc generation. | | [lang#vim](lang/vim/) | This layer is for writting Vimscript, including code completion, syntax checking and buffer formatting | | [lang#vue](lang/vue/) | This layer adds Vue language support to SpaceVim | diff --git a/docs/layers/lang/groovy.md b/docs/layers/lang/groovy.md index be8aa907b..f987c760b 100644 --- a/docs/layers/lang/groovy.md +++ b/docs/layers/lang/groovy.md @@ -37,7 +37,7 @@ To use this configuration layer, update custom configuration file with: ### Running current script -To running a Lua script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer. +To running a Tcl script, 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 diff --git a/docs/layers/lang/tcl.md b/docs/layers/lang/tcl.md new file mode 100644 index 000000000..828dd5d48 --- /dev/null +++ b/docs/layers/lang/tcl.md @@ -0,0 +1,52 @@ +--- +title: "SpaceVim lang#tcl layer" +description: "This layer is for Tcl development, provide syntax checking, code runner and repl support for tcl file." +--- + +# [Available Layers](../../) >> lang#tcl + + + +- [Description](#description) +- [Install](#install) +- [Features](#features) +- [Key bindings](#key-bindings) + - [Running current script](#running-current-script) + - [Inferior REPL process](#inferior-repl-process) + + + +## Description + +This layer is for Tcl development. + +## Install + +To use this configuration layer, update custom configuration file with: + +```toml +[[layers]] + name = "lang#tcl" +``` +## Features + +- repl support +- code runner + +## Key bindings + +### Running current script + +To running a Tcl 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 `tclsh` 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 |