From 212dcd0bf753f08c0127a26a71b673c734b45c02 Mon Sep 17 00:00:00 2001 From: Yaroslav Date: Thu, 5 Sep 2019 19:35:38 +0300 Subject: init commit, extracted vim config from i3rice --- .vim/autoload/neomake/makers/ft/swift.vim | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .vim/autoload/neomake/makers/ft/swift.vim (limited to '.vim/autoload/neomake/makers/ft/swift.vim') diff --git a/.vim/autoload/neomake/makers/ft/swift.vim b/.vim/autoload/neomake/makers/ft/swift.vim new file mode 100644 index 0000000..76bb440 --- /dev/null +++ b/.vim/autoload/neomake/makers/ft/swift.vim @@ -0,0 +1,54 @@ +" vim: ts=4 sw=4 et + +function! neomake#makers#ft#swift#EnabledMakers() abort + if !empty(s:get_swiftpm_config()) + return ['swiftpm'] + endif + return ['swiftc'] +endfunction + +function! s:get_swiftpm_config() abort + return neomake#utils#FindGlobFile('Package.swift') +endfunction + +function! s:get_swiftpm_base_maker() abort + let maker = { + \ 'exe': 'swift', + \ 'append_file': 0, + \ 'errorformat': + \ '%E%f:%l:%c: error: %m,' . + \ '%E%f:%l: error: %m,' . + \ '%W%f:%l:%c: warning: %m,' . + \ '%Z%\s%#^~%#,' . + \ '%-G%.%#', + \ } + let config = s:get_swiftpm_config() + if !empty(config) + let maker.cwd = fnamemodify(config, ':h') + endif + return maker +endfunction + +function! neomake#makers#ft#swift#swiftpm() abort + let maker = s:get_swiftpm_base_maker() + let maker.args = ['build', '--build-tests'] + return maker +endfunction + +function! neomake#makers#ft#swift#swiftpmtest() abort + let maker = s:get_swiftpm_base_maker() + let maker.args = ['test'] + return maker +endfunction + +function! neomake#makers#ft#swift#swiftc() abort + " `export SDKROOT="$(xcodebuild -version -sdk macosx Path)"` + return { + \ 'args': ['-parse'], + \ 'errorformat': + \ '%E%f:%l:%c: error: %m,' . + \ '%W%f:%l:%c: warning: %m,' . + \ '%Z%\s%#^~%#,' . + \ '%-G%.%#', + \ } +endfunction -- cgit v1.2.3