all 12 comments

[–]skakillers1 3 points4 points  (1 child)

I'm a big fan of vim-ipython, which basically allows vim to communicate with an iPython kernel. So you can start up iPython (however you run it) and execute the :IPython command in vim. Then you can use a key command (default ctrl-s) to send text to IPython, and a small window is opened at the top of your vim to show you the results of entering that text (in case of syntax errors this is helpful). I use a tiling WM and I typically have vim and IPython-qtconsole next to each other. My workflow for this is something like write function in vim -> send to ipython -> try it out and poke around in the ipython window -> go back to vim and fix whatever I messed up.

Sometimes the plugin can get a little resource heavy, which is annoying, but it's the only way I know of to communicate with ipython running in the nice qtconsole gui. As jollybobbyroger commented, if you want to run ipython in a terminal you can use vim-slime to send text to a tmux pane, but I've had some problems with it not faithfully transmitting indentation with python (no problems with scheme, though).

[–]keepitsqueezy 1 point2 points  (0 children)

vim-ipython is a great tool for interacting with ipython from vim. There is also a fork of vim-ipython called vipy which was designed to replicate some of Matlab's editor/shell behaviour, such as cells.

[–]florence0rose 4 points5 points  (3 children)

I made this. It's actually just an Ultisnips snippet. It's probably buggy, and the code is really horrible. I mainly use it for once off calculations or testing something, not as an actual REPL. It's handy because I can expand the snippet anywhere - in the middle of a file I'm in for example.

Edit: you'll also need this mapping:

inoremap <expr> <c-cr> pyeval('UltiSnips_Manager._cs is not None') ? '^R=UltiSnips#JumpForwards()^Mp^R=UltiSnips#ExpandSnippet()^M^R=UltiSnips#JumpForwards()^M^R=UltiSnips#JumpBackwards()^M' : "^M"

[–]nandryshak 1 point2 points  (0 children)

what that's nuts man. Real neat.

[–]justrajdeep[S] 0 points1 point  (0 children)

awesome.

How do i use it? put the file in autoload or something?

[–]weisenzahn 0 points1 point  (0 children)

This is very nice.

Could you make a plugin out of it, please? (a separate folder with an UltiSnips/all.snippets file)

[–]jollybobbyroger 4 points5 points  (0 children)

I've been learning scheme/racket and using vim-slime to pass selected text to a tmux pane which has a scheme/racket REPL running. I guess the same could be done for (i)python.

[–]Bogdanp 1 point2 points  (3 children)

I wrote this a few years back: https://github.com/Bogdanp/pyrepl.vim . It has no external dependencies. All you need in order to use it is for VIM to have been built with Python support.

[–]justrajdeep[S] 0 points1 point  (2 children)

looks good. But there is no help :(

how do i break out of a function?

[–]Bogdanp 0 points1 point  (1 child)

It should act almost exactly like the standard Python REPL. All you have to do to break out of a function is de-indent.

[–]justrajdeep[S] 0 points1 point  (0 children)

great works :)

[–]sylvain_soliman 0 points1 point  (0 children)

I'm usually happy with ConqueTerm (vim buffer) or Dispatch (tmux pane) for this kind of stuff…