sponsor Vim development Vim logo Vim Book Ad

shell.vim : Improved integration between Vim and its environment (fullscreen, open URL, etc)

 script karma  Rating 250/83, Downloaded by 15913  Comments, bugs, improvements  Vim wiki

created by
Peter Odding
 
script type
utility
 
description
This plug-in aims to improve the integration between Vim and its environment by providing functions to switch to full-screen (see the screenshots at http://peterodding.com/code/vim/shell/screenshots), open URLs in the user's default web browser and execute external commands in the background without opening a command prompt window. A DLL is included to perform these things on Windows, while on UNIX external commands are used.

For more information about the plug-in please refer to its homepage or the project page on GitHub:

http://peterodding.com/code/vim/shell/
http://github.com/xolox/vim-shell

If you have questions, bug reports, suggestions, etc. the author can be contacted at [email protected]. If you like this plug-in please vote for it below!

ALTERNATIVES
After publishing this plug-in I found that vimscript #687 and vimscript #2596 also implement full-screen on Windows using a similar approach. I prefer the effect of my plug-in because it seems to hide window decorations more effectively. Also note that my plug-in was developed independently of the other two.
 
install details
Please note that the vim-shell plug-in requires my vim-misc plug-in which is separately distributed (see vimscript #4597).

Unzip the most recent ZIP archives of the vim-shell and vim-misc plug-ins inside your Vim profile directory (usually this is ~/.vim on UNIX and %USERPROFILE%\vimfiles on Windows), restart Vim and execute the command :helptags ~/.vim/doc (use :helptags ~\vimfiles\doc instead on Windows). Now try it out:

• Press <F11> or execute :Fullscreen to switch to full-screen mode and back;

• Press <F6> or execute :Open to open files, directories, URLs and e-mail addresses using their associated default programs. By default the filename/URL/etc. under the text cursor is used, but you can also give an argument to the :Open command, for example:

    :Open $VIMRUNTIME
    :Open http://www.vim.org/scripts/script.php?script_id=3123

If you prefer you can also use Pathogen, Vundle or a similar tool to install & update the vim-shell and vim-misc plug-ins using a local clone of the git repository.
 

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
shell.zip 0.13.6 2014-07-06 7.0 Peter Odding • Increase verbosity of xolox#shell#can_use_dll():
   http://github.com/xolox/vim-shell/commit/1e50986
> • Make it possible to disable use of the DDL (useful during testing):
  
http://github.com/xolox/vim-shell/commit/c697297
> • Make it possible to silence full screen message (issue #26):
  
http://github.com/xolox/vim-shell/commit/c19945c
shell.zip 0.13.3 2014-06-16 7.0 Peter Odding • Support MacVim fullscreen:
   http://github.com/xolox/vim-shell/commit/5d79d74
> • Merge pull request #25: Support MacVim fullscreen:
  
http://github.com/xolox/vim-shell/commit/42f1549
shell.zip 0.13.2 2013-09-02 7.0 Peter Odding • Remove duplicate help tag (reported by Yaofeng Peng):
   http://github.com/xolox/vim-shell/commit/80f04f0
shell.zip 0.13.1 2013-08-19 7.0 Peter Odding • Make sure vim-misc is installed, politely complain if it isn't:
   http://github.com/xolox/vim-shell/commit/1e1a116
shell.zip 0.13 2013-06-12 7.0 Peter Odding • MakeWithShell triggering QuickFixCmdPre & QuickFixCmdPost (contributed by Marc Montu):
   http://github.com/xolox/vim-shell/commit/1382495
> • Improvements on pull request #16 (the change above):
  
http://github.com/xolox/vim-shell/commit/a04b3ab
shell.zip 0.12.10 2013-06-03 7.0 Peter Odding • Improve quoting in execute_with_dll() (suggested by Ingo Karkat):
   http://github.com/xolox/vim-shell/commit/e7157d5
shell.zip 0.12.9 2013-05-28 7.0 Peter Odding • Bug fixes for 64 bit Windows backend of xolox#shell#execute_with_dll() (contributed by Ingo Karkat):
   http://github.com/xolox/vim-shell/commit/aac1374
  
; http://github.com/xolox/vim-shell/commit/e93e625
  
; http://github.com/xolox/vim-shell/commit/84c2fda
shell.zip 0.12.7 2013-05-25 7.0 Peter Odding • Make reporting in s:library_call() user friendly:
   http://github.com/xolox/vim-shell/commit/1b27cc0
> • Document vim-misc as external dependency (needs to be installed separately from now on):
  
http://github.com/xolox/vim-shell/commit/4849e83
> • Improve integration between vim-shell & vim-session (issue #11):
  
http://github.com/xolox/vim-shell/commit/5357db8
shell.zip 0.12.5 2013-05-20 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/4aada54
shell.zip 0.12.4 2013-05-19 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/60a36f7
shell.zip 0.12.2 2013-05-14 7.0 Peter Odding • Provide v:shell_error equivalent (g:xolox#shell#make_exit_code):
   http://github.com/xolox/vim-shell/commit/e0a301a
shell.zip 0.12.1 2013-05-13 7.0 Peter Odding This release contains a big internal refactoring that makes most of what was
previously called xolox#shell#execute() available as xolox#misc#os#exec() for
use by all of my plug-ins, even when the vim-shell plug-in is not installed.

As a bonus xolox#misc#os#exec() reliably reports exit codes both on Windows
using the compiled DLL and on other platforms using plain system().

References:

• Move xolox#shell#execute() -> xolox#misc#os#exec():
   http://github.com/xolox/vim-shell/commit/6539185
> • Updated miscellaneous scripts:
  
http://github.com/xolox/vim-shell/commit/f8ee02d
  
; http://github.com/xolox/vim-shell/commit/9c88b0e
shell.zip 0.11.3 2013-05-06 7.0 Peter Odding • Bug fix: Insufficient arguments for printf():
   http://github.com/xolox/vim-shell/commit/e82a7f6
shell.zip 0.11.2 2013-05-03 7.0 Peter Odding • Bug fix for changes to "always on top" behavior:
   http://github.com/xolox/vim-shell/commit/427f408
shell.zip 0.11 2013-05-02 7.0 Peter Odding • Make it possible to disable "always on top" on Windows:
   http://github.com/xolox/vim-shell/commit/a239d6b
shell.zip 0.10 2013-05-01 7.0 Peter Odding • Make integration (:make without console window):
   http://github.com/xolox/vim-shell/commit/52c9b24
shell.zip 0.9.25 2013-04-28 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/2e381eb
shell.zip 0.9.24 2013-04-21 7.0 Peter Odding • Make compatibility with miscellaneous scripts explicit:
   http://github.com/xolox/vim-shell/commit/07355e3
shell.zip 0.9.23 2011-11-26 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/4adb4ad
  
; http://github.com/xolox/vim-shell/commit/3a41726
  
; http://github.com/xolox/vim-shell/commit/9b4c774
shell.zip 0.9.22 2011-11-21 7.0 Peter Odding • Rename xolox#shell#escape() to xolox#misc#escape#shell():
   http://github.com/xolox/vim-shell/commit/8c600e9
shell.zip 0.9.21 2011-11-11 7.0 Peter Odding • Make the full screen window top most (shell.c patch contributed by Guo Yu):
   http://github.com/xolox/vim-shell/commit/d51681b
shell.zip 0.9.20 2011-10-28 7.0 Peter Odding • Workaround &shellslash option on Windows (issue #6):
   http://github.com/xolox/vim-shell/commit/942e75a
shell.zip 0.9.18 2011-10-28 7.0 Peter Odding • Use HTTP HEAD to disambiguate URLs with trailing punctuation (issue #4):
   http://github.com/xolox/vim-shell/commit/d530837
shell.zip 0.9.17 2011-10-18 7.0 Peter Odding • Bug fix: Restore regex to match e-mail addresses:
   http://github.com/xolox/vim-shell/commit/350962b
> • Workaround for E488 (bug in Vim or my understanding of Vim?):
  
http://github.com/xolox/vim-shell/commit/32ce59b
> • Add debugging statements (should make it easier to debug issues like #5):
  
http://github.com/xolox/vim-shell/commit/7eb0d85
> • Debugging statements for execution of external commands:
  
http://github.com/xolox/vim-shell/commit/37dbfc3
shell.zip 0.9.13 2011-09-25 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/a97dd83
shell.zip 0.9.12 2011-09-17 7.0 Peter Odding • Extract :Maximize from :Fullscreen (suggested by Benjamin Bergman):
   http://github.com/xolox/vim-shell/commit/665a2b5
shell.zip 0.9.11 2011-09-04 7.0 Peter Odding • Updated miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/34ef803
shell.zip 0.9.10 2011-08-31 7.0 Peter Odding • Version bump because of miscellaneous scripts:
   http://github.com/xolox/vim-shell/commit/c284b38
  
; http://github.com/xolox/vim-shell/commit/8310041
shell.zip 0.9.9 2011-08-31 7.0 Peter Odding • Option handling with xolox#misc#option#get({name}, {default}):
   http://github.com/xolox/vim-shell/commit/e228b0e
  
; http://github.com/xolox/vim-shell/commit/0b1c06e
  
; http://github.com/xolox/vim-shell/commit/168d0cd
> • Move version variable to autoload script:
  
http://github.com/xolox/vim-shell/commit/6cbfe98
  
; http://github.com/xolox/vim-shell/commit/168d0cd
> • Document xolox#shell#fullscreen(), xolox#shell#is_fullscreen()
  
http://github.com/xolox/vim-shell/commit/168d0cd
shell.zip 0.9.7 2011-06-18 7.0 Peter Odding • Define version as variable, include version in messages:
   http://github.com/xolox/vim-shell/commit/a0ed509
shell.zip 0.9.6 2011-06-17 7.0 Peter Odding • Bug fix: Rename xolox#open -> xolox#misc#open (reported by Tim Dahlin):
   http://github.com/xolox/vim-shell/commit/73f9744
shell.zip 0.9.5 2011-06-17 7.0 Peter Odding • Don't check existence of temporary files, just try to read them:
   http://github.com/xolox/vim-shell/commit/d0e682a
shell.zip 0.9.2 2011-02-04 7.0 Peter Odding Use Vim's "shell" and "shellcmdflag" options:
https://github.com/xolox/vim-shell/commit/993f941c76e70f7f717c

Also the character encoding of the included help file was changed to ASCII to accommodate users that don't have Unicode support (enabled).
shell.zip 0.9.1 2010-12-18 7.0 Peter Odding Restore window position/size on leaving full-screen (this fixes issue #2 reported by dionysiac- on GitHub):
https://github.com/xolox/vim-shell/commit/681404594304bfa6a052
shell.zip 0.9 2010-12-04 7.0 Peter Odding Support for Windows x64, improved error handling (thanks to Stan Angeloff for getting me to build an x64 DLL and helping me test the DLL and automatic bitness detection):
https://github.com/xolox/vim-shell/commit/669a9f2d5cce67b34599
shell.zip 0.8.2 2010-09-19 7.0 Peter Odding • Bug fix: %s/xolox#open#shell/xolox#open#file/:
   http://github.com/xolox/vim-shell/commit/452e951e2fcc4c7afa5a

• Truncate expand() result to one pathname:
   http://github.com/xolox/vim-shell/commit/dc3448ec7f3a66b17199

• Bug fix: Open either file or directory, but never both!
   http://github.com/xolox/vim-shell/commit/de1303de9b9317affe10
shell.zip 0.8 2010-09-18 7.0 Peter Odding http://github.com/xolox/vim-shell/commit/4d2313b6508c26a1a843:
• Moved openurl() & open_with() to dedicated plug-in (included in ZIP archive)
• Simplified Mac OS X support
• Support command line web browsers in s:open_at_cursor()
shell.zip 0.7.3 2010-08-30 7.0 Peter Odding Bug fix: Only toggle active window using `wmctrl' and report errors from libcall('fullscreen'):
http://github.com/xolox/vim-shell/commit/ca43642589089a29dc24f18e00a7edd04820bc9e
shell.zip 0.7.2 2010-08-15 7.0 Peter Odding Bug fix for E33: No previous substitute regular expression:
http://github.com/xolox/vim-shell/commit/8ab66c465f5f7e29cc7677b2d54012f0fe762576

The packages for version 0.7 and 0.7.1 below should have included the "shell.dll" dynamic link library but I failed to include it. This has been fixed now. Sorry about that!
shell.zip 0.7.1 2010-08-10 7.0 Peter Odding Enable passing stdin to xolox#shell#execute():
http://github.com/xolox/vim-shell/commit/fc16d5c0e72d8ba4112d239f211cc0576640aaa3
shell.zip 0.7 2010-08-09 7.0 Peter Odding • Full-screen mode now hides Vim's menu/toolbar/tabline by default. This makes it useful even when the actual full-screen state of Vim's GUI window can't be changed because the DLL/wmctrl is unavailable.

• Full-screen mode should now work in most graphical terminal emulators like xterm and gnome-terminal (though <F11> won't work in the latter).

• Included user friendly :Open and :Fullscreen commands plus default key mappings so the plug-in is more useful out of the box.

• The xolox#shell#execute() function now returns the output of the shell command if it was executed in synchronous mode (this enables integration with my easytags.vim plug-in).

• I've merged my unreleased `hyperlink.vim' plug-in into `shell.vim' which improves the openurl() functionality and includes automatic highlighting for URLs and e-mail addresses in comments and strings.

All from http://github.com/xolox/vim-shell/commit/2f6414109fa52b20c1a86faff215fe1329ba6eb8
shell.zip 0.6.1 2010-06-14 7.0 Peter Odding Bug fix: Updated instructions to match new execute() implementation. Sorry about that!
http://github.com/xolox/vim-shell/commit/2cc68db470c974acbc4c43ea001536c1106ae0e2
shell.zip 0.6 2010-06-14 7.0 Peter Odding * Improved test instructions for execute()
  http://github.com/xolox/vim-shell/commit/50453066d1d211cfa6e426b78f3e503e3f46c82e

* Better DLL detection, synchronous command execution
  http://github.com/xolox/vim-shell/commit/82f6cb0f013480f994438d44b6cf98ae136569c0

* Improved README, added screenshots, fixed typo
  http://github.com/xolox/vim-shell/commit/364ceee3040e77f0a3fb8b4b657aac612f6dbcc4
shell.zip 0.5.2 2010-06-14 7.0 Peter Odding Bug fix for execute() implementation in DLL
http://github.com/xolox/vim-shell/commit/c46f8e522f53283528f1dc9ab58cc6eb0a9c5507
shell.zip 0.5.1 2010-06-13 7.0 Peter Odding Fixed typo in NMAKE makefile and references to Vim scripts page.
shell.zip 0.5 2010-06-13 7.0 Peter Odding Initial upload
ip used for rating: 142.132.191.50

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