REPL plugin : A plugin for handling a REPL interpreter in a scratch window
| script karma
Downloaded by 202
Comments, bugs, improvements
script versions (upload new version)
|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:
then :call ReplCmd() on each line to be executed (this should be mapped to some shortcut key)
Deleting the scratch buffer or the working buffer should close everything also.
|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'
Some settings for using with various interpreters can be found there: https://gist.github.com/baruchel/9546517
Click on the package to download.
ip used for rating: 22.214.171.124