mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Added and updated some plugins
Added: vim-ruby, typescript-vim, vim-javascript Updated: rust-vim
This commit is contained in:
@ -18,36 +18,76 @@ let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_rust_cargo_IsAvailable() dict
|
||||
return executable(self.getExec()) &&
|
||||
\ syntastic#util#versionIsAtLeast(self.getVersion(), [0, 16, 0])
|
||||
if exists("*syntastic#util#getVersion")
|
||||
echom "rust.vim: version of Syntastic is too old. Needs to be at least 3.7.0."
|
||||
return v:false
|
||||
endif
|
||||
|
||||
return executable(self.getExec()) &&
|
||||
\ syntastic#util#versionIsAtLeast(self.getVersion(), [0, 16, 0])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_rust_cargo_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({ "args": "check" })
|
||||
let l:root_cargo_toml = cargo#nearestRootCargo(0)
|
||||
let l:nearest_cargo_toml = cargo#nearestCargo(0)
|
||||
let b:rust_recent_root_cargo_toml = l:root_cargo_toml
|
||||
let b:rust_recent_nearest_cargo_toml = l:nearest_cargo_toml
|
||||
|
||||
" All pathname prints are relative to the Cargo.toml of the workspace, if
|
||||
" there is a workspace, otherwise they are relative to the Cargo.toml of
|
||||
" the single crate. Where to actually execute under these varying
|
||||
" circumtances 'cargo' is determined here, and controlled by
|
||||
" configuration.
|
||||
|
||||
if rust#GetConfigVar('rust_cargo_avoid_whole_workspace', 1)
|
||||
if l:root_cargo_toml !=# l:nearest_cargo_toml
|
||||
let makeprg = "cd " . fnamemodify(l:nearest_cargo_toml, ":p:h")
|
||||
\ . " && " . makeprg
|
||||
endif
|
||||
else
|
||||
let makeprg = "cd " . fnamemodify(l:root_cargo_toml, ":p:h")
|
||||
\ . " && " . makeprg
|
||||
endif
|
||||
|
||||
let l:check_all_targets = rust#GetConfigVar('rust_cargo_check_all_targets', 0)
|
||||
let l:check_all_features = rust#GetConfigVar('rust_cargo_check_all_features', 0)
|
||||
let l:check_examples = rust#GetConfigVar('rust_cargo_check_examples', 0)
|
||||
let l:check_tests = rust#GetConfigVar('rust_cargo_check_tests', 0)
|
||||
let l:check_benches = rust#GetConfigVar('rust_cargo_check_benches', 0)
|
||||
|
||||
let makeprg = makeprg. ' '
|
||||
\ . (l:check_all_targets ? ' --all-targets' : '')
|
||||
\ . (l:check_all_features ? ' --all-features' : '')
|
||||
\ . (l:check_benches ? ' --benches' : '')
|
||||
\ . (l:check_examples ? ' --examples' : '')
|
||||
\ . (l:check_tests ? ' --tests' : '')
|
||||
|
||||
" Ignored patterns, and blank lines
|
||||
let errorformat =
|
||||
\ '%-G,' .
|
||||
\ '%-Gerror: aborting %.%#,' .
|
||||
\ '%-Gerror: Could not compile %.%#,'
|
||||
\ '%-G,' .
|
||||
\ '%-Gerror: aborting %.%#,' .
|
||||
\ '%-Gerror: Could not compile %.%#,'
|
||||
|
||||
" Meaningful lines (errors, notes, warnings, contextual information)
|
||||
let errorformat .=
|
||||
\ '%Eerror: %m,' .
|
||||
\ '%Eerror[E%n]: %m,' .
|
||||
\ '%Wwarning: %m,' .
|
||||
\ '%Inote: %m,' .
|
||||
\ '%C %#--> %f:%l:%c'
|
||||
\ '%Eerror: %m,' .
|
||||
\ '%Eerror[E%n]: %m,' .
|
||||
\ '%Wwarning: %m,' .
|
||||
\ '%Inote: %m,' .
|
||||
\ '%C %#--> %f:%l:%c'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'cwd': expand('%:p:h'),
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'cwd': fnamemodify(l:root_cargo_toml, ":p:h:."),
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'rust',
|
||||
\ 'name': 'cargo'})
|
||||
\ 'filetype': 'rust',
|
||||
\ 'name': 'cargo'})
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
@ -10,39 +10,45 @@ if exists("g:loaded_syntastic_rust_rustc_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_rust_rustc_checker = 1
|
||||
|
||||
" vint: -ProhibitAbbreviationOption
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
" vint: +ProhibitAbbreviationOption
|
||||
|
||||
function! SyntaxCheckers_rust_rustc_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({})
|
||||
|
||||
" Old errorformat (before nightly 2016/08/10)
|
||||
let errorformat =
|
||||
\ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' .
|
||||
\ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' .
|
||||
\ '%C%f:%l %m'
|
||||
|
||||
\ '%E%f:%l:%c: %\d%#:%\d%# %.%\{-}error:%.%\{-} %m,' .
|
||||
\ '%W%f:%l:%c: %\d%#:%\d%# %.%\{-}warning:%.%\{-} %m,' .
|
||||
\ '%C%f:%l %m'
|
||||
|
||||
" New errorformat (after nightly 2016/08/10)
|
||||
let errorformat .=
|
||||
\ ',' .
|
||||
\ '%-G,' .
|
||||
\ '%-Gerror: aborting %.%#,' .
|
||||
\ '%-Gerror: Could not compile %.%#,' .
|
||||
\ '%Eerror: %m,' .
|
||||
\ '%Eerror[E%n]: %m,' .
|
||||
\ '%-Gwarning: the option `Z` is unstable %.%#,' .
|
||||
\ '%Wwarning: %m,' .
|
||||
\ '%Inote: %m,' .
|
||||
\ '%C %#--> %f:%l:%c'
|
||||
\ ',' .
|
||||
\ '%-G,' .
|
||||
\ '%-Gerror: aborting %.%#,' .
|
||||
\ '%-Gerror: Could not compile %.%#,' .
|
||||
\ '%Eerror: %m,' .
|
||||
\ '%Eerror[E%n]: %m,' .
|
||||
\ '%-Gwarning: the option `Z` is unstable %.%#,' .
|
||||
\ '%Wwarning: %m,' .
|
||||
\ '%Inote: %m,' .
|
||||
\ '%C %#--> %f:%l:%c'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'rust',
|
||||
\ 'name': 'rustc'})
|
||||
\ 'filetype': 'rust',
|
||||
\ 'name': 'rustc'})
|
||||
|
||||
" vint: -ProhibitAbbreviationOption
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
" vint: +ProhibitAbbreviationOption
|
||||
|
||||
" vim: set et sw=4 sts=4 ts=8:
|
||||
|
Reference in New Issue
Block a user