Skip to content

Instantly share code, notes, and snippets.

@jfornoff
Created August 18, 2018 15:26
Show Gist options
  • Save jfornoff/f8e7c9b426121a079ed7d590220891e9 to your computer and use it in GitHub Desktop.
Save jfornoff/f8e7c9b426121a079ed7d590220891e9 to your computer and use it in GitHub Desktop.
Function that allows using vim-test inside umbrella projects
function! UmbrellaElixirTestTransform(cmd) abort
if a:cmd !~ 'apps/'
return a:cmd
endif
let testCommand = join(split(a:cmd)[0:-2])
let umbrellaTestFilePath = split(a:cmd)[-1]
let pathFragments = split(umbrellaTestFilePath, "/")
let appName = pathFragments[1]
let localTestPath = join(pathFragments[2:], "/")
return join(["mix cmd --app", appName, testCommand, localTestPath])
endfunction
let g:test#custom_transformations = {'elixir': function('UmbrellaElixirTestTransform')}
let g:test#transformation = 'elixir'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment