summaryrefslogtreecommitdiffstats
path: root/vim/.vim/ftplugin/rust.vim
blob: 2b9606e23a8f89bf4fe8c789134d3d024d4e8967 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
let b:ale_linters = { 'rust': ['analyzer'] }
let b:ale_rust_analyzer_config = {
    \'checkOnSave': { 'command': 'clippy' },
    \'cargo': { 'allFeatures': v:true },
    \'diagnostics': { 'disabled': ['inactive-code'] },
\}
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