sponsor Vim development Vim logo Vim Book Ad

REPL plugin : A plugin for handling a REPL interpreter in a scratch window

 script karma  Rating 5/2, Downloaded by 144    Comments, bugs, improvements  Vim wiki

created by
Thomas Baruchel
 
script type
utility
 
description
This plugin allows the user to open a scratch window with some external REPL interpreter (either a shell or some interpreter for any programming language). You should map a key (see the beginning of the file) to the ReplCmd() command which sends the current line to the interpreter (input is in your edited buffer, output is in the scratch buffer).

See video: http://cjoint.com/14ma/DCmkCJGRZH7.htm

The plugin uses FIFO special files and won't work under Windows. On the other hand, it will run either in terminal mode or in graphical mode (no server callback). It doesn't need embbeded script languages like python either.

For working, just type:

  :call ReplNew()
  then :call ReplCmd() on each line to be executed (this should be mapped to some shortcut key)
  :call ReplClose()

Deleting the scratch buffer or the working buffer should close everything also.
 
install details
By default, the script should open a shell /bin/sh
But the script has been tried with other interpreters.
Just edit your ~/.vimrc file and define the following global variables:

The interpreter to be launched:
  let g:repl_cmd = '/bin/sh'

The command to be sent to the interpreter to make it close by itself:
  let g:repl_stop = 'exit'

The command to be sent to the interpreter after each command of the session (for parsing purposes); it should echo some arbitrary string. Single quote should be used rather than double quotes (but if double quotes are absolutely needed, protecting them with a backslash should probably work). What is printed by the interpreter doesn not need to be of a string type from the point of view of the interpreter; it could be a number or whatever as long as the output is an known sequence of characters.
  let g:repl_send = 'echo REPL-VIM-INTERNAL-KEY'

The exact string to be caught from the previous command:
  let g:repl_detect = 'REPL-VIM-INTERNAL-KEY'
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
repl.vim 1.4 2014-03-12 7.0 Thomas Baruchel Release version.
repl.vim 1.3 2014-03-12 7.0 Thomas Baruchel Fixed indentation issues in the REPL windows.
repl.vim 1.2 2014-03-12 7.0 Thomas Baruchel Fixed the bug concerning the subprocess remaining alive.
repl.vim 1.1 2014-03-11 7.0 Thomas Baruchel Added some support for highlighting the line while executed and restoring cursor position.
repl.vim 1.0 2014-03-11 7.0 Thomas Baruchel Initial upload
ip used for rating: 54.80.121.186

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo