sponsor Vim development Vim logo Vim Book Ad

ReloadScript : Reload a Vim script during script development.

 script karma  Rating 17/7, Downloaded by 2849  Comments, bugs, improvements  Vim wiki

created by
Ingo Karkat
script type
Re-sources a Vim script. The script may use a multiple inclusion guard
variable g:loaded_{scriptname} (with {scriptname} having either the same case
as specified or all lowercase.)
If you specify the bare scriptname (without .vim extension), the script must
reside in plugin/{scriptname}.vim somewhere on 'runtimepath'. Otherwise, the
passed filespec is interpreted as the file system location of a Vim script and
sourced as-is. If you execute :ReloadScript without passing a scriptname,
the current buffer is re-sourced.

- scriptease.vim (vimscript #4394) has a :Runtime command that unlets any
  include guards first

ReloadScript                            Re-sources the current buffer.
ReloadScript {scriptname}               Re-sources the passed plugin script.
ReloadScript {path/to/script.vim}       Re-sources the passed file.
install details
This script is packaged as a vimball. If you have the "gunzip" decompressor
in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
vimball or via the :UseVimball command.
    vim ReloadScript*.vmb.gz
    :so %
To uninstall, use the :RmVimball command.

- Requires Vim 7.0 or higher.

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
ReloadScript-1.21.vmb.gz 1.21 2012-08-28 7.0 Ingo Karkat - Avoid <f-args> because of its unescaping behavior.
- Also no global inclusion guard for ftdetect scripts.
ReloadScript.vba.gz 1.20 2011-01-09 7.0 Ingo Karkat - BUG: Avoiding "E471: Argument required" error on empty buffer name.
- ENH: Explicitly checking for the existence of the file, as we don't want to put the :source command inside try...catch (it would stop showing all resulting errors and show only the first), and because :runtime doesn't complain at all.
- Added separate help file and packaging the plugin as a vimball.
ReloadScript.vim 1.10.005 2008-07-29 7.0 Ingo Karkat Combined missing inclusion guard warning with reload message to avoid the "Hit ENTER" prompt.
No missing inclusion guard warning for scripts that do not need one (e.g. after-directory, autoload, ftplugin, indent, syntax, ...)
ReloadScript.vim 1.10.004 2008-02-28 7.0 Ingo Karkat A scriptname argument with path and/or extension is sourced as-is. This allows a third usage: :ReloadScript path/to/script.vim
ReloadScript.vim 1.00.003 2007-05-22 7.0 Ingo Karkat 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.