sponsor Vim development Vim logo Vim Book Ad

shellinsidevim.vim : Let you execute the shell command without leaving vim

 script karma  Rating 16/12, Downloaded by 2555  Comments, bugs, improvements  Vim wiki

created by
Zhenliang Ju
 
script type
utility
 
description
New version has combined into http://www.vim.org/scripts/script.php?script_id=2793

--Typing the Ex command "Shell" will also allow you to run a Shell which you
   give and pass up to 20 parameters to that shell.

   Sample syntax...
       :Shell ps -e

--Pressing "F4" will toggle the display of a buffer containing the output
   produced when running the shell command.

**************************Some special syntax format**************************

--If a Shell command starts with ":", this Shell will be executed as a vim Ex
  command, this is convenience if you map this command to a shortcut such as:

  map <CR> :Shell

  Then you could use this script to execute all the normal command directly.

  --If a Shell command starts with ">", this Shell will be executed with inputs
  which come from a file, which name is ".VIM_STD_IN". If the input file dose
not exsits, you could give the inputs line by line by typing directly.

  --If a Shell command ends with ";", this Shell will be executed as a program
  development tool. You could use this script for your development, then you
  could pass the compile or interpret command as the Shell parameters with ";"
  followed. When the command finished it will jump to the first error line if
  there are some errors. Of caurse you should special a compiler first.
 
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
shellinsidevim.tar.bz2 2.7 2009-09-24 7.0 Zhenliang Ju In some different platforms, the vim may not support the feature '@+'.
So these vimers will not use the result of the shell command in the System Clipboard.

BTW: This function of the plugin is unpublicized before.
shellinsidevim.tar.bz2 2.6 2009-09-23 7.0 Zhenliang Ju support the 'cd' command to change the current directory
Another fine adjustment
shellinsidevim.tbz2 2.4 2009-03-09 7.0 Zhenliang Ju Changed:
This version, you can put them into any plugin directory of your runtime path.
The old version only can find the common.vim if it is in the vim root plugin directory.
shellinsidevim.tbz2 2.3 2009-03-08 7.0 Zhenliang Ju Updated:
1.Add three global variables:
a. g:ShowOutputWindowWhenVimLaunched.
If its value gather then 0, The output window will open. The default value is 1.
b. g:AutoShowOutputWindow.
if its value is non-zero, the output window will open after command executing if it was closed.
c. g:ShowOutputInCommandline
If its value is non-zero, the outputs from system() will also echoed at the vim command line.

2.You can use "clear" shell command to clear the output windows
shellinsidevim.tbz2 2.2 2009-03-05 7.0 Zhenliang Ju Divide the common functions into a single vim file.
shellinsidevim.vim 2.2 2009-03-04 7.0 Zhenliang Ju changed:
Catch the exception from system(), this is useful when you interrupt the shell.

Give some more variables for controlling the output.
shellinsidevim.vim 2.1 2009-01-10 7.0 Zhenliang Ju fixed bug:
The shell with input file by invoking system(exp,input) does not work, maybe this is a bug of vim itself.

update:
The message in the output window is highlighted for reading.

changed:
The input file has a fixed name called ".VIM_STD_IN", the orig variable g:VIM_STD_IN_FILE has been deleted.

Other:
last version I gave an error email , this is a correct one
shellinsidevim.vim 2.0 2008-12-29 7.2 Zhenliang Ju Initial upload
ip used for rating: 3.15.5.183

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.
   
Vim at Github