From 151bb7ea4739cce67d17dedd40fe4a9f5d814c37 Mon Sep 17 00:00:00 2001 From: tiglog Date: Tue, 4 Jul 2017 10:19:45 +0800 Subject: [PATCH 1/2] fixed: sync file of project root directory --- plugin/sync.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin/sync.vim b/plugin/sync.vim index e7e9d97..19bee44 100644 --- a/plugin/sync.vim +++ b/plugin/sync.vim @@ -32,7 +32,14 @@ endfunction function! SyncUploadFile() let exe = SyncGetExe() if !empty(exe) - let fold = substitute(expand('%:p:h'), exe[0:strridx(exe, '/')], "", "") + let l:fdir = expand('%:p:h') + let l:pdir = exe[0:strridx(exe, '/')] + if l:fdir . '/' == l:pdir + let fold = './' + else + let fold = substitute(l:fdir, l:pdir, '', '') + endif + "let fold = substitute(expand('%:p:h'), exe[0:strridx(exe, '/')], "", "") let filelist = split(expand('%:p'), '/') let file = filelist[-1] let cmd = printf("%s %s %s %s", exe, 'upload', fold, shellescape(file)) From 2dadbefa8a6c07f0c14fabdc2684e6744c435f64 Mon Sep 17 00:00:00 2001 From: tiglog Date: Tue, 4 Jul 2017 10:19:45 +0800 Subject: [PATCH 2/2] fixed: sync file of project root directory --- plugin/sync.vim | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin/sync.vim b/plugin/sync.vim index 19bee44..ccb038e 100644 --- a/plugin/sync.vim +++ b/plugin/sync.vim @@ -36,7 +36,7 @@ function! SyncUploadFile() let l:pdir = exe[0:strridx(exe, '/')] if l:fdir . '/' == l:pdir let fold = './' - else + else let fold = substitute(l:fdir, l:pdir, '', '') endif "let fold = substitute(expand('%:p:h'), exe[0:strridx(exe, '/')], "", "") @@ -50,7 +50,14 @@ endfunction function! SyncDownloadFile() let exe = SyncGetExe() if !empty(exe) - let fold = substitute(expand('%:p:h'), exe[0:strridx(exe, '/')], "", "") + "let fold = substitute(expand('%:p:h'), exe[0:strridx(exe, '/')], "", "") + let l:fdir = expand('%:p:h') + let l:pdir = exe[0:strridx(exe, '/')] + if l:fdir . '/' == l:pdir + let fold = './' + else + let fold = substitute(l:fdir, l:pdir, '', '') + endif let filelist = split(expand('%:p'), '/') let file = filelist[-1] let cmd = printf("%s %s %s %s", exe, 'download', fold, shellescape(file))