解决gvim 8.1中zip插件打开zip文件内容时,而文件路径带有空格的问题。
现象是只能打开一次,第二次打开就显示为空了。
通过 lcd切换工作目录。使得命令行操作中不再有带空格的路径
vim81/autoload/zip.vim | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/vim81/autoload/zip.vim b/vim81/autoload/zip.vim
index ea086e0..ebafa61 100644
--- a/vim81/autoload/zip.vim
+++ b/vim81/autoload/zip.vim
@@ -204,8 +204,12 @@ fun! zip#Read(fname,mode)
let fname = substitute(a:fname,'zipfile:.\{-}::\([^\\].*\)$','\1','')
else
let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','')
+ let zipfiledir = substitute(zipfile,"\/[^\/]*$", '', '')
+ let zipfilename = matchstr(zipfile,"[^\/]*$")
let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','')
let fname = substitute(fname, '[', '[[]', 'g')
+ execute "lcd ".zipfiledir
+ let zipfile=zipfilename
endif
" call Decho("zipfile<".zipfile.">")
" call Decho("fname <".fname.">")
所有评论(0)