Skip to content

Commit 138e64d

Browse files
committed
Bug fix for case insensitive filenames (reported by Jeff Bevis)
1 parent bb254c0 commit 138e64d

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Automatic commands using Vim's [:autocmd][autocmd] built-in should be defined in
7272

7373
## Alternatives
7474

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:
7676

7777
* This plug-in focuses on automatic reloading (I'm lazy) while the other one requires manual reloading;
7878

@@ -82,7 +82,7 @@ The [ReloadScript](http://www.vim.org/scripts/script.php?script_id=1904) plug-in
8282

8383
## Contact
8484

85-
If you have questions, bug reports, suggestions, etc. the author can be contacted at <[email protected]>. 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 <[email protected]>. 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).
8686

8787
## License
8888

autoload.vim

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
" Vim script
2-
" Last Change: July 23, 2010
2+
" Last Change: October 14, 2010
33
" Author: Peter Odding
44
" URL: http://peterodding.com/code/vim/reload/
55

@@ -151,12 +151,12 @@ let s:loaded_scripts = {}
151151

152152
function! s:script_sourced(filename) " {{{2
153153
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))
155155
endfunction
156156

157157
function! s:unresolve_scriptname(filename) " {{{2
158158
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)
160160
endfunction
161161

162162
function! s:parse_scriptnames() " {{{2
@@ -169,11 +169,17 @@ function! s:parse_scriptnames() " {{{2
169169
if len(lines) > num_loaded
170170
for line in lines[num_loaded : -1]
171171
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
173173
endfor
174174
endif
175175
endfunction
176176

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+
177183
function! s:reload_message(scripttype, scriptname) " {{{2
178184
call xolox#message('%s: Reloading %s %s', s:script, a:scripttype, a:scriptname)
179185
endfunction

reload.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
2-
" Last Change: July 23, 2010
2+
" Last Change: October 14, 2010
33
" Author: Peter Odding
44
" URL: http://peterodding.com/code/vim/reload/
55
" License: MIT
6-
" Version: 0.5.1
6+
" Version: 0.5.2
77

88
" Support for automatic update using the GLVS plug-in.
99
" GetLatestVimScripts: 3148 1 :AutoInstall: reload.zip

0 commit comments

Comments
 (0)