Fix Renaming issue in Windows and ext with two dot (#1051)
* fix subdir not correct when path using `\` * fix slice by variable value not supported in vim 7.3
This commit is contained in:
committed by
GitHub
parent
96713548cc
commit
e922f7302f
@@ -62,12 +62,19 @@ function! vimwiki#base#subdir(path, filename) abort
|
||||
let filename = a:filename
|
||||
endif
|
||||
let idx = 0
|
||||
let pathelement = split(path, '[/\\]')
|
||||
let fileelement = split(filename, '[/\\]')
|
||||
let minlen = min([len(pathelement), len(fileelement)])
|
||||
let p = fileelement[:]
|
||||
"FIXME this can terminate in the middle of a path component!
|
||||
while path[idx] ==? filename[idx]
|
||||
while pathelement[idx] ==? fileelement[idx]
|
||||
let p = p[1:]
|
||||
let idx = idx + 1
|
||||
if idx == minlen
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
let p = split(strpart(filename, idx), '[/\\]')
|
||||
let res = join(p[:-2], '/')
|
||||
if len(res) > 0
|
||||
let res = res.'/'
|
||||
|
||||
Reference in New Issue
Block a user