mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-12 17:55:41 +08:00
Add rust layer option (#2678)
This commit is contained in:
parent
06df393296
commit
d7d957957e
@ -52,10 +52,12 @@ function! SpaceVim#layers#lang#rust#plugins() abort
|
||||
return plugins
|
||||
endfunction
|
||||
|
||||
let s:recommended_style = 0
|
||||
|
||||
function! SpaceVim#layers#lang#rust#config() abort
|
||||
let g:racer_experimental_completer = 1
|
||||
let g:racer_cmd = get(g:, 'racer_cmd', $HOME . '/.cargo/bin/racer')
|
||||
|
||||
let g:rust_recommended_style = s:recommended_style
|
||||
if SpaceVim#layers#lsp#check_filetype('rust')
|
||||
call SpaceVim#mapping#gd#add('rust',
|
||||
\ function('SpaceVim#lsp#go_to_def'))
|
||||
@ -74,6 +76,14 @@ function! SpaceVim#layers#lang#rust#config() abort
|
||||
\ function('s:language_specified_mappings'))
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#rust#lang#set_variable(var) abort
|
||||
|
||||
let s:recommended_style = get(a:var,
|
||||
\ 'recommended-style',
|
||||
\ s:recommended_style)
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:language_specified_mappings() abort
|
||||
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 's'],
|
||||
\ '<Plug>(rust-def-split)', 'rust-def-split', 0)
|
||||
|
@ -11,6 +11,7 @@ lang: cn
|
||||
- [模块简介](#模块简介)
|
||||
- [功能特性](#功能特性)
|
||||
- [启用模块](#启用模块)
|
||||
- [模块选项](#模块选项)
|
||||
- [快捷键](#快捷键)
|
||||
- [运行当前脚本](#运行当前脚本)
|
||||
|
||||
@ -37,6 +38,10 @@ lang: cn
|
||||
name = "lang#rust"
|
||||
```
|
||||
|
||||
## 模块选项
|
||||
|
||||
- `recommended-style`: 启用/禁用 rust 推荐的代码规范,该选项默认已禁用。
|
||||
|
||||
## 快捷键
|
||||
|
||||
| 快捷键 | 功能描述 |
|
||||
|
@ -11,6 +11,7 @@ description: "This layer is for Rust development, provide autocompletion, syntax
|
||||
- [Features](#features)
|
||||
- [Install](#install)
|
||||
- [Layer](#layer)
|
||||
- [Layer options](#layer-options)
|
||||
- [Key bindings](#key-bindings)
|
||||
- [Code runner](#code-runner)
|
||||
|
||||
@ -43,6 +44,10 @@ To use this configuration layer, update custom configuration file with:
|
||||
name = "lang#rust"
|
||||
```
|
||||
|
||||
## Layer options
|
||||
|
||||
- `recommended-style`: Enable/Disable recommended code style for rust. This option is disabled by default.
|
||||
|
||||
## Key bindings
|
||||
|
||||
| Key bindings | Descriptions |
|
||||
|
Loading…
x
Reference in New Issue
Block a user