Skip to content

Commit 8a8a38a

Browse files
committed
:IPy without args acts as --existing (closes #2)
For this to work you have to be running IPython from git, until 0.12 comes out. An error message will be reported for IPython 0.11, since it did not support --existing. Those who wish to gain this functionality in IPython 0.11 should take a look at the unmerged pull request #2: #2 There, Philip Neustrom exploits the fact that on 0.11, IPython's full connection string could be inferred from it's process listing via ps. That approach does not work, nor is it necessary, with the connection file mechanisms now in IPython.
1 parent 393ea4a commit 8a8a38a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ftplugin/python/ipy.vim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ try:
4949
except NameError:
5050
km = None
5151

52-
def km_from_string(s):
52+
def km_from_string(s=''):
5353
"""create kernel manager from IPKernelApp string
5454
such as '--shell=47378 --iopub=39859 --stdin=36778 --hb=52668' for IPython 0.11
5555
or just 'kernel-12345.json' for IPython 0.12
@@ -86,6 +86,9 @@ def km_from_string(s):
8686
km = BlockingKernelManager(connection_file = fullpath)
8787
km.load_connection_file()
8888
else:
89+
if s == '':
90+
echo(":IPython 0.11 requires the full connection string")
91+
return
8992
loader = KeyValueConfigLoader(s.split(), aliases=kernel_aliases)
9093
cfg = loader.load_config()['KernelApp']
9194
try:
@@ -433,7 +436,7 @@ if g:ipy_perform_mappings != 0
433436
vmap <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
434437
endif
435438

436-
command! -nargs=+ IPython :py km_from_string("<args>")
439+
command! -nargs=* IPython :py km_from_string("<args>")
437440
command! -nargs=0 IPythonClipboard :py km_from_string(vim.eval('@+'))
438441
command! -nargs=0 IPythonXSelection :py km_from_string(vim.eval('@*'))
439442

0 commit comments

Comments
 (0)