Centralize use of classpath.vim
This commit is contained in:
parent
f43fa99703
commit
ead617d9c3
@ -413,14 +413,15 @@ function! s:oneoff.user_ns() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:oneoff.path() dict abort
|
function! s:oneoff.path() dict abort
|
||||||
return classpath#split(self.classpath)
|
return self._path
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:oneoff.eval(expr, options) dict abort
|
function! s:oneoff.eval(expr, options) dict abort
|
||||||
if !empty(get(a:options, 'session', 1))
|
if !empty(get(a:options, 'session', 1))
|
||||||
throw 'Fireplace: no live REPL connection'
|
throw 'Fireplace: no live REPL connection'
|
||||||
endif
|
endif
|
||||||
return s:spawning_eval(self.classpath, a:expr, get(a:options, 'ns', self.user_ns()))
|
return s:spawning_eval(join(self.path(), has('win32') ? ';' : ':'),
|
||||||
|
\ a:expr, get(a:options, 'ns', self.user_ns()))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:oneoff.message(...) abort
|
function! s:oneoff.message(...) abort
|
||||||
@ -452,6 +453,13 @@ function! s:includes_file(file, path) abort
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:path_extract(path)
|
||||||
|
if exists('*classpath#from_vim') && a:path =~# '\.jar'
|
||||||
|
return classpath#split(classpath#from_vim(a:path))
|
||||||
|
endif
|
||||||
|
return []
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! fireplace#path(...) abort
|
function! fireplace#path(...) abort
|
||||||
let buf = a:0 ? a:1 : s:buf()
|
let buf = a:0 ? a:1 : s:buf()
|
||||||
for repl in s:repls
|
for repl in s:repls
|
||||||
@ -459,10 +467,7 @@ function! fireplace#path(...) abort
|
|||||||
return repl.path()
|
return repl.path()
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if exists('*classpath#from_vim')
|
return s:path_extract(getbufvar(buf, '&path'))
|
||||||
return classpath#split(classpath#from_vim(getbufvar(buf, '&path')))
|
|
||||||
endif
|
|
||||||
return []
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fireplace#platform(...) abort
|
function! fireplace#platform(...) abort
|
||||||
@ -493,9 +498,9 @@ function! fireplace#platform(...) abort
|
|||||||
return repl
|
return repl
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
if exists('*classpath#from_vim') && fnamemodify(bufname(buf), ':e') =~# '^cljx\=$'
|
let path = s:path_extract(getbufvar(buf, '&path'))
|
||||||
let cp = classpath#from_vim(getbufvar(buf, '&path'))
|
if !empty(path) && fnamemodify(bufname(buf), ':e') =~# '^cljx\=$'
|
||||||
return extend({'classpath': cp, 'nr': bufnr(buf)}, s:oneoff)
|
return extend({'_path': path, 'nr': bufnr(buf)}, s:oneoff)
|
||||||
endif
|
endif
|
||||||
throw 'Fireplace: :Connect to a REPL or install classpath.vim'
|
throw 'Fireplace: :Connect to a REPL or install classpath.vim'
|
||||||
endfunction
|
endfunction
|
||||||
@ -1504,8 +1509,9 @@ function! s:leiningen_init() abort
|
|||||||
|
|
||||||
compiler lein
|
compiler lein
|
||||||
|
|
||||||
if exists('*classpath#from_vim')
|
let path = s:path_extract(&path)
|
||||||
let s:leiningen_paths[b:leiningen_root] = classpath#split(classpath#from_vim(&path))
|
if !empty(path)
|
||||||
|
let s:leiningen_paths[b:leiningen_root] = path
|
||||||
endif
|
endif
|
||||||
call s:leiningen_connect(0)
|
call s:leiningen_connect(0)
|
||||||
endfunction
|
endfunction
|
||||||
|
Loading…
Reference in New Issue
Block a user