summaryrefslogtreecommitdiffstats
path: root/vim/ftplugin/rust.vim
blob: 0a8d596db2c256b86b6d15ecfc66c4312ef0e2b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let b:ale_linters = { 'rust': ['analyzer'] }
let b:ale_rust_analyzer_config = {
    \'checkOnSave': { 'command': 'clippy' },
    \'cargo': { 'allFeatures': v:true },
\}
let b:ale_fixers = { 'rust': ['rustfmt'] }
let b:ale_fix_on_save = 1
let b:ale_rust_rustfmt_options = "--edition 2018"

map <buffer> <CR> :ALEGoToDefinition<CR>

if filereadable("Cargo.toml")
    compiler cargo
    setlocal makeprg=cargo\ build
else
    setlocal makeprg=rustc\ %
endif