mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 12:30:40 +08:00
Improve lang#julia layer (#2035)
* Add English version lang#julia layer page * Add Chinese version lang#julia layer page * Add code runner * Add repl support * Add syntax/indent file * Add lsp support
This commit is contained in:
parent
36b983d146
commit
7a7d77174e
9
.github/CODEOWNERS
vendored
9
.github/CODEOWNERS
vendored
@ -4,13 +4,12 @@
|
||||
# pull request.
|
||||
* @wsdjeg
|
||||
|
||||
# 中文文件
|
||||
# 中文模块翻译
|
||||
docs/layers/* @SLZhang-CUG
|
||||
# lang#julia layer
|
||||
autoload/SpaceVim/layers/lang/julia.vim @jingpengw
|
||||
docs/layers/lang/julia.md @jingpengw
|
||||
docs/cn/layers/lang/julia.md @jingpengw
|
||||
|
||||
# lang#javascript layer
|
||||
autoload/SpaceVim/layers/lang/javascript.vim @zhujinxuan @S1ngS1ng @chemzqm
|
||||
docs/layers/lang/javascript.md @zhujinxuan @S1ngS1ng @chemzqm
|
||||
docs/cn/layers/lang/javascript.md @zhujinxuan @S1ngS1ng @chemzqm
|
||||
# layer plugins conf:
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
""
|
||||
" @section lang#julia, layer-lang-julia
|
||||
" @parentsection layers
|
||||
" The layer provides synatax highlight and linting for julia.
|
||||
" The layer provides synatax highlight julia.
|
||||
" The completeion only works in nvim with deoplete.
|
||||
" However, the julia-vim could not be load on-demanding
|
||||
" due to its LaTeXToUnicode feature.
|
||||
@ -17,24 +17,39 @@
|
||||
|
||||
function! SpaceVim#layers#lang#julia#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['JuliaEditorSupport/julia-vim' ])
|
||||
call add(plugins, ['zyedidia/julialint.vim', {'on_ft' : 'julia'}])
|
||||
call add(plugins, ['JuliaEditorSupport/julia-vim' , {'merged' : 0}])
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
|
||||
function! SpaceVim#layers#lang#julia#config() abort
|
||||
" registe code runner commmand for julia
|
||||
call SpaceVim#plugins#runner#reg_runner('julia', 'julia %s')
|
||||
" registe REPL command and key bindings for julia
|
||||
call SpaceVim#plugins#repl#reg('julia', 'julia')
|
||||
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
|
||||
\ 'call SpaceVim#plugins#repl#start("julia")',
|
||||
\ '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)
|
||||
let g:latex_to_unicode_tab = 0
|
||||
au! BufNewFile,BufRead *.jl setf julia
|
||||
au! BufNewFile,BufRead *.julia setf julia
|
||||
|
||||
|
||||
" julia
|
||||
let g:default_julia_version = '0.6'
|
||||
|
||||
" language server
|
||||
let g:LanguageClient_autoStart = 1
|
||||
|
||||
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR>
|
||||
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
|
||||
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
|
||||
if SpaceVim#layers#lsp#check_filetype('julia')
|
||||
nnoremap <silent><buffer> K :call SpaceVim#lsp#show_doc()<CR>
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'd'],
|
||||
\ 'call SpaceVim#lsp#show_doc()', 'show_document', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'e'],
|
||||
\ 'call SpaceVim#lsp#rename()', 'rename symbol', 1)
|
||||
endif
|
||||
endfunction
|
||||
|
@ -80,6 +80,7 @@ Vim 插件以及相关配置。而 SpaceVim 是以模块的方式来组织和管
|
||||
| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. |
|
||||
| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. |
|
||||
| [lang#javascript](lang/javascript/) | This layer is for JaveScript development |
|
||||
| [lang#julia](lang/julia/) | 这一模块为 julia 开发提供支持,包括代码补全、语法检查、代码格式化等特性。 |
|
||||
| [lang#lisp](lang/lisp/) | for lisp development |
|
||||
| [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. |
|
||||
|
59
docs/cn/layers/lang/julia.md
Normal file
59
docs/cn/layers/lang/julia.md
Normal file
@ -0,0 +1,59 @@
|
||||
---
|
||||
title: "SpaceVim lang#julia 模块"
|
||||
description: "这一模块为 julia 开发提供支持,包括代码补全、语法检查、代码格式化等特性。"
|
||||
lang: cn
|
||||
---
|
||||
|
||||
# [可用模块](../../) >> lang#julia
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [模块简介](#模块简介)
|
||||
- [功能特性](#功能特性)
|
||||
- [启用模块](#启用模块)
|
||||
- [快捷键](#快捷键)
|
||||
- [交互式编程](#交互式编程)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## 模块简介
|
||||
|
||||
这一模块为 SpaceVim 提供了 julia 开发支持,包括代码补全、语法检查、以及代码格式化等特性。
|
||||
|
||||
## 功能特性
|
||||
|
||||
该模块主要包括插件 [julia-vim](https://github.com/JuliaEditorSupport/julia-vim), 该插件提供:
|
||||
|
||||
- 语法高亮
|
||||
|
||||
|
||||
同时,该模块还为 julia 开发提供了交互式编程和调试等功能。
|
||||
|
||||
## 启用模块
|
||||
|
||||
可通过在配置文件内加入如下配置来启用该模块:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#julia"
|
||||
```
|
||||
|
||||
|
||||
## 快捷键
|
||||
|
||||
### 交互式编程
|
||||
|
||||
启动 `julia` 交互进程,快捷键为: `SPC l s i`。
|
||||
|
||||
将代码传输给 REPL 进程执行:
|
||||
|
||||
| 快捷键 | 描述 |
|
||||
| ----------- | --------------------------- |
|
||||
| `SPC l s b` | 发送整个文件内容至 REPL |
|
||||
| `SPC l s l` | 发送当前行内容至 REPL |
|
||||
| `SPC l s s` | 发送已选中的内容至 REPL |
|
||||
|
||||
### 运行当前脚本
|
||||
|
||||
在编辑 julia 文件时,可通过快捷键 `SPC l r` 快速异步运行当前文件,运行结果会展示在一个独立的执行窗口内。
|
@ -50,6 +50,7 @@ enable = false
|
||||
|
||||
## Available layers
|
||||
|
||||
|
||||
| Name | Description |
|
||||
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [VersionControl](VersionControl/) | This layers provides general version control feature for vim. It should work with all VC backends such as Git, Mercurial, Bazaar, SVN, etc… |
|
||||
@ -79,6 +80,7 @@ enable = false
|
||||
| [lang#html](lang/html/) | Edit html in SpaceVim, with this layer, this layer provides code completion, syntax checking and code formatting for html. |
|
||||
| [lang#java](lang/java/) | This layer is for Java development. All the features such as code completion, formatting, syntax checking, REPL and debug have be done in this layer. |
|
||||
| [lang#javascript](lang/javascript/) | This layer is for JaveScript development |
|
||||
| [lang#julia](lang/julia/) | This layer is for julia development, provide autocompletion, syntax checking and code formatting |
|
||||
| [lang#kotlin](lang/kotlin/) | This layer adds kotlin language support to SpaceVim |
|
||||
| [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. |
|
||||
@ -102,6 +104,7 @@ enable = false
|
||||
| [ui](ui/) | Awesome UI layer for SpaceVim, provide IDE-like UI for neovim and vim in both TUI and GUI |
|
||||
| [unite](unite/) | This layers provide a heavily customized Unite centric work-flow |
|
||||
|
||||
|
||||
<!-- SpaceVim layer list end -->
|
||||
|
||||
<!-- vim:set nowrap: -->
|
||||
|
59
docs/layers/lang/julia.md
Normal file
59
docs/layers/lang/julia.md
Normal file
@ -0,0 +1,59 @@
|
||||
---
|
||||
title: "SpaceVim lang#julia layer"
|
||||
description: "This layer is for julia development, provide autocompletion, syntax checking and code formatting"
|
||||
---
|
||||
|
||||
# [Available Layers](../../) >> lang#julia
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [Description](#description)
|
||||
- [Features](#features)
|
||||
- [Install](#install)
|
||||
- [Layer](#layer)
|
||||
- [Key bindings](#key-bindings)
|
||||
- [Inferior REPL process](#inferior-repl-process)
|
||||
- [Running current script](#running-current-script)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## Description
|
||||
|
||||
This layer is for julia development.
|
||||
|
||||
## Features
|
||||
|
||||
This layer include these plugins: [julia-vim](https://github.com/JuliaEditorSupport/julia-vim) and
|
||||
[deoplete-julia](https://github.com/JuliaEditorSupport/deoplete-julia), which provides:
|
||||
|
||||
- Completion for Modules and functions.
|
||||
- syntax highlighting
|
||||
|
||||
SpaceVim also provides REPL support for julia.
|
||||
|
||||
## Install
|
||||
|
||||
To use this configuration layer, update custom configuration file with:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#julia"
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
### Inferior REPL process
|
||||
|
||||
Start a `julia` inferior REPL process with `SPC l s i`.
|
||||
|
||||
Send code to inferior process commands:
|
||||
|
||||
| Key Binding | Description |
|
||||
| ----------- | ------------------------------------------------ |
|
||||
| `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 script
|
||||
|
||||
To running current script, you can press `SPC l r` to run current file without loss focus, and the result will be shown in a runner buffer.
|
@ -79,6 +79,17 @@ npm install -g javascript-typescript-langserver
|
||||
pip install --user python-language-server
|
||||
```
|
||||
|
||||
**julia:**
|
||||
|
||||
The `LanguageServer` package must be installed in Julia (0.6 or greater), i.e.
|
||||
|
||||
```sh
|
||||
julia> Pkg.clone("https://github.com/JuliaEditorSupport/LanguageServer.jl")
|
||||
```
|
||||
|
||||
With new package system in Julia 0.7 and above, we have a package mode in Julia REPL.
|
||||
in REPL, hit `]` to enter the package management mode, then `add LanguageServer` to install the package.
|
||||
|
||||
## Configuration
|
||||
|
||||
To enable lsp support for a specified filetype, you may need to load this layer with `filtypes` option, for example:
|
||||
@ -97,6 +108,7 @@ default language server commands:
|
||||
| language | server command |
|
||||
| ------------ | ------------------------------------------------ |
|
||||
| `javascript` | `['javascript-typescript-stdio']` |
|
||||
| `typescript` | `['typescript-language-server', '--stdio']` |
|
||||
| `haskell` | `['hie', '--lsp']` |
|
||||
| `c` | `['clangd']` |
|
||||
| `cpp` | `['clangd']` |
|
||||
@ -108,6 +120,7 @@ default language server commands:
|
||||
| `rust` | `['rustup', 'run', 'nightly', 'rls']` |
|
||||
| `python` | `['pyls']` |
|
||||
| `php` | `['php', 'path/to/bin/php-language-server.php']` |
|
||||
| `julia` | `['julia', '--startup-file=no', '--history-file=no', '-e', 'using LanguageServer; server = LanguageServer.LanguageServerInstance(STDIN, STDOUT, false); server.runlinter = true; run(server);']` |
|
||||
|
||||
To override the server command, you may need to use `override_cmd` option:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user