mirror of
https://github.com/amix/vimrc
synced 2025-07-10 03:25:00 +08:00
add cocoa.vim & swift.vim
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
if exists('g:loaded_syntastic_swift_swiftlint_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_swift_swiftlint_checker = 1
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_swift_swiftlint_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
||||
return get(g:, 'syntastic_swift_swiftlint_use_defaults', 0)
|
||||
\ || filereadable('.swiftlint.yml')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_swift_swiftlint_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args': 'lint --use-script-input-files',
|
||||
\ 'fname': '' })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c: %trror: %m,' .
|
||||
\ '%f:%l:%c: %tarning: %m,' .
|
||||
\ '%f:%l: %trror: %m,' .
|
||||
\ '%f:%l: %tarning: %m'
|
||||
|
||||
let env = {
|
||||
\ 'SCRIPT_INPUT_FILE_COUNT': 1,
|
||||
\ 'SCRIPT_INPUT_FILE_0': expand('%:p'),
|
||||
\ }
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'env': env })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'swift',
|
||||
\ 'name': 'swiftlint' })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
@ -0,0 +1,44 @@
|
||||
if exists('g:loaded_syntastic_swift_swiftpm_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_swift_swiftpm_checker = 1
|
||||
|
||||
if !exists('g:syntastic_swift_swiftpm_executable')
|
||||
let g:syntastic_swift_swiftpm_executable = 'swift'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_swift_swiftpm_arguments')
|
||||
let g:syntastic_swift_swiftpm_arguments = 'build'
|
||||
endif
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! SyntaxCheckers_swift_swiftpm_IsAvailable() dict
|
||||
if !executable(self.getExec())
|
||||
return 0
|
||||
endif
|
||||
|
||||
return filereadable('Package.swift')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_swift_swiftpm_GetLocList() dict
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'fname': '',
|
||||
\ 'args': g:syntastic_swift_swiftpm_arguments })
|
||||
|
||||
let errorformat =
|
||||
\ '%f:%l:%c: error: %m'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'swift',
|
||||
\ 'name': 'swiftpm',
|
||||
\ 'exec': g:syntastic_swift_swiftpm_executable })
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
Reference in New Issue
Block a user