https://invisible-island.net/vile/perl/
start-shell, resume-shell - start/resume a shell in a vile window
In .vilerc:
perl "use shell"
In [x]vile:
:start-shell
:resume-shell
The shell.pm module provides facilities for running a shell in a vile window.
A shell is started via
:start-shell
By default, the escape character (ESC) is used to escape the shell and the Control-V character is used to escape characters to send to the shell (like either ESC or Control-V). Since it can be quite annoying to have to explicitly escape all of the ESC characters that you wish to send to a shell or application running under the shell, a mechanism is provided for temporarily allowing ESC to be sent to the shell unfettered. The sequence ^V-e (Control-V followed by 'e') will toggle whether the ESC is sent to the shell or is used to escape the shell. (A message will be printed to the command line to indicate which is the case.)
Once the shell has been escaped from, all of the usual editor commands may be used to browse/edit the shell window text, move to other windows, etc. When you wish to resume interacting with the shell, simply place the cursor anywhere in the shell window and use
:resume-shell
to resume interacting with the shell. The cursor will be repositioned at the correct place to continue the interaction.
The shell.pm terminal emulation facilities have been made gdb aware, but you need to invoke gdb with the '--fullname' option to make use of these facilities. E.g, you might invoke gdb as follows:
gdb --fullname myprogram
When gdb is invoked in such a fashion, it will annotate its output to include the name of the file to open when stopped (e.g, due to breakpoint or after a single step). Going "up" or "down" the stack will also cause an appropriate annotation to be sent.
shell.pm will watch for these annotations and attempt to open and display the file specified by the annotation. The line at which execution has stopped will be highlighted using vile's selection mechanism.
A gdb.pm module is under construction.
You will almost certainly need to be running on some sort of Unix system for shell.pm to work at all.
You will need the IO::Pty module. This is available from
http://www.cpan.org/modules/by-module/IO/IO-Tty-0.04.tar.gz
You may want to check CPAN for a more recent version prior to downloading this version.
Resizing won't work unless you have sys/ioctl.ph installed. This file is created from your system's <sys/ioctl.h> file. In order to install sys/ioctl.ph, simply obtain whatever privileges are necessary for writing to the perl installation directories and then do:
cd /usr/include
h2ph -a -l sys/*
If you are on a BSD (or BSD-like) system which requires that the TIOCSCTTY ioctl() be used to acquire the controlling terminal, you will need to follow the above instructions to make sure that sys/ioctl.ph is install.
Terminal emulation is incomplete.
The shell is not immediately notified of a resize when a window is resized. (It is notified, but not until the shell sends some output to be placed in a buffer.)
The shell is not killed when the buffer is destroyed. (It is killed when vile exits though.)
Escaping the shell is clumsy.
Selecting with the mouse in xvile causes 'M' to be sent to the shell.
It's possible to change active windows with the mouse in xvile, but shell.pm is not made aware of the fact that a different window has been made active.
This is a work in progress. Expect many things to change.
Kevin Buettner