Skip to content

Commit

Permalink
doc update (0.12 example string)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanov committed Oct 21, 2011
1 parent 9017393 commit 57ee60e
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions README.rst
Expand Up @@ -14,31 +14,36 @@ execute, and also get back object introspection and word completions in
Vim, like what you get with: ``object?<enter>`` and ``object.<tab>`` in
IPython.

The big change from previous versions of ``ipy.vim`` is that it no longer
requires the old brittle ``ipy_vimserver.py`` instantiation, and since
The big change from previous versions of ``ipy.vim`` is that it no longer
requires the old brittle ``ipy_vimserver.py`` instantiation, and since
it uses just vim and python, it is platform independent (i.e. should work
even on windows, unlike the previous \*nix only solution). The requirements
are IPython 0.11+ with zeromq capabilities, vim compiled with +python.

If you can launch ``ipython qtconsole`` and ``:echo has('python')`` returns 1
in vim, you should be good to go.
If you can launch ``ipython qtconsole`` or ``ipython kernel``, and
``:echo has('python')`` returns 1 in vim, you should be good to go.

-----------------
Quickstart Guide:
-----------------
Start ``ipython qtconsole`` [*]_ and copy the connection string.
Source ``ipy.vim`` file, which provides new IPython command::

:source ipy.vim
:source ipy.vim
(or copy it to ~/.vim/ftplugin/python to load automatically)

:IPythonClipboard
:IPythonClipboard
(or :IPythonXSelection if you're using X11 without having to copy)

The :IPython command allows you to put the full string, e.g.::
The :IPython command allows you to put the full connection string. For IPython
0.11, it would look like this::

:IPython --existing --shell=41882 --iopub=43286 --stdin=34987 --hb=36697

and for IPython 0.12, like this::

:IPython --existing kernel-85997.json

The ``:IPythonClipboard`` command just uses the ``+`` register to get the
connection string, whereas ``:IPythonXSelection`` uses the ``*`` register

Expand Down Expand Up @@ -77,7 +82,7 @@ It also works blockwise in Visual Mode. Select and send these lines using
'%d'*len(code)%code == str(int(math.pi*1e5))

Then, go to the qtconsole and run this line::

print secret_decoder(_i,_)

You can also send whole files to IPython's ``%run`` magic using ``<F5>``.
Expand Down Expand Up @@ -106,7 +111,7 @@ vim-ipython 'shell'
**NEW since IPython 0.11**!

By monitoring km.sub_channel, we can recreate what messages were sent to
IPython, and what IPython sends back in response.
IPython, and what IPython sends back in response.

``monitor_subchannel`` is a parameter that sets whether this 'shell' should
updated on every sent command (default: True).
Expand All @@ -124,6 +129,7 @@ You can change these at the top of the ipy.vim::
monitor_subchannel = True # update vim-ipython 'shell' on every send?
run_flags= "-i" # flags to for IPython's run magic when using <F5>

**Disabling default mappings**
In your own ``.vimrc``, if you don't like the mappings provided by default,
you can define a variable ``let g:ipy_perform_mappings=0`` which will prevent
vim-ipython from defining any of the default mappings.
Expand All @@ -135,25 +141,25 @@ Current issues:
- The ipdb integration is not yet re-implemented.
- If you're running inside ``screen``, read about the ``<CTRL-S>`` issue `here
<http://munkymorgy.blogspot.com/2008/07/screen-ctrl-s-bug.html>`_, and add
this line to your ``.bashrc`` to fix it::
this line to your ``.bashrc`` to fix it::

stty stop undef # to unmap ctrl-s
stty stop undef # to unmap ctrl-s

- In vim, if you're getting ``ImportError: No module named
IPython.zmq.blockingkernelmanager`` but are able to import it in regular
python, **either**

1. your ``sys.path`` in vim differs from the ``sys.path`` in regular python.
Try running these two lines, and comparing their output files::

$ vim -c 'py import vim, sys; vim.current.buffer.append(sys.path)' -c ':wq vim_syspath'
$ python -c "import sys; f=file('python_syspath','w'); f.write('\n'.join(sys.path)); f.close()"

**or**

2. your vim is compiled against a different python than you are launching. See
if there's a difference between ::

$ vim -c ':py import os; print os.__file__' -c ':q'
$ python -c ':py import os; print os.__file__'

Expand All @@ -170,15 +176,14 @@ Current issues:
``monitor_subchannel`` is set. This is a bug in minibufexpl.vim and the workaround
is described in vim-ipython issue #7.

------
Thanks
------
----------------------------
Thanks and Bug Participation
----------------------------
* @MinRK for guiding me through the IPython kernel manager protocol.

*Bugs*

* @nakamuray and @tcheneau for reporting and providing a fix for when vim is compiled without a gui (#1)
* @unpingco for reporting Windows bugs (#3,#4)
* @simon-b for terminal vim arrow key issue (#5)
* @jorgesca and @kwgoodman for shell (#6)
* @zeekay for easily allowing custom mappings (#9)
* @minrk for support of connection_file-based IPython connection (#13)
* @jorgesca for reporting the lack of profile handling capability (#14)

0 comments on commit 57ee60e

Please sign in to comment.