1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-04-14 15:19:12 +08:00

fix(layer): fix rustfmt_cmd option in lang#rust layer

Problem: `rustfmt_cmd` option does not work.
Solution: apply `rustfmt_cmd` to neoformat option.

close https://github.com/SpaceVim/SpaceVim/issues/4307
This commit is contained in:
Shidong Wang 2021-10-01 16:58:56 +08:00
parent a08746ffce
commit 2253f54be5
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
2 changed files with 32 additions and 0 deletions

View File

@ -39,6 +39,19 @@
" racer_cmd = "/path/to/racer/bin"
" <
"
" @subsection Layer options
"
" The following layer options are supported when loading this layer:
"
" 1. `recommended_style`: `true`/`false` (Enable/Disable) recommended code
" style for rust. This option is disabled by default.
" 2. `format_on_save`: `true`/`false` (Enable/Disable) format current buffer
" after save. This option is disabled by default.
" 3. `racer_cmd`: The path of `racer` binary. This option is `racer` by
" default.
" 4. `rustfmt_cmd`: The path of `rustfmt` binary. This option is `rustfmt`
" by default.
"
" @subsection Mappings
" >
" Key Function
@ -96,6 +109,12 @@ function! SpaceVim#layers#lang#rust#config() abort
let g:racer_cmd = s:racer_cmd
let g:rustfmt_cmd = s:rustfmt_cmd
" format layer setting
let g:neoformat_rust_rustfmt = {
\ 'exe': s:rustfmt_cmd,
\ 'stdin': 1,
\ }
let g:neoformat_enabled_rust = ['rustfmt']
let g:rust_recommended_style = s:recommended_style
" Disable racer format, use Neoformat instead!
let g:rustfmt_autosave = 0

View File

@ -3681,6 +3681,19 @@ Requirements:
racer_cmd = "/path/to/racer/bin"
<
LAYER OPTIONS
The following layer options are supported when loading this layer:
1. `recommended_style`: `true`/`false` (Enable/Disable) recommended code
style for rust. This option is disabled by default.
2. `format_on_save`: `true`/`false` (Enable/Disable) format current buffer
after save. This option is disabled by default.
3. `racer_cmd`: The path of `racer` binary. This option is `racer` by
default.
4. `rustfmt_cmd`: The path of `rustfmt` binary. This option is `rustfmt`
by default.
MAPPINGS
>