parent
140d32fcdd
commit
b37db4e109
@ -14,7 +14,12 @@ let g:loaded_vimwiki_auto = 1
|
|||||||
function! s:normalize_path(path) "{{{
|
function! s:normalize_path(path) "{{{
|
||||||
let g:VimwikiLog.normalize_path += 1 "XXX
|
let g:VimwikiLog.normalize_path += 1 "XXX
|
||||||
" resolve doesn't work quite right with symlinks ended with / or \
|
" resolve doesn't work quite right with symlinks ended with / or \
|
||||||
return resolve(expand(substitute(a:path, '[/\\]\+$', '', ''))).'/'
|
let path = substitute(a:path, '[/\\]\+$', '', '')
|
||||||
|
if path !~# '^scp:'
|
||||||
|
return resolve(expand(path)).'/'
|
||||||
|
else
|
||||||
|
return path.'/'
|
||||||
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" s:path_html
|
" s:path_html
|
||||||
@ -239,17 +244,21 @@ endfunction "}}}
|
|||||||
" vimwiki#base#mkdir will ask before creating a directory
|
" vimwiki#base#mkdir will ask before creating a directory
|
||||||
function! vimwiki#base#mkdir(path, ...) "{{{
|
function! vimwiki#base#mkdir(path, ...) "{{{
|
||||||
let path = expand(a:path)
|
let path = expand(a:path)
|
||||||
if !isdirectory(path) && exists("*mkdir")
|
if path !~# '^scp:'
|
||||||
let path = vimwiki#u#chomp_slash(path)
|
if !isdirectory(path) && exists("*mkdir")
|
||||||
if vimwiki#u#is_windows() && !empty(g:vimwiki_w32_dir_enc)
|
let path = vimwiki#u#chomp_slash(path)
|
||||||
let path = iconv(path, &enc, g:vimwiki_w32_dir_enc)
|
if vimwiki#u#is_windows() && !empty(g:vimwiki_w32_dir_enc)
|
||||||
|
let path = iconv(path, &enc, g:vimwiki_w32_dir_enc)
|
||||||
|
endif
|
||||||
|
if a:0 && a:1 && tolower(input("Vimwiki: Make new directory: ".path."\n [Y]es/[n]o? ")) !~ "y"
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
call mkdir(path, "p")
|
||||||
endif
|
endif
|
||||||
if a:0 && a:1 && tolower(input("Vimwiki: Make new directory: ".path."\n [Y]es/[n]o? ")) !~ "y"
|
return 1
|
||||||
return 0
|
else
|
||||||
endif
|
return 1
|
||||||
call mkdir(path, "p")
|
|
||||||
endif
|
endif
|
||||||
return 1
|
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" vimwiki#base#file_pattern
|
" vimwiki#base#file_pattern
|
||||||
@ -286,7 +295,11 @@ function! vimwiki#base#subdir(path, filename)"{{{
|
|||||||
let path = a:path
|
let path = a:path
|
||||||
" ensure that we are not fooled by a symbolic link
|
" ensure that we are not fooled by a symbolic link
|
||||||
"FIXME if we are not "fooled", we end up in a completely different wiki?
|
"FIXME if we are not "fooled", we end up in a completely different wiki?
|
||||||
let filename = resolve(a:filename)
|
if a:filename !~# '^scp:'
|
||||||
|
let filename = resolve(a:filename)
|
||||||
|
else
|
||||||
|
let filename = a:filename
|
||||||
|
endif
|
||||||
let idx = 0
|
let idx = 0
|
||||||
"FIXME this can terminate in the middle of a path component!
|
"FIXME this can terminate in the middle of a path component!
|
||||||
while path[idx] ==? filename[idx]
|
while path[idx] ==? filename[idx]
|
||||||
|
@ -36,11 +36,15 @@ endfunction "}}}
|
|||||||
|
|
||||||
function! vimwiki#u#path_norm(path) "{{{
|
function! vimwiki#u#path_norm(path) "{{{
|
||||||
" /-slashes
|
" /-slashes
|
||||||
let path = substitute(a:path, '\', '/', 'g')
|
if path !~# '^scp:'
|
||||||
" treat multiple consecutive slashes as one path separator
|
let path = substitute(a:path, '\', '/', 'g')
|
||||||
let path = substitute(path, '/\+', '/', 'g')
|
" treat multiple consecutive slashes as one path separator
|
||||||
" ensure that we are not fooled by a symbolic link
|
let path = substitute(path, '/\+', '/', 'g')
|
||||||
return resolve(path)
|
" ensure that we are not fooled by a symbolic link
|
||||||
|
return resolve(path)
|
||||||
|
else
|
||||||
|
return a:path
|
||||||
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#u#is_link_to_dir(link) "{{{
|
function! vimwiki#u#is_link_to_dir(link) "{{{
|
||||||
|
Loading…
Reference in New Issue
Block a user