parent
8d253a9fdf
commit
5b57f37802
@ -30,8 +30,9 @@ file is found, an nREPL connection will be established automatically.
|
|||||||
CONNECTING TO A REPL *foreplay-connect*
|
CONNECTING TO A REPL *foreplay-connect*
|
||||||
|
|
||||||
*foreplay-:Connect*
|
*foreplay-:Connect*
|
||||||
:Connect {proto}://{host}:{port}
|
:Connect {proto}://{host}:{port} {path}
|
||||||
Connect to a REPL server.
|
Connect to a REPL server. The path is the root of the
|
||||||
|
project that the REPL applies to.
|
||||||
|
|
||||||
:Connect Interactively prompt for the options to connect to a
|
:Connect Interactively prompt for the options to connect to a
|
||||||
REPL server.
|
REPL server.
|
||||||
|
@ -170,7 +170,7 @@ endfunction
|
|||||||
" }}}1
|
" }}}1
|
||||||
" :Connect {{{1
|
" :Connect {{{1
|
||||||
|
|
||||||
command! -bar -complete=customlist,s:connect_complete -nargs=? ForeplayConnect :exe s:Connect(<q-args>)
|
command! -bar -complete=customlist,s:connect_complete -nargs=* ForeplayConnect :exe s:Connect(<f-args>)
|
||||||
|
|
||||||
function! foreplay#input_host_port()
|
function! foreplay#input_host_port()
|
||||||
let arg = input('Host> ', 'localhost')
|
let arg = input('Host> ', 'localhost')
|
||||||
@ -209,7 +209,7 @@ function! s:connect_complete(A, L, P)
|
|||||||
return options
|
return options
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:Connect(arg)
|
function! s:Connect(arg, ...)
|
||||||
if a:arg =~# '^\w\+://'
|
if a:arg =~# '^\w\+://'
|
||||||
let [proto, arg] = split(a:arg, '://')
|
let [proto, arg] = split(a:arg, '://')
|
||||||
elseif a:arg !=# ''
|
elseif a:arg !=# ''
|
||||||
@ -239,16 +239,16 @@ function! s:Connect(arg)
|
|||||||
let client = s:register_connection(connection)
|
let client = s:register_connection(connection)
|
||||||
echo 'Connected to '.proto.'://'.arg
|
echo 'Connected to '.proto.'://'.arg
|
||||||
let path = fnamemodify(exists('b:java_root') ? b:java_root : fnamemodify(expand('%'), ':p:s?.*\zs[\/]src[\/].*??'), ':~')
|
let path = fnamemodify(exists('b:java_root') ? b:java_root : fnamemodify(expand('%'), ':p:s?.*\zs[\/]src[\/].*??'), ':~')
|
||||||
let root = input('Scope connection to: ', path, 'dir')
|
let root = a:0 ? expand(a:1) : input('Scope connection to: ', path, 'dir')
|
||||||
if root !=# ''
|
if root !=# '' && root !=# '-'
|
||||||
let s:repl_paths[fnamemodify(root, ':p:s?[\/]$??')] = client
|
let s:repl_paths[fnamemodify(root, ':p:s?.\zs[\/]$??')] = client
|
||||||
endif
|
endif
|
||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
augroup foreplay_connect
|
augroup foreplay_connect
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd FileType clojure command! -bar -complete=customlist,s:connect_complete -nargs=? Connect :ForeplayConnect <args>
|
autocmd FileType clojure command! -bar -complete=customlist,s:connect_complete -nargs=* Connect :ForeplayConnect <args>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
|
Loading…
Reference in New Issue
Block a user