Basic support for remote drectories via netrw

References #24
This commit is contained in:
EinfachToll 2013-11-06 13:34:45 +01:00
parent 140d32fcdd
commit b37db4e109
2 changed files with 33 additions and 16 deletions

View File

@ -14,7 +14,12 @@ let g:loaded_vimwiki_auto = 1
function! s:normalize_path(path) "{{{
let g:VimwikiLog.normalize_path += 1 "XXX
" 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 "}}}
" s:path_html
@ -239,6 +244,7 @@ endfunction "}}}
" vimwiki#base#mkdir will ask before creating a directory
function! vimwiki#base#mkdir(path, ...) "{{{
let path = expand(a:path)
if path !~# '^scp:'
if !isdirectory(path) && exists("*mkdir")
let path = vimwiki#u#chomp_slash(path)
if vimwiki#u#is_windows() && !empty(g:vimwiki_w32_dir_enc)
@ -250,6 +256,9 @@ function! vimwiki#base#mkdir(path, ...) "{{{
call mkdir(path, "p")
endif
return 1
else
return 1
endif
endfunction " }}}
" vimwiki#base#file_pattern
@ -286,7 +295,11 @@ function! vimwiki#base#subdir(path, filename)"{{{
let path = a:path
" ensure that we are not fooled by a symbolic link
"FIXME if we are not "fooled", we end up in a completely different wiki?
if a:filename !~# '^scp:'
let filename = resolve(a:filename)
else
let filename = a:filename
endif
let idx = 0
"FIXME this can terminate in the middle of a path component!
while path[idx] ==? filename[idx]

View File

@ -36,11 +36,15 @@ endfunction "}}}
function! vimwiki#u#path_norm(path) "{{{
" /-slashes
if path !~# '^scp:'
let path = substitute(a:path, '\', '/', 'g')
" treat multiple consecutive slashes as one path separator
let path = substitute(path, '/\+', '/', 'g')
" ensure that we are not fooled by a symbolic link
return resolve(path)
else
return a:path
endif
endfunction "}}}
function! vimwiki#u#is_link_to_dir(link) "{{{