Skip to content

Instantly share code, notes, and snippets.

@yamaya
Last active August 29, 2015 14:17
Show Gist options
  • Save yamaya/c0e844ec478d62cbc7db to your computer and use it in GitHub Desktop.
Save yamaya/c0e844ec478d62cbc7db to your computer and use it in GitHub Desktop.
watchdogs.vim support swift.
if executable('swiftc') && get(get(g:, 'iOS_SDK'), 'path') != '' " {{{
function! g:Watchdogs_swift_findfiles()
let s = ''
try
let dir = substitute(system('git rev-parse --show-toplevel'), '\n', '', 'g')
execute 'lcd! ' . dir
let files = systemlist('git ls-files --exclude-standard |grep ".swift$" |grep --invert "^.*Tests/"') " TODO: XCTests
let s = join(map(files, 'l:dir."/".v:val'), ' ')
catch
echoms v:exception
endtry
return s
endfunction
let g:quickrun_config['watchdogs_checker/swiftc'] = {
\ 'command': 'swiftc'
\, 'exec': '%c -target i386-apple-ios8.2 -target-cpu yonah -parse %{g:Watchdogs_swift_findfiles()} -sdk ' . g:iOS_SDK.path . ' -Onone'
\, 'errorformat':
\ '%E%f:%l:%c: error: %m,'
\ . '%W%f:%l:%c: warning: %m,'
\ . '%Z%\s%#^~%#,'
\ . '%-G%.%#'
\}
let g:quickrun_config['swift/watchdogs_checker'] = {
\ 'type': 'watchdogs_checker/swiftc'
\, 'hook/read_swift_option/enable': 1
\}
endif " }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment