mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-13 14:59:10 +08:00
Add rust support
This commit is contained in:
parent
160f3b34d5
commit
02c99e9460
@ -2,7 +2,7 @@
|
||||
" @section Introduction, intro
|
||||
" @stylized Maktaba
|
||||
" @library
|
||||
" @order intro version dicts functions exceptions layers colorscheme layer_lang_java layer_lang_php layer_lang_c
|
||||
" @order intro version dicts functions exceptions layers colorscheme layer_lang_java layer_lang_php layer_lang_c layer-lang-rust
|
||||
" SpaceVim is a Modular configuration, a bundle of custom settings
|
||||
" and plugins, for Vim. It got inspired by spacemacs.
|
||||
|
||||
|
@ -35,7 +35,6 @@ function! SpaceVim#layers#lang#plugins() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#config() abort
|
||||
let g:racer_cmd = $HOME.'/.cargo/bin/racer'
|
||||
let g:vim_markdown_conceal = 0
|
||||
let g:vim_markdown_folding_disabled = 1
|
||||
endfunction
|
||||
|
@ -1,3 +1,26 @@
|
||||
""
|
||||
" @section layer-lang-rust, layer-lang-rust
|
||||
" requirement:
|
||||
" 1. racer : cargo install racer
|
||||
" 2. export RUST_SRC_PATH :
|
||||
" you can download src by : rustup component add rust-src, and add below
|
||||
" into your bashrc.
|
||||
"
|
||||
" export RUST_SRC_PATH=~/.multirust/toolchains/[your-toolchain]/lib/rustlib/src/rust/src
|
||||
"
|
||||
" configuration:
|
||||
" 1. add `let g:racer_cmd = "/path/to/racer/bin"` in to custom config, if
|
||||
" you has racer executable in you PATH. g:racer_cmd should be auto detect.
|
||||
"
|
||||
" mappings:
|
||||
" >
|
||||
" mode key function
|
||||
" normal gd rust-definition
|
||||
" normal gs rust-definition-split
|
||||
" normal gx rust-definition-vertical
|
||||
" normal <leader>gd rust-doc
|
||||
" <
|
||||
|
||||
function! SpaceVim#layers#lang#rust#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['racer-rust/vim-racer', { 'on_ft' : 'rust'}])
|
||||
@ -6,5 +29,12 @@ function! SpaceVim#layers#lang#rust#plugins() abort
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#layers#lang#rust#config() abort
|
||||
|
||||
let g:racer_experimental_completer = 1
|
||||
let g:racer_cmd = $HOME.'/.cargo/bin/racer'
|
||||
augroup spacevim_layer_lang_rust
|
||||
au FileType rust nmap <buffer><silent> gd <Plug>(rust-def)
|
||||
au FileType rust nmap <buffer><silent> gs <Plug>(rust-def-split)
|
||||
au FileType rust nmap <buffer><silent> gx <Plug>(rust-def-vertical)
|
||||
au FileType rust nmap <buffer><silent> <leader>gd <Plug>(rust-doc)
|
||||
augroup END
|
||||
endfunction
|
||||
|
@ -11,6 +11,7 @@ CONTENTS *SpaceVim-contents*
|
||||
6. Layer_lang_java................................|SpaceVim-layer_lang_java|
|
||||
7. Layer_lang_php..................................|SpaceVim-layer_lang_php|
|
||||
8. Layer_lang_c......................................|SpaceVim-layer_lang_c|
|
||||
9. layer-lang-rust................................|SpaceVim-layer-lang-rust|
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *SpaceVim-intro*
|
||||
@ -419,5 +420,29 @@ lang#c :
|
||||
|
||||
requirement: clang libclang
|
||||
|
||||
==============================================================================
|
||||
LAYER-LANG-RUST *SpaceVim-layer-lang-rust*
|
||||
|
||||
requirement:
|
||||
1. racer : cargo install racer
|
||||
2. export RUST_SRC_PATH : you can download src by : rustup component add
|
||||
rust-src, and add below into your bashrc.
|
||||
|
||||
export RUST_SRC_PATH=~/.multirust/toolchains/[your-toolchain]/lib/rustlib/src/
|
||||
rust/src
|
||||
|
||||
configuration:
|
||||
1. add `let g:racer_cmd = "/path/to/racer/bin"` in to custom config, if you
|
||||
has racer executable in you PATH. g:racer_cmd should be auto detect.
|
||||
|
||||
mappings:
|
||||
>
|
||||
mode key function
|
||||
normal gd rust-definition
|
||||
normal gs rust-definition-split
|
||||
normal gx rust-definition-vertical
|
||||
normal <leader>gd rust-doc
|
||||
<
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
Loading…
x
Reference in New Issue
Block a user