sponsor Vim development Vim logo Vim Book Ad

RunCommand : Run shell command within a vim buffer

 script karma  Rating 0/0, Downloaded by 432  Comments, bugs, improvements  Vim wiki

created by
Xiaopan Zhang
script type

RunCommand is a vim plugin which run shell commands within a vim buffer.

===== Install
Your vim should be compiled with Python 2 support.

1) Download the \\\"RunCommand.py\\\" file to your \\\"~/.vim\\\" directory.
2) Add the \\\"pyfile ~/.vim/RunCommand.py\\\" to your \\\"~/.vimrc\\\" file.
3) Run \\\"mkdir ~/tmp\\\" to create a temporary directory for command files.

===== Usage
RunCommand assumes you have two monitors, and there is a terminal window on
each monitor. Each terminal is running Linux GNU screen, and the two GNU screen
sessions have the same number of windows. Last, Vim is running in one of the
windows of those GNU screen sessions. If all of these requirements are met, the
RunCommand will:

1) \\\"<Leader>re\\\" will load a command file in the current vim window. It will also
change the active window of the other GNU screen to the window with the same
window number of the GNU screen session where Vim is running. That window is
called peer window. For example, your Vim session is running in window 0,
\\\"<Leader>re\\\" will use window 0 of the other GNU screen session as the peer
window, and make that window visible. It will also change the current working
directory (CWD) of the peer window to the current working directory of the Vim

2) In the Vim window for the command file, you can edit shell commands. In Vim
normal mode, press <Enter> will send the current line as shell command to the
peer window to execute.  In Vim visual mode, select multiple lines of text and
press <Enter> will send all these lines (joined by one space) to the peer window
to execute. Notice that in multiple line mode, if a line ends with \\'\\\\\\', then the
next line is joined with it without a whitespace.

3) RunCommand maintains one command file for each directory in a temporary
directory, so if you load the command file from a working directory where you
use RunCommand before, you will see all the commands you used before.
install details

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
RunCommand.py 1.1 2019-08-25 7.0 Xiaopan Zhang Fix the issue that multiple lines do not work.
RunCommand.py 1.0 2019-08-25 7.0 Xiaopan Zhang Initial upload
ip used for rating:

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.