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

Add lang#racket layer (#2805)

This commit is contained in:
Wang Shidong 2019-05-09 15:07:53 +08:00 committed by GitHub
parent d87b918967
commit ed4c4ec437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 247 additions and 80 deletions

View File

@ -0,0 +1,54 @@
"=============================================================================
" racket.vim --- racket language support in spacevim
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
function! SpaceVim#layers#lang#racket#plugins() abort
let plugins = []
call add(plugins, ['wlangstroth/vim-racket', {'merged' : 0}])
return plugins
endfunction
function! SpaceVim#layers#lang#racket#config() abort
augroup spacevim_layer_lang_racket
autocmd!
au BufRead,BufNewFile *.rkt,*.rktl setf racket
augroup END
call SpaceVim#plugins#runner#reg_runner('racket',
\ {
\ 'exe' : 'racket',
\ 'opt' : ['-f'],
\ 'usestdin' : 0,
\ })
call SpaceVim#mapping#gd#add('racket', function('s:go_to_def'))
call SpaceVim#plugins#repl#reg('racket', ['racket', '-i'])
call SpaceVim#mapping#space#regesit_lang_mappings('racket', function('s:language_specified_mappings'))
endfunction
function! s:go_to_def() abort
endfunction
function! s:language_specified_mappings() abort
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],
\ 'call SpaceVim#plugins#runner#open()',
\ 'execute current file', 1)
" nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
\ 'call SpaceVim#plugins#repl#start("racket")',
\ '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

@ -58,7 +58,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
## 可用模块 ## 可用模块
| 名称 | 描述 | | 名称 | 描述 |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [VersionControl](VersionControl/) | 这一模块为 SpaceVim 提供了通用的代码版本控制支持,该模块支持 Git、Mercurial、Bazaar、SVN 等等多种后台工具。 | | [VersionControl](VersionControl/) | 这一模块为 SpaceVim 提供了通用的代码版本控制支持,该模块支持 Git、Mercurial、Bazaar、SVN 等等多种后台工具。 |
| [autocomplete](autocomplete/) | 这一模块为 SpaceVim 提供了自动补全的框架,包括语法补全等多种补全来源,同时提供了代码块自动完成等特性。 | | [autocomplete](autocomplete/) | 这一模块为 SpaceVim 提供了自动补全的框架,包括语法补全等多种补全来源,同时提供了代码块自动完成等特性。 |
| [chat](chat/) | 这一模块为 SpaceVim 提供了一个聊天框架,目前支持微信聊天和 QQ 聊天,同时支持自定义聊天服务器。 | | [chat](chat/) | 这一模块为 SpaceVim 提供了一个聊天框架,目前支持微信聊天和 QQ 聊天,同时支持自定义聊天服务器。 |
@ -117,6 +117,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
| [lang#purescript](lang/purescript/) | 这一模块为 SpaceVim 提供了 PureScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#purescript](lang/purescript/) | 这一模块为 SpaceVim 提供了 PureScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#python](lang/python/) | 这一模块为 Python 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#python](lang/python/) | 这一模块为 Python 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#r](lang/r/) | 这一模块为 R 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#r](lang/r/) | 这一模块为 R 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#racket](lang/racket/) | 该模块为 SpaceVim 提供了 racket 语言开发支持,包括语法高亮、语言服务器支持。 |
| [lang#red](lang/red/) | 这一模块为 Red 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#red](lang/red/) | 这一模块为 Red 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#ruby](lang/ruby/) | 这一模块为 Ruby 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#ruby](lang/ruby/) | 这一模块为 Ruby 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
| [lang#rust](lang/rust/) | 这一模块为 Rust 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 | | [lang#rust](lang/rust/) | 这一模块为 Rust 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |

View File

@ -0,0 +1,56 @@
---
title: "SpaceVim lang#racket 模块"
description: "该模块为 SpaceVim 提供了 racket 语言开发支持,包括语法高亮、语言服务器支持。"
lang: cn
---
# [可用模块](../../) >> lang#racket
<!-- vim-markdown-toc GFM -->
- [模块简介](#模块简介)
- [功能特性](#功能特性)
- [启用模块](#启用模块)
- [快捷键](#快捷键)
- [交互式编程](#交互式编程)
- [运行当前文件](#运行当前文件)
<!-- vim-markdown-toc -->
## 模块简介
该模块为 SpaceVim 提供了 racket 语言开发支持。
## 功能特性
- 语法高亮
- 一键运行
- 交互式编程
## 启用模块
可通过在配置文件内加入如下配置来启用该模块:
```toml
[[layers]]
name = "lang#racket"
```
## 快捷键
### 交互式编程
启动 `racket -i` 交互进程,快捷键为: `SPC l s i`
将代码传输给 REPL 进程执行:
| 快捷键 | 功能描述 |
| ----------- | ----------------------- |
| `SPC l s b` | 发送整个文件内容至 REPL |
| `SPC l s l` | 发送当前行内容至 REPL |
| `SPC l s s` | 发送已选中的内容至 REPL |
### 运行当前文件
在编辑 kotlin 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。

View File

@ -126,6 +126,7 @@ Some layers are enabled by default. The following example shows how to disable `
| [lang#purescript](lang/purescript/) | This layer is for PureScript development, provide autocompletion, syntax checking, code format for PureScript file. | | [lang#purescript](lang/purescript/) | This layer is for PureScript development, provide autocompletion, syntax checking, code format for PureScript file. |
| [lang#python](lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for Python file. | | [lang#python](lang/python/) | This layer is for Python development, provide autocompletion, syntax checking, code format for Python file. |
| [lang#r](lang/r/) | This layer is for R development, provide autocompletion, syntax checking and code format. | | [lang#r](lang/r/) | This layer is for R development, provide autocompletion, syntax checking and code format. |
| [lang#racket](lang/racket/) | This layer adds racket language support to SpaceVim, including syntax highlighting, code runner and REPL support. |
| [lang#red](lang/red/) | This layer is for Red development, provide autocompletion, syntax checking and code format. | | [lang#red](lang/red/) | This layer is for Red development, provide autocompletion, syntax checking and code format. |
| [lang#ruby](lang/ruby/) | This layer is for Ruby development, provide autocompletion, syntax checking, code format for Ruby file. | | [lang#ruby](lang/ruby/) | This layer is for Ruby development, provide autocompletion, syntax checking, code format for Ruby file. |
| [lang#rust](lang/rust/) | This layer is for Rust development, provide autocompletion, syntax checking, code format for Rust file. | | [lang#rust](lang/rust/) | This layer is for Rust development, provide autocompletion, syntax checking, code format for Rust file. |

View File

@ -0,0 +1,55 @@
---
title: "SpaceVim lang#racket layer"
description: "This layer adds racket language support to SpaceVim, including syntax highlighting, code runner and REPL support."
---
# [Available Layers](../../) >> lang#racket
<!-- vim-markdown-toc GFM -->
- [Description](#description)
- [Features](#features)
- [Install](#install)
- [Key bindings](#key-bindings)
- [Inferior REPL process](#inferior-repl-process)
- [Running current file](#running-current-file)
<!-- vim-markdown-toc -->
## Description
This layer adds racket language support to SpaceVim.
## Features
- syntax highlighting
- code runner
- REPL support
## Install
To use this configuration layer, update custom configuration file with:
```toml
[[layers]]
name = "lang#racket"
```
## Key bindings
### Inferior REPL process
Start a `racket -i` 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 |
### Running current file
To running current file, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer.