Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clear inclusion guard based on basename of script file

  • Loading branch information...
commit 8fb0c8585c95056873bc2f4b4178cf874d97da20 1 parent 5fc2712
@xolox authored
Showing with 11 additions and 7 deletions.
  1. +3 −4 README.md
  2. +6 −1 autoload.vim
  3. +2 −2 reload.vim
View
7 README.md
@@ -18,7 +18,7 @@ Note that [vimrc scripts][vimrc] are not reloaded because that seems to cause mo
## Install & first use
-Unzip the most recent [ZIP archive](http://peterodding.com/code/vim/downloads/reload) file inside your Vim profile directory (usually this is `~/.vim` on UNIX and `%USERPROFILE%\vimfiles` on Windows), restart Vim and try it out: Edit any Vim script that's already loaded and check that the script is reloaded when you save it (the reload.vim plug-in will print a message to confirm when a script is reloaded).
+Unzip the most recent [ZIP archive](http://peterodding.com/code/vim/downloads/reload) file 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: Edit any Vim script that's already loaded (you can check using the [:scriptnames command][scriptnames]) and confirm that the script is reloaded when you save it (the reload.vim plug-in will print a message to confirm when a script is reloaded).
Out of the box the [reload.vim][reload] plug-in is configured to automatically reload all Vim scripts that it knows how to. If you like it this way then you don't need to configure anything! However if you don't like the automatic reloading then you'll need the following:
@@ -76,9 +76,7 @@ The [ReloadScript](http://www.vim.org/scripts/script.php?script_id=1904) plug-in
* This plug-in focuses on automatic reloading (I'm lazy) while the other one requires manual reloading;
- * This plug-in doesn't clear inclusion guard variables while the other one does;
-
- * This plug-in will *never* [:source](http://vimdoc.sourceforge.net/htmldoc/repeat.html#:source) a file that hasn't already been loaded by Vim -- it checks using Vim's [:scriptnames](http://vimdoc.sourceforge.net/htmldoc/repeat.html#:scriptnames) command;
+ * This plug-in will *never* [:source](http://vimdoc.sourceforge.net/htmldoc/repeat.html#:source) a file that hasn't already been loaded by Vim -- it checks using Vim's [:scriptnames][scriptnames] command;
* This plug-in can more or less reload itself ;-)
@@ -94,6 +92,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd
[reload]: http://github.com/xolox/vim-reload/blob/master/reload.vim
+[scriptnames]: http://vimdoc.sourceforge.net/htmldoc/repeat.html#:scriptnames
[update]: http://vimdoc.sourceforge.net/htmldoc/editing.html#:update
[vim]: http://www.vim.org/
[vimrc]: http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc
View
7 autoload.vim
@@ -1,5 +1,5 @@
" Vim script
-" Last Change: July 13, 2010
+" Last Change: July 15, 2010
" Author: Peter Odding
" URL: http://peterodding.com/code/vim/reload/
@@ -52,6 +52,11 @@ endif
function! s:reload_plugin(start_time, filename, friendly_name) " {{{1
call s:reload_message('plug-in', a:friendly_name)
+ " Clear include guard so full plug-in can be reloaded?
+ let variable = 'g:loaded_' . fnamemodify(a:filename, ':t:r')
+ if exists(variable)
+ execute 'unlet' variable
+ endif
execute 'source' fnameescape(a:filename)
let msg = "%s: Reloaded %s plug-in in %s."
call xolox#timer#stop(msg, s:script, a:friendly_name, a:start_time)
View
4 reload.vim
@@ -1,9 +1,9 @@
" Vim script
-" Last Change: July 13, 2010
+" Last Change: July 15, 2010
" Author: Peter Odding
" URL: http://peterodding.com/code/vim/reload/
" License: MIT
-" Version: 0.3
+" Version: 0.4
" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3148 1 :AutoInstall: reload.zip
Please sign in to comment.
Something went wrong with that request. Please try again.