mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-03 02:00:05 +08:00
Add lang#prolog layer (#2905)
This commit is contained in:
parent
efd28a3732
commit
8f32ca8740
49
autoload/SpaceVim/layers/lang/prolog.vim
Normal file
49
autoload/SpaceVim/layers/lang/prolog.vim
Normal file
@ -0,0 +1,49 @@
|
||||
"=============================================================================
|
||||
" prolog.vim --- prolog support in SpaceVim
|
||||
" Copyright (c) 2016-2019 Wang Shidong & Contributors
|
||||
" Author: Wang Shidong < wsdjeg@outlook.com >
|
||||
" URL: https://spacevim.org
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section lang#prolog, layer-lang-prolog
|
||||
" @parentsection layers
|
||||
" This layer is for prolog development, disabled by default, to enable this
|
||||
" layer, add following snippet to your SpaceVim configuration file.
|
||||
" >
|
||||
" [[layers]]
|
||||
" name = 'lang#prolog'
|
||||
" <
|
||||
"
|
||||
|
||||
function! SpaceVim#layers#lang#prolog#plugins() abort
|
||||
let plugins = []
|
||||
" @todo Use new prolog plugin
|
||||
" call add(plugins, ['wsdjeg/prolog-vim', { 'merged' : 0}])
|
||||
call add(plugins, ['wsdjeg/prolog.vim', { 'merged' : 0}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#prolog#config() abort
|
||||
call SpaceVim#plugins#repl#reg('prolog', 'swipl -q')
|
||||
call SpaceVim#plugins#runner#reg_runner('prolog', 'swipl -q -f %s -t main')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('prolog', 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("prolog")',
|
||||
\ '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
|
@ -95,18 +95,19 @@ CONTENTS *SpaceVim-contents*
|
||||
25. lang#php...................................|SpaceVim-layer-lang-php|
|
||||
26. lang#pony.................................|SpaceVim-layer-lang-pony|
|
||||
27. lang#processing.....................|SpaceVim-layer-lang-processing|
|
||||
28. lang#puppet.............................|SpaceVim-layer-lang-puppet|
|
||||
29. lang#python.............................|SpaceVim-layer-lang-python|
|
||||
30. lang#rust.................................|SpaceVim-layer-lang-rust|
|
||||
31. lang#scala...............................|SpaceVim-layer-lang-scala|
|
||||
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|
|
||||
28. lang#prolog.............................|SpaceVim-layer-lang-prolog|
|
||||
29. lang#puppet.............................|SpaceVim-layer-lang-puppet|
|
||||
30. lang#python.............................|SpaceVim-layer-lang-python|
|
||||
31. lang#rust.................................|SpaceVim-layer-lang-rust|
|
||||
32. lang#scala...............................|SpaceVim-layer-lang-scala|
|
||||
33. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
||||
34. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
35. operator...................................|SpaceVim-layer-operator|
|
||||
36. shell.........................................|SpaceVim-layer-shell|
|
||||
37. test...........................................|SpaceVim-layer-test|
|
||||
38. tmux...........................................|SpaceVim-layer-tmux|
|
||||
39. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
40. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
||||
7. API........................................................|SpaceVim-api|
|
||||
1. cmdlinemenu................................|SpaceVim-api-cmdlinemenu|
|
||||
2. data#dict....................................|SpaceVim-api-data-dict|
|
||||
@ -1651,6 +1652,17 @@ MAPPINGS
|
||||
normal SPC l r execute current sketch
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
LANG#PROLOG *SpaceVim-layer-lang-prolog*
|
||||
|
||||
This layer is for prolog development, disabled by default, to enable this
|
||||
layer, add following snippet to your SpaceVim configuration file.
|
||||
>
|
||||
[[layers]]
|
||||
name = 'lang#prolog'
|
||||
<
|
||||
|
||||
|
||||
==============================================================================
|
||||
LANG#PUPPET *SpaceVim-layer-lang-puppet*
|
||||
|
||||
|
@ -109,11 +109,13 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
|
||||
| [lang#lisp](lang/lisp/) | 这一模块为 Lisp 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#lua](lang/lua/) | 这一模块为 Lua 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#markdown](lang/markdown/) | 这一模块为 Markdown 编辑提供支持,包括格式化、自动生成文章目录、代码块等特性。 |
|
||||
| [lang#matlab](lang/matlab/) | 该模块为 SpaceVim 提供了 matlab 语言开发支持,包括语法高亮。 |
|
||||
| [lang#nim](lang/nim/) | 该模块为 SpaceVim 提供 Nim 开发支持,包括语法高亮、代码补全、编译运行以及交互式编程等功能。 |
|
||||
| [lang#ocaml](lang/ocaml/) | 这一模块为 OCaml 开发提供了支持,包括语法高亮、代码补全、以及定义处跳转等功能。 |
|
||||
| [lang#perl](lang/perl/) | 这一模块为 Perl 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#php](lang/php/) | 这一模块为 SpaceVim 提供了 PHP 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#plantuml](lang/plantuml/) | 这一模块为 SpaceVim 提供了 PlantUML 的开发支持,包括语法高亮、实时预览等特性。 |
|
||||
| [lang#prolog](lang/prolog/) | 这一模块为 Prolog 开发提供支持,包括交互式编程、一键运行等特性。 |
|
||||
| [lang#puppet](lang/puppet/) | 这一模块为 SpaceVim 提供了 Puppet 的开发支持,包括语法高亮、语言服务器支持。 |
|
||||
| [lang#purescript](lang/purescript/) | 这一模块为 SpaceVim 提供了 PureScript 的开发支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#python](lang/python/) | 这一模块为 Python 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
|
51
docs/cn/layers/lang/prolog.md
Normal file
51
docs/cn/layers/lang/prolog.md
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
title: "SpaceVim lang#prolog 模块"
|
||||
description: "这一模块为 Prolog 开发提供支持,包括交互式编程、一键运行等特性。"
|
||||
lang: cn
|
||||
---
|
||||
|
||||
# [可用模块](../../) >> lang#prolog
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [模块简介](#模块简介)
|
||||
- [启用模块](#启用模块)
|
||||
- [快捷键](#快捷键)
|
||||
- [交互式编程](#交互式编程)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## 模块简介
|
||||
|
||||
这一模块为在 SpaceVim 中进行 Prolog 开发提供了支持。
|
||||
|
||||
## 启用模块
|
||||
|
||||
可通过在配置文件内加入如下配置来启用该模块:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#prolog"
|
||||
```
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 交互式编程
|
||||
|
||||
启动 `swipl -q` 交互进程,快捷键为: `SPC l s i`。
|
||||
|
||||
将代码传输给 REPL 进程执行:
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
| ----------- | ----------------------- |
|
||||
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 Prolog 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
||||
|
||||
|
||||
|
@ -117,12 +117,14 @@ Some layers are enabled by default. The following example shows how to disable `
|
||||
| [lang#lisp](lang/lisp/) | This layer is for Lisp development, provide autocompletion, syntax checking, code format for Lisp file. |
|
||||
| [lang#lua](lang/lua/) | This layer is for Lua development, provide autocompletion, syntax checking, code format for Lua file. |
|
||||
| [lang#markdown](lang/markdown/) | Edit markdown within vim, autopreview markdown in the default browser, with this layer you can also format markdown file. |
|
||||
| [lang#matlab](lang/matlab/) | This layer adds matlab language support to SpaceVim, including syntax highlighting. |
|
||||
| [lang#nim](lang/nim/) | This layer adds Nim language support to SpaceVim |
|
||||
| [lang#ocaml](lang/ocaml/) | This layer is for OCaml development, provide autocompletion, syntax checking, code format for OCaml file. |
|
||||
| [lang#perl](lang/perl/) | This layer is for Perl development, provide autocompletion, syntax checking, code format for Perl file. |
|
||||
| [lang#php](lang/php/) | PHP language support, including code completion, syntax lint and code runner |
|
||||
| [lang#plantuml](lang/plantuml/) | This layer is for PlantUML development, syntax highlighting for PlantUML file. |
|
||||
| [lang#processing](lang/processing/) | This layer is for working on Processing sketches. It provides sytnax checking and an app runner |
|
||||
| [lang#prolog](lang/prolog/) | This layer is for Prolog development, provide syntax checking, code runner and repl support for prolog file. |
|
||||
| [lang#puppet](lang/puppet/) | This layer adds Puppet language support to SpaceVim |
|
||||
| [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. |
|
||||
|
53
docs/layers/lang/prolog.md
Normal file
53
docs/layers/lang/prolog.md
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
title: "SpaceVim lang#prolog layer"
|
||||
description: "This layer is for Prolog development, provide syntax checking, code runner and repl support for prolog file."
|
||||
---
|
||||
|
||||
# [Available Layers](../../) >> lang#prolog
|
||||
|
||||
<!-- 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 Prolog development.
|
||||
|
||||
## Install
|
||||
|
||||
To use this configuration layer, update custom configuration file with:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#prolog"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- repl support
|
||||
- code runner
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Running current script
|
||||
|
||||
To running a Prolog 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 `swipl -q` 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