REPL plugin : A plugin for handling a REPL interpreter in a scratch window
script karma |
Rating 9/3,
Downloaded by 1805 |
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'
Some settings for using with various interpreters can be found there: https://gist.github.com/baruchel/9546517 |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 44.220.184.63
|