mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-13 05:53:50 -05:00
32 lines
967 B
VimL
32 lines
967 B
VimL
let s:base = expand("<sfile>:h:h")
|
|
let Filter = { _, v -> stridx(v, s:base) == -1 && stridx(v, $VIMRUNTIME) == -1 && v !~ "after" }
|
|
let files = filter(globpath(&rtp, 'autoload/db/adapter/ecto.vim', 1, 1), Filter)
|
|
if len(files) > 0
|
|
exec 'source ' . files[0]
|
|
finish
|
|
endif
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'elixir') == -1
|
|
|
|
let s:path = expand('<sfile>:h')
|
|
let s:cmd = join(['mix', 'run', '--no-start', '--no-compile', shellescape(s:path.'/get_repos.exs')])
|
|
|
|
function! s:repo_list() abort
|
|
return map(systemlist(s:cmd), 'split(v:val)')
|
|
endfunction
|
|
|
|
function! db#adapter#ecto#canonicalize(url) abort
|
|
for l:item in s:repo_list()
|
|
let l:name = get(l:item, 0)
|
|
let l:url = get(l:item, 1)
|
|
if !empty(l:name) && 'ecto:'.l:name ==# a:url
|
|
return l:url
|
|
endif
|
|
endfor
|
|
endfunction
|
|
|
|
function! db#adapter#ecto#complete_opaque(url) abort
|
|
return map(s:repo_list(), 'v:val[0]')
|
|
endfunction
|
|
|
|
endif
|