Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug fix for case insensitive filenames (reported by Jeff Bevis)

  • Loading branch information...
commit 138e64dcc3770f3fb0088770fe4641701edbd2e1 1 parent bb254c0
Peter Odding authored October 18, 2010
4  README.md
Source Rendered
@@ -72,7 +72,7 @@ Automatic commands using Vim's [:autocmd][autocmd] built-in should be defined in
72 72
 
73 73
 ## Alternatives
74 74
 
75  
-The [ReloadScript](http://www.vim.org/scripts/script.php?script_id=1904) plug-in on [www.vim.org][vim] also supports reloading of Vim scripts, but there are a few notable differences:
  75
+The [ReloadScript](http://www.vim.org/scripts/script.php?script_id=1904) plug-in on [Vim Online][vim] also supports reloading of Vim scripts, but there are a few notable differences:
76 76
 
77 77
  * This plug-in focuses on automatic reloading (I'm lazy) while the other one requires manual reloading;
78 78
 
@@ -82,7 +82,7 @@ The [ReloadScript](http://www.vim.org/scripts/script.php?script_id=1904) plug-in
82 82
 
83 83
 ## Contact
84 84
 
85  
-If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/reload/> and <http://github.com/xolox/vim-reload>. If you like the plug-in please vote for it on [www.vim.org](http://www.vim.org/scripts/script.php?script_id=3148).
  85
+If you have questions, bug reports, suggestions, etc. the author can be contacted at <peter@peterodding.com>. The latest version is available at <http://peterodding.com/code/vim/reload/> and <http://github.com/xolox/vim-reload>. If you like the plug-in please vote for it on [Vim Online](http://www.vim.org/scripts/script.php?script_id=3148).
86 86
 
87 87
 ## License
88 88
 
14  autoload.vim
... ...
@@ -1,5 +1,5 @@
1 1
 " Vim script
2  
-" Last Change: July 23, 2010
  2
+" Last Change: October 14, 2010
3 3
 " Author: Peter Odding
4 4
 " URL: http://peterodding.com/code/vim/reload/
5 5
 
@@ -151,12 +151,12 @@ let s:loaded_scripts = {}
151 151
 
152 152
 function! s:script_sourced(filename) " {{{2
153 153
   call s:parse_scriptnames()
154  
-  return has_key(s:loaded_scripts, resolve(a:filename))
  154
+  return has_key(s:loaded_scripts, s:normalize_path(a:filename))
155 155
 endfunction
156 156
 
157 157
 function! s:unresolve_scriptname(filename) " {{{2
158 158
   call s:parse_scriptnames()
159  
-  return get(s:loaded_scripts, resolve(a:filename), a:filename)
  159
+  return get(s:loaded_scripts, s:normalize_path(a:filename), a:filename)
160 160
 endfunction
161 161
 
162 162
 function! s:parse_scriptnames() " {{{2
@@ -169,11 +169,17 @@ function! s:parse_scriptnames() " {{{2
169 169
   if len(lines) > num_loaded
170 170
     for line in lines[num_loaded : -1]
171 171
       let filename = matchstr(line, '^\s*\d\+:\s\+\zs.\+$')
172  
-      let s:loaded_scripts[resolve(filename)] = filename
  172
+      let s:loaded_scripts[s:normalize_path(filename)] = filename
173 173
     endfor
174 174
   endif
175 175
 endfunction
176 176
 
  177
+function! s:normalize_path(path) " {{{2
  178
+  let path = resolve(fnamemodify(a:path, ':p'))
  179
+  " fnamemodify() doesn't seem to restore the original case on Windows…
  180
+  return xolox#is_windows() ? tolower(path) : path
  181
+endfunction
  182
+
177 183
 function! s:reload_message(scripttype, scriptname) " {{{2
178 184
   call xolox#message('%s: Reloading %s %s', s:script, a:scripttype, a:scriptname)
179 185
 endfunction
4  reload.vim
... ...
@@ -1,9 +1,9 @@
1 1
 " Vim script
2  
-" Last Change: July 23, 2010
  2
+" Last Change: October 14, 2010
3 3
 " Author: Peter Odding
4 4
 " URL: http://peterodding.com/code/vim/reload/
5 5
 " License: MIT
6  
-" Version: 0.5.1
  6
+" Version: 0.5.2
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 138e64d

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