summaryrefslogtreecommitdiffstats
path: root/autoload/db/adapter/ecto.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2019-03-29 20:30:36 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2019-03-29 20:30:36 +0100
commita55b6aa3aa797c989a4979a13a5bd2ae11cfd4a5 (patch)
tree0ec7670cabfdf1b5fa3545cee9ee9d6ca7c8ad32 /autoload/db/adapter/ecto.vim
parent1d45a6d4f094127b113470d7710695b280224933 (diff)
downloadvim-polyglot-3.7.1.tar.gz
vim-polyglot-3.7.1.zip
Remove grapqhl, fixes #387v3.7.1
Diffstat (limited to 'autoload/db/adapter/ecto.vim')
-rw-r--r--autoload/db/adapter/ecto.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/autoload/db/adapter/ecto.vim b/autoload/db/adapter/ecto.vim
new file mode 100644
index 00000000..54ee3396
--- /dev/null
+++ b/autoload/db/adapter/ecto.vim
@@ -0,0 +1,24 @@
+if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'elixir') != -1
+ finish
+endif
+
+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