Skip to content

Commit

Permalink
updated to latest version of vim-ipython
Browse files Browse the repository at this point in the history
ivanov/vim-ipython 1bf8afc8fbc34c282ddfc615193716c0e0dcc676

The new features include a Ctrl-C implementation for local kernels,
autoupdates on idle and focus change for vim-ipython shell, the
possibility to limit completefunc to a local buffer only or disable it
altogether. Lots of other small bugfixes.
  • Loading branch information
ivanov committed Jun 14, 2012
1 parent 99373b4 commit ddefdb1
Show file tree
Hide file tree
Showing 2 changed files with 268 additions and 60 deletions.
98 changes: 81 additions & 17 deletions docs/examples/vim/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ 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
it uses just vim and python, it is platform independent (i.e. should work
it uses just vim and python, it is platform independent (i.e. works
even on windows, unlike the previous \*nix only solution). The requirements
are IPython 0.11+ with zeromq capabilities, vim compiled with +python.

Expand Down Expand Up @@ -45,15 +45,28 @@ 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
connection string, whereas ``:IPythonXSelection`` uses the ``*`` register.

**NEW in IPython 0.12**!
Since IPython 0.12, you can simply use::

:IPython

without arguments to connect to the most recent IPython session (this is the
same as passing just the ``--existing`` flag to ``ipython qtconsole`` and
``ipython console``.

.. [*] Though the demos above use ``qtconsole``, it is not required
for this workflow, it's just that it was the easiest way to show how to
make use of the new functionality in 0.11 release. In the current git
trunk of IPython, you can use ``ipython kernel`` to create a kernel and
get the connection string to use for any frontend (including vim-ipython).
If you are still using 0.11, you can launch a regular kernel using
``python -c "from IPython.zmq.ipkernel import main; main()"``
make use of the new functionality in 0.11 release. Since IPython 0.12, you
can use ``ipython kernel`` to create a kernel and get the connection
string to use for any frontend (including vim-ipython), or use ``ipython
console`` to create a kernel and immediately connect to it using a
terminal-based client. You can even connect to an active IPython Notebook
kernel - just watch for the connection string that gets printed when you
open the notebook, or use the ``%connect_info`` magic to get the
connection string. If you are still using 0.11, you can launch a regular
kernel using ``python -c "from IPython.zmq.ipkernel import main; main()"``
------------------------
Sending lines to IPython
Expand Down Expand Up @@ -87,12 +100,17 @@ Then, go to the qtconsole and run this line::

You can also send whole files to IPython's ``%run`` magic using ``<F5>``.

**NEW in IPython 0.12**!
If you're trying to do run code fragments that have leading whitespace, use
``<Alt-S>`` instead - it will dedent a single line, and remove the leading
whitespace of the first line from all lines in a visual mode selection.

-------------------------------
IPython's object? Functionality
-------------------------------

If you're using gvim, mouse-over a variable to see IPython's ? equivalent. If
you're using vim from a terminal, or want to copy something from the
If you're using gvim, mouse-over a variable to see IPython's ``?`` equivalent.
If you're using vim from a terminal, or want to copy something from the
docstring, type ``<leader>d``. ``<leader>`` is usually ``\`` (the backslash
key). This will open a quickpreview window, which can be closed by hitting
``q`` or ``<escape>``.
Expand All @@ -108,7 +126,6 @@ completion.
-------------------
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.
Expand All @@ -119,6 +136,11 @@ updated on every sent command (default: True).
If at any later time you wish to bring this shell up, including if you've set
``monitor_subchannel=False``, hit ``<leader>s``.

**NEW since IPython 0.12**
For local kernels (kernels running on the same machine as vim), `Ctrl-C` in
the vim-ipython 'shell' sends an keyboard interrupt. (Note: this feature may
not work on Windows, please report the issue to ).

-------
Options
-------
Expand All @@ -134,6 +156,14 @@ 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.

**NEW since IPython 0.12**
**Making completefunc local to a buffer, or disabling it**
By default, vim-ipython activates the custom completefunc globally.
Sometimes, having a completefunc breaks other plugins' completions. Putting
the line ``let g:ipy_completefunc = 'local'`` in one's vimrc will activate the
IPython-based completion only for current buffer. Setting `g:ipy_completefunc`
to anything other than `'local'` or `'global'` disables it altogether.

---------------
Current issues:
---------------
Expand Down Expand Up @@ -161,7 +191,7 @@ Current issues:
if there's a difference between ::

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

- For vim inside a terminal, using the arrow keys won't work inside a
documentation buffer, because the mapping for ``<Esc>`` overlaps with
Expand All @@ -179,11 +209,45 @@ Current issues:
----------------------------
Thanks and Bug Participation
----------------------------
* @MinRK for guiding me through the IPython kernel manager protocol.
* @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)
Here's a brief acknowledgment of the folks who have graciously pitched in. If
you've been missed, don't hesitate to contact me, or better yet, submit a
pull request with your attribution.

* @minrk for guiding me through the IPython kernel manager protocol, and
support of connection_file-based IPython connection (#13)
* @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), providing better multiline
dedenting (#15), and suggesting that a resized vim-ipython shell stays
resized (#16).
* @simon-b for terminal vim arrow key issue (#5)
* @jorgesca and @kwgoodman for shell (#6)
* @jorgesca and @kwgoodman for shell update problems (#6)
* @xowlinx and @vladimiroff for Ctrl-S issues in Konsole (#8)
* @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)
* @jorgesca for reporting the lack of profile handling capability (#14),
only open updating 'shell' if it is open (#29)
* @enzbang for removing mapping that's not currently functional (#17)
* @ogrisel for fixing documentation typo (#19)
* @koepsell for gracefully exiting in case python is not available (#23)
* @mrterry for activating completefunc only after a connection is made (#25),
Ctrl-C implementation in vim-ipython 'shell' (#28)
* @nonameentername for completion on import statements (#26)
* @dstahlke for setting syntax of doc window to ReST
* @jtratner for docs with quotes (#30)
* @pielgrzym for setting completefunc locally to a buffer (#32)

Similar Projects
----------------
* `vim-slime`_ - Grab some text and "send" it to a GNU Screen / tmux session
(Jonathan Palardy)
* `screen.vba`_ - Simulate a split shell, using GNU Screen / tmux, that you
can send commands to (Eric Van Dewoestine)
* conque_ - terminal emulator which uses a Vim buffer to display the program
output (Nico Raffo)
* `ipyqtmacvim`_ - plugin to send commands from MacVim to IPython Qt console
(Justin Kitzes)

.. _vim-slime: https://github.com/jpalardy/vim-slime
.. _screen.vba: https://github.com/ervandew/screen
.. _conque: http://code.google.com/p/conque/
.. _ipyqtmacvim: https://github.com/jkitzes/ipyqtmacvim/
Loading

0 comments on commit ddefdb1

Please sign in to comment.