Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clear inclusion guard based on basename of script file

  • Loading branch information...
commit 8fb0c8585c95056873bc2f4b4178cf874d97da20 1 parent 5fc2712
Peter Odding authored
7  README.md
Source Rendered
@@ -18,7 +18,7 @@ Note that [vimrc scripts][vimrc] are not reloaded because that seems to cause mo
18 18
 
19 19
 ## Install & first use
20 20
 
21  
-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).
  21
+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).
22 22
 
23 23
 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:
24 24
 
@@ -76,9 +76,7 @@ The [ReloadScript](http://www.vim.org/scripts/script.php?script_id=1904) plug-in
76 76
 
77 77
  * This plug-in focuses on automatic reloading (I'm lazy) while the other one requires manual reloading;
78 78
 
79  
- * This plug-in doesn't clear inclusion guard variables while the other one does;
80  
-
81  
- * 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;
  79
+ * 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;
82 80
 
83 81
  * This plug-in can more or less reload itself ;-)
84 82
 
@@ -94,6 +92,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
94 92
 
95 93
 [autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd
96 94
 [reload]: http://github.com/xolox/vim-reload/blob/master/reload.vim
  95
+[scriptnames]: http://vimdoc.sourceforge.net/htmldoc/repeat.html#:scriptnames
97 96
 [update]: http://vimdoc.sourceforge.net/htmldoc/editing.html#:update
98 97
 [vim]: http://www.vim.org/
99 98
 [vimrc]: http://vimdoc.sourceforge.net/htmldoc/starting.html#vimrc
7  autoload.vim
... ...
@@ -1,5 +1,5 @@
1 1
 " Vim script
2  
-" Last Change: July 13, 2010
  2
+" Last Change: July 15, 2010
3 3
 " Author: Peter Odding
4 4
 " URL: http://peterodding.com/code/vim/reload/
5 5
 
@@ -52,6 +52,11 @@ endif
52 52
 
53 53
 function! s:reload_plugin(start_time, filename, friendly_name) " {{{1
54 54
   call s:reload_message('plug-in', a:friendly_name)
  55
+  " Clear include guard so full plug-in can be reloaded?
  56
+  let variable = 'g:loaded_' . fnamemodify(a:filename, ':t:r')
  57
+  if exists(variable)
  58
+    execute 'unlet' variable
  59
+  endif
55 60
   execute 'source' fnameescape(a:filename)
56 61
   let msg = "%s: Reloaded %s plug-in in %s."
57 62
   call xolox#timer#stop(msg, s:script, a:friendly_name, a:start_time)
4  reload.vim
... ...
@@ -1,9 +1,9 @@
1 1
 " Vim script
2  
-" Last Change: July 13, 2010
  2
+" Last Change: July 15, 2010
3 3
 " Author: Peter Odding
4 4
 " URL: http://peterodding.com/code/vim/reload/
5 5
 " License: MIT
6  
-" Version: 0.3
  6
+" Version: 0.4
7 7
 
8 8
 " Support for automatic update using the GLVS plug-in.
9 9
 " GetLatestVimScripts: 3148 1 :AutoInstall: reload.zip

0 notes on commit 8fb0c85

Please sign in to comment.
Something went wrong with that request. Please try again.