[SCM] Vim packaging branch, maint/lenny, updated. debian/7.1.314-3-51-g209709e
James Vega
jamessan at debian.org
Sun Oct 12 06:29:09 UTC 2008
The following commit has been merged in the maint/lenny branch:
commit d4c75cb3070dbf280750c4fa944ee8d3e9b2c503
Author: James Vega <jamessan at debian.org>
Date: Thu Oct 9 21:44:26 2008 -0400
Update filename escaping in netrw
Signed-off-by: James Vega <jamessan at debian.org>
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 6064a65..8861177 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -362,6 +362,7 @@ endif
if !exists("g:netrw_tmpfile_escape")
let g:netrw_tmpfile_escape= ' &;'
endif
+let s:netrw_map_escape = "<|\n\r\\\<C-V>\""
" BufEnter event ignored by decho when following variable is true
" Has a side effect that doau BufReadPost doesn't work, so
@@ -705,7 +706,7 @@ fun! netrw#NetRead(mode,...)
endif
endif
" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile)
- exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile)
+ exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1))
let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
@@ -716,20 +717,20 @@ fun! netrw#NetRead(mode,...)
let netrw_fname= b:netrw_fname
call s:SaveBufVars()|new|call s:RestoreBufVars()
setlocal ff=unix
- exe "put ='".g:netrw_ftpmode."'"
+ put =g:netrw_ftpmode
" call Decho("filter input: ".getline('.'))
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('.'))
endif
- exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'"
+ call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile)
" call Decho("filter input: ".getline('.'))
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine." ".g:netrw_port,1)
else
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
endif
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
@@ -773,7 +774,7 @@ fun! netrw#NetRead(mode,...)
" call Decho("filter input: ".getline('.'))
endif
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('.'))
endif
put ='get \"'.netrw_fname.'\" '.tmpfile
@@ -807,7 +808,7 @@ fun! netrw#NetRead(mode,...)
let useport= ""
endif
" call Decho("exe s:netrw_silentxfer.!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape))." ".tmpfile)
- exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape))." ".tmpfile
+ exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
@@ -823,23 +824,22 @@ fun! netrw#NetRead(mode,...)
return
endif
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
if match(b:netrw_fname,"#") == -1
" simple wget
" call Decho('using simple wget (# not in b:netrw_fname<'.b:netrw_fname.">)")
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile)." ".shellescape("http://".g:netrw_machine.netrw_fname))
- exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile)." ".shellescape("http://".g:netrw_machine.netrw_fname)
+ exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.b:netrw_fname,1)
let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
else
" wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker)
" call Decho(("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)")
- let netrw_html= substitute(netrw_fname,"#.*$","","")
- let netrw_tag = substitute(netrw_fname,"^.*#","","")
+ let netrw_html= substitute(b:netrw_fname,"#.*$","","")
+ let netrw_tag = substitute(b:netrw_fname,"^.*#","","")
" call Decho("netrw_html<".netrw_html.">")
" call Decho("netrw_tag <".netrw_tag.">")
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile)." ".shellescape("http://".g:netrw_machine.netrw_html))
- exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile)." ".shellescape("http://".g:netrw_machine.netrw_html)
+ exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape("http://".g:netrw_machine.netrw_html,1)
let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/')
exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
@@ -877,9 +877,8 @@ fun! netrw#NetRead(mode,...)
" rsync: NetRead Method #7 {{{3
elseif b:netrw_method == 7
" call Decho("read via rsync (method #7)")
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".netrw_fname)." ".tmpfile)
- exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".netrw_fname)." ".tmpfile
+ exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)
let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
@@ -888,7 +887,6 @@ fun! netrw#NetRead(mode,...)
" fetch://[user@]host[:http]/path
elseif b:netrw_method == 8
" call Decho("read via fetch (method #8)")
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
if g:netrw_fetch_cmd == ""
if !exists("g:netrw_quiet")
call netrw#ErrorMsg(s:ERROR,"fetch command not available",7)
@@ -904,10 +902,10 @@ fun! netrw#NetRead(mode,...)
if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != ""
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname))
- exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname)
+ exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)
else
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".shellescape(netrw_option."://".g:netrw_machine."/".netrw_fname))
- exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".shellescape(netrw_option."://".g:netrw_machine."/".netrw_fname)
+ exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)
endif
let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
@@ -918,9 +916,8 @@ fun! netrw#NetRead(mode,...)
" sftp: NetRead Method #9 {{{3
elseif b:netrw_method == 9
" call Decho("read via sftp (method #9)")
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".netrw_fname)." ".tmpfile)
- exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".netrw_fname)." ".tmpfile
+ exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile
let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
@@ -976,16 +973,16 @@ fun! netrw#NetWrite(...) range
" (line numbers don't really make sense for that).
" Also supports the writing of tar and zip files.
" call Decho("(write entire file) silent exe w! ".v:cmdarg." ".tmpfile)
- silent exe "w! ".v:cmdarg." ".tmpfile
+ silent exe "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
elseif g:netrw_cygwin
" write (selected portion of) file to temporary
let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','')
" call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".v:cmdarg." ".cygtmpfile)
- silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".cygtmpfile
+ silent exe a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)
else
" write (selected portion of) file to temporary
" call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile)
- silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile
+ silent exe a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
endif
if curbufname == ""
@@ -1079,9 +1076,8 @@ fun! netrw#NetWrite(...) range
let uid_machine = g:netrw_machine
endif
endif
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile)." ".shellescape(uid_machine.":".netrw_fname))
- exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile)." ".shellescape(uid_machine.":".netrw_fname)
+ exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)
let b:netrw_lastfile = choice
".........................................
@@ -1092,21 +1088,21 @@ fun! netrw#NetWrite(...) range
new
" call Decho("filter input window#".winnr())
setlocal ff=unix
- exe "put ='".g:netrw_ftpmode."'"
+ put =g:netrw_ftpmode
" call Decho("filter input: ".getline('.'))
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('.'))
endif
- exe "put ='".'put \"'.tmpfile.'\" \"'.netrw_fname.'\"'."'"
+ call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"')
" call Decho("filter input: ".getline('.'))
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
else
" call Decho("filter input window#".winnr())
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
endif
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$"
@@ -1167,14 +1163,13 @@ fun! netrw#NetWrite(...) range
" scp: NetWrite Method #4 {{{4
elseif b:netrw_method == 4
" call Decho("write via scp (method #4)")
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
if exists("g:netrw_port") && g:netrw_port != ""
- let useport= " ".g:netrw_scpport." ".g:netrw_port
+ let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port)
else
let useport= ""
endif
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile)." ".shellescape(g:netrw_machine.":".netrw_fname))
- exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile)." ".shellescape(g:netrw_machine.":".netrw_fname)
+ exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)
let b:netrw_lastfile = choice
".........................................
@@ -1215,9 +1210,8 @@ fun! netrw#NetWrite(...) range
" rsync: NetWrite Method #7 {{{4
elseif b:netrw_method == 7
" call Decho("write via rsync (method #7)")
- let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
" call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname)
- exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname
+ exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)
let b:netrw_lastfile = choice
".........................................
@@ -1236,7 +1230,7 @@ fun! netrw#NetWrite(...) range
" call Decho("filter input: ".getline('.'))
norm! 1Gdd
" call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine)
- exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine
+ exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)
bd!
let b:netrw_lastfile= choice
@@ -1289,7 +1283,7 @@ fun! netrw#NetSource(...)
" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">")
if s:FileReadable(s:netrw_tmpfile)
" call Decho("exe so ".s:netrw_tmpfile)
- exe "so ".s:netrw_tmpfile
+ exe "so ".fnameescape(s:netrw_tmpfile)
call delete(s:netrw_tmpfile)
unlet s:netrw_tmpfile
else
@@ -1337,7 +1331,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
let tfile= a:tfile
endif
" " call Decho("exe silent! keepalt file ".tfile)
- exe "silent! keepalt file ".tfile
+ exe "silent! keepalt file ".fnameescape(tfile)
" edit temporary file (ie. read the temporary file in)
if rfile =~ '\.zip$'
@@ -1359,7 +1353,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
" rename buffer back to remote filename
" call Decho("exe silent! keepalt file ".escape(rfile,' '))
- exe "silent! keepalt file ".escape(rfile,' ')
+ exe "silent! keepalt file ".fnameescape(rfile)
if a:method == 5
set ft=html
else
@@ -1375,7 +1369,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method)
let curline = line(".")
let lastline= line("$")
" call Decho("exe<".a:readcmd." ".v:cmdarg." ".a:tfile."> line#".curline)
- exe a:readcmd." ".v:cmdarg." ".a:tfile
+ exe a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)
let line1= curline + 1
let line2= line("$") - lastline + 1
@@ -1718,19 +1712,20 @@ fun! s:BrowserMaps(islocal)
if s:didstarstar || !mapcheck("<s-up>","n")
nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
endif
+ let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape)
if g:netrw_mousemaps == 1
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call <SID>NetrwLeftmouse(1)<cr>
nnoremap <buffer> <silent> <middlemouse> <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr>
nnoremap <buffer> <silent> <s-leftmouse> <leftmouse>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
- exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.b:netrw_curdir.'")<cr>'
- exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.b:netrw_curdir.'")<cr>'
- endif
- exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.b:netrw_curdir.'")<cr>'
- exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.b:netrw_curdir.'")<cr>'
- exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.b:netrw_curdir.'")<cr>'
- exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.b:netrw_curdir.'")<cr>'
- exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.b:netrw_curdir.'")<cr>'
- exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.b:netrw_curdir.'")<cr>'
+ exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ endif
+ exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+ exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
+ exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetrwMakeDir("")<cr>'
nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
@@ -1782,21 +1777,23 @@ fun! s:BrowserMaps(islocal)
if !hasmapto('<Plug>NetrwRefresh')
nmap <buffer> <c-l> <Plug>NetrwRefresh
endif
+ let mapsafepath = escape(s:path, s:netrw_map_escape)
+ let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape)
nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
if g:netrw_mousemaps == 1
nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call <SID>NetrwLeftmouse(0)<cr>
nnoremap <buffer> <silent> <middlemouse> <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr>
nnoremap <buffer> <silent> <s-leftmouse> <leftmouse>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
- exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.s:user.s:machine.'","'.s:path.'")<cr>'
- exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.s:user.s:machine.'","'.s:path.'")<cr>'
- endif
- exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.s:user.s:machine.'","'.s:path.'")<cr>'
- exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.s:user.s:machine.'","'.s:path.'")<cr>'
- exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("'.s:user.s:machine.'")<cr>'
- exe 'nnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.s:user.s:machine.'","'.s:path.'")<cr>'
- exe 'vnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.s:user.s:machine.'","'.s:path.'")<cr>'
- exe 'nnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.s:user.s:machine.'","'.s:path.'")<cr>'
- exe 'vnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.s:user.s:machine.'","'.s:path.'")<cr>'
+ exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ endif
+ exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
+ exe 'nnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'vnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'nnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+ exe 'vnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
nnoremap <buffer> <F1> :he netrw-browse-cmds<cr>
endif
call s:SetRexDir(a:islocal,b:netrw_curdir)
@@ -1850,7 +1847,7 @@ fun! s:NetrwBookmarkDir(chg,curdir)
" change to the bookmarked directory
" call Decho("(user: <B>) change to the bookmarked directory")
if exists("g:NETRW_BOOKMARKDIR_{v:count}")
- exe "e ".g:NETRW_BOOKMARKDIR_{v:count}
+ exe "e ".fnameescape(g:NETRW_BOOKMARKDIR_{v:count})
else
echomsg "Sorry, bookmark#".v:count." doesn't exist!"
endif
@@ -1922,7 +1919,7 @@ fun! s:NetrwBookmarkDir(chg,curdir)
" call Decho("setlocal nomod")
endif
" call Decho("exe e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})
- exe "e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
+ exe "e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})
else
let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
echo "Sorry, no predecessor directory exists yet"
@@ -1943,7 +1940,7 @@ fun! s:NetrwBookmarkDir(chg,curdir)
" call Decho("setlocal nomod")
endif
" call Decho("exe e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})
- exe "e! ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
+ exe "e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})
else
let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
if g:NETRW_DIRHIST_CNT < 0
@@ -2056,12 +2053,12 @@ fun! s:NetrwBrowse(islocal,dirname)
" call Decho("setlocal ma noro")
let b:netrw_curdir= a:dirname
" call Decho("exe silent! keepalt file ".s:method."://".s:user.s:machine."/".fnameescape(s:path)." (bt=".&bt.")")
- exe "silent! keepalt file ".s:method."://".s:user.s:machine."/".fnameescape(s:path)
- exe "silent keepalt doau BufReadPre ".s:fname
+ exe "silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)
+ exe "silent keepalt doau BufReadPre ".fnameescape(s:fname)
silent call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
if s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz'
" netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error
- exe "silent keepalt doau BufReadPost ".s:fname
+ exe "silent keepalt doau BufReadPost ".fnameescape(s:fname)
endif
" save certain window-oriented variables into buffer-oriented variables {{{3
@@ -2337,7 +2334,7 @@ fun! s:NetrwGetBuffer(islocal,dirname)
endif
let w:netrw_treebufnr= bufnr("%")
" call Decho(" exe silent! keepalt file NetrwTreeListing ".s:netrw_treelistnum)
- exe 'silent! keepalt file NetrwTreeListing\ '.s:netrw_treelistnum
+ exe 'silent! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum)
nnoremap <silent> <buffer> [ :silent call <SID>TreeListMove('[')<cr>
nnoremap <silent> <buffer> ] :silent call <SID>TreeListMove(']')<cr>
nnoremap <silent> <buffer> [[ :silent call <SID>TreeListMove('[')<cr>
@@ -2365,7 +2362,7 @@ fun! s:NetrwGetBuffer(islocal,dirname)
exe "b ".bufnum
endif
if bufname("%") == '.'
- exe "silent! keepalt file ".escape(getcwd(),' ')
+ exe "silent! keepalt file ".fnameescape(getcwd())
endif
let &ei= eikeep
if line("$") <= 1
@@ -2393,7 +2390,7 @@ fun! s:NetrwGetBuffer(islocal,dirname)
" call Decho("--do netrw settings: make this buffer not-a-file, modifiable, not line-numbered, etc--")
let fname= expand("%")
call s:NetrwListSettings(a:islocal)
- exe "keepalt file ".escape(fname,' ')
+ exe "keepalt file ".fnameescape(fname)
" delete all lines from buffer {{{3
" call Decho("--delete all lines from buffer--")
@@ -2528,7 +2525,7 @@ fun! s:NetrwListSettings(islocal)
let fname= bufname("%")
setlocal bt=nofile nobl ma nonu nowrap noro
" call Decho("setlocal bt=nofile nobl ma nonu nowrap noro")
- exe "keepalt file ".escape(fname,' ')
+ exe "keepalt file ".fnameescape(fname)
if g:netrw_use_noswf
setlocal noswf
endif
@@ -2642,7 +2639,7 @@ fun! s:NetrwBookmarkMenu()
let histcnt = histcnt + 1
let priority = g:NETRW_DIRHIST_CNT + histcnt
if exists("g:NETRW_DIRHIST_{cnt}")
- let bmdir= escape(g:NETRW_DIRHIST_{cnt},'. ')
+ let bmdir= escape(g:NETRW_DIRHIST_{cnt},'/&? ')
" call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.' :e '.bmdir)
exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.' :e '.bmdir."\<cr>"
endif
@@ -2922,11 +2919,13 @@ fun! netrw#NetrwBrowseX(fname,remote)
" create a local copy
let fname= fnamemodify(tempname(),":r").".".exten
" call Decho("a:remote=".a:remote.": create a local copy of <".a:fname."> as <".fname.">")
- exe "silent keepjumps bot 1new ".a:fname
+ exe "silent keepjumps bot 1new ".fnameescape(fname)
setlocal bh=delete
" call Decho("read <".fname.">, now writing: exe w! ".fname)
- exe "silent! w! ".fname
+ exe "silent! w! ".fnameescape(fname)
q
+ else
+ let fname= a:fname
endif
" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
@@ -2973,7 +2972,7 @@ fun! netrw#NetrwBrowseX(fname,remote)
elseif exists("g:netrw_browsex_viewer") && executable(viewer)
" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
" call Decho("exe silent !".viewer." ".viewopt.shellescape(fname).redir)
- exe "silent !".viewer." ".viewopt.shellescape(fname).redir
+ exe "silent !".viewer." ".viewopt.shellescape(fname,1).redir
let ret= v:shell_error
elseif has("win32") || has("win64")
@@ -2984,12 +2983,12 @@ fun! netrw#NetrwBrowseX(fname,remote)
elseif has("unix") && executable("gnome-open") && !s:haskdeinit
" call Decho("exe silent !gnome-open ".shellescape(fname)." ".redir)
- exe "silent !gnome-open ".shellescape(fname).redir
+ exe "silent !gnome-open ".shellescape(fname,1).redir
let ret= v:shell_error
elseif has("unix") && executable("kfmclient") && s:haskdeinit
" call Decho("exe silent !kfmclient exec ".shellescape(fname)." ".redir)
- exe "silent !kfmclient exec ".shellescape(fname)." ".redir
+ exe "silent !kfmclient exec ".shellescape(fname,1)." ".redir
let ret= v:shell_error
elseif has("macunix") && executable("open")
@@ -3272,7 +3271,7 @@ fun! netrw#Explore(indx,dosplit,style,...)
if starpat == 1
" starpat=1: Explore *//pattern (current directory only search for files containing pattern)
" call Decho("starpat=".starpat.": build *//pattern list")
- exe "vimgrep /".pattern."/gj ".b:netrw_curdir."/*"
+ exe "vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*"
let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)')
if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
@@ -3653,7 +3652,7 @@ fun! s:NetrwMakeDir(usrhost)
exe 'keepjumps lcd '.fnameescape(b:netrw_curdir)
" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">")
" call Decho("exe silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname))
- exe "silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname)
+ exe "silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1)
if !g:netrw_keepdir
exe 'keepjumps lcd '.fnameescape(netrw_origdir)
" call Decho("netrw_keepdir=".g:netrw_keepdir.": keepjumps lcd ".fnameescape(netrw_origdir)." getcwd<".getcwd().">")
@@ -3677,7 +3676,7 @@ fun! s:NetrwMakeDir(usrhost)
let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd)
let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname
" call Decho("exe silent! !".mkdircmd." ".shellescape(newdirname))
- exe "silent! !".mkdircmd." ".shellescape(newdirname)
+ exe "silent! !".mkdircmd." ".shellescape(newdirname,1)
if v:shell_error == 0
" refresh listing
let svpos= netrw#NetrwSavePosn()
@@ -3822,10 +3821,10 @@ fun! s:NetrwMarkFileCompress(islocal)
" call Decho("fname<".fname."> is compressed so decompress with <".exe.">")
if a:islocal
if g:netrw_keepdir
- let fname= s:ComposePath(curdir,fname)
+ let fname= shellescape(s:ComposePath(curdir,fname))
endif
else
- let fname= b:netrw_curdir.fname
+ let fname= shellescape(b:netrw_curdir.fname,1)
endif
if executable(exe)
if a:islocal
@@ -3843,10 +3842,10 @@ fun! s:NetrwMarkFileCompress(islocal)
unlet exe
elseif a:islocal
" fname not a compressed file, so compress it
- call system(g:netrw_compress." ".s:ComposePath(b:netrw_curdir,fname))
+ call system(g:netrw_compress." ".shellescape(s:ComposePath(b:netrw_curdir,fname)))
else
" fname not a compressed file, so compress it
- call s:RemoteSystem(g:netrw_compress." ".fname)
+ call s:RemoteSystem(g:netrw_compress." ".shellescape(fname))
endif
endfor
call s:NetrwUnmarkList(curbufnr,curdir)
@@ -3885,7 +3884,7 @@ fun! s:NetrwMarkFileCopy(islocal)
if a:islocal && s:netrwmftgt_islocal
" Copy marked files, local directory to local directory
" call Decho("copy from local to local")
- let args= join(map(copy(s:netrwmarkfilelist_{bufnr('%')}),"b:netrw_curdir.\"/\".shellescape(v:val)"))
+ let args= join(map(copy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)"))
" call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")")
call system(g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt))
@@ -3908,7 +3907,7 @@ fun! s:NetrwMarkFileCopy(islocal)
if exists("*mkdir")
call mkdir(tmpdir)
else
- exe "silent! !".g:netrw_local_mkdir.' '.shellescape(tmpdir)
+ exe "silent! !".g:netrw_local_mkdir.' '.shellescape(tmpdir,1)
endif
if isdirectory(tmpdir)
exe "keepjumps lcd ".fnameescape(tmpdir)
@@ -3920,7 +3919,7 @@ fun! s:NetrwMarkFileCopy(islocal)
call s:System("delete",fname)
endfor
exe "keepjumps lcd ".fnameescape(curdir)
- exe "silent !".g:netrw_local_rmdir." ".fnameescape(tmpdir)
+ exe "silent !".g:netrw_local_rmdir." ".shellescape(tmpdir,1)
else
exe "keepjumps lcd ".fnameescape(curdir)
endif
@@ -3967,13 +3966,13 @@ fun! s:NetrwMarkFileDiff(islocal)
endif
if cnt == 1
" call Decho("diffthis: ".fname)
- exe "e ".fname
+ exe "e ".fnameescape(fname)
diffthis
elseif cnt == 2 || cnt == 3
vsplit
wincmd l
" call Decho("diffthis: ".fname)
- exe "e ".fname
+ exe "e ".fnameescape(fname)
diffthis
else
break
@@ -3994,17 +3993,7 @@ fun! s:NetrwMarkFileEdit(islocal)
let curbufnr = bufnr("%")
if exists("s:netrwmarkfilelist_{curbufnr}")
call s:SetRexDir(a:islocal,curdir)
- if a:islocal && g:netrw_keepdir
- " use complete paths if its local and keepdir enabled
- let flist= ""
- for fname in s:netrwmarkfilelist
-" let flist= flist." ".s:ComposePath(curdir,fname)
- let flist= flist." ".fname
- endfor
- else
-" let flist= substitute(escape(join(s:netrwmarkfilelist_{curbufnr},"\t"),' '),"\t",' ','g')
- let flist= substitute(escape(join(s:netrwmarkfilelist,"\t"),' '),"\t",' ','g')
- endif
+ let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
" unmark markedfile list
" call s:NetrwUnmarkList(curbufnr,curdir)
call s:NetrwUnmarkAll()
@@ -4036,10 +4025,10 @@ fun! s:NetrwMarkFileExe(islocal)
for fname in s:netrwmarkfilelist_{curbufnr}
if a:islocal
if g:netrw_keepdir
- let fname= s:ComposePath(curdir,fname)
+ let fname= shellescape(s:ComposePath(curdir,fname))
endif
else
- let fname= b:netrw_curdir.fname
+ let fname= shellescape(b:netrw_curdir.fname)
endif
if cmd =~ '%'
let xcmd= substitute(cmd,'%',fname,'g')
@@ -4142,12 +4131,7 @@ fun! s:NetrwMarkFileGrep(islocal)
if exists("s:netrwmarkfilelist")
" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">")
- let netrwmarkfilelist= ""
- for fname in s:netrwmarkfilelist
-" call Decho("fname<".fname.">")
- let fname = escape(substitute(fname,"[\"']","","g")," ")
- let netrwmarkfilelist = netrwmarkfilelist." ".fname
- endfor
+ let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
call s:NetrwUnmarkAll()
" ask user for pattern
@@ -4294,7 +4278,7 @@ fun! s:NetrwMarkFilePrint(islocal)
1split
" the autocmds will handle both local and remote files
" call Decho("exe silent e ".escape(fname,' '))
- exe "silent e ".escape(fname,' ')
+ exe "silent e ".fnameescape(fname)
" call Decho("hardcopy")
hardcopy
q
@@ -4400,7 +4384,7 @@ fun! s:NetrwMarkFileSource(islocal)
endif
" the autocmds will handle sourcing both local and remote files
" call Decho("exe so ".escape(fname,' '))
- exe "so ".escape(fname,' ')
+ exe "so ".fnameescape(fname)
endfor
2match none
endif
@@ -4418,21 +4402,11 @@ fun! s:NetrwMarkFileTag(islocal)
if exists("s:netrwmarkfilelist")
" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">")
- if a:islocal && g:netrw_keepdir
- let netrwmarkfilelist= ""
- for fname in s:netrwmarkfilelist
-" let netrwmarkfilelist= netrwmarkfilelist." ".s:ComposePath(curdir,fname)
- let netrwmarkfilelist= netrwmarkfilelist." ".fname
- endfor
- else
- let netrwmarkfilelist= string(s:netrwmarkfilelist)
- let netrwmarkfilelist= substitute(netrwmarkfilelist,'[[\],]','','g')
- endif
+ let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")"))
call s:NetrwUnmarkAll()
if a:islocal
if executable(g:netrw_ctags)
- call map(netrwmarkfilelist,"shellescape(v:val)")
" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")")
call system(g:netrw_ctags." ".netrwmarkfilelist)
else
@@ -4446,7 +4420,7 @@ fun! s:NetrwMarkFileTag(islocal)
e tags
let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','')
" call Decho("curdir<".curdir."> path<".path.">")
- exe '%s/\t\(\S\+\)\t/\t'.escape(path,'/').'\1\t/e'
+ exe '%s/\t\(\S\+\)\t/\t'.escape(path,'/\n\r\\').'\1\t/e'
wq!
endif
2match none
@@ -4770,9 +4744,9 @@ fun! netrw#NetrwObtain(islocal,fname,...)
else
let path= ""
endif
- let filelist= join(map(copy(fnamelist),'shellescape(g:netrw_machine.":".escape(path.v:val,g:netrw_fname_escape))'))
+ let filelist= join(map(copy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)'))
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".filelist." ".shellescape(tgtdir))
- exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".filelist." ".shellescape(tgtdir)
+ exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)
elseif b:netrw_method == 2
" obtain file using ftp + .netrc
@@ -4800,10 +4774,10 @@ fun! netrw#NetrwObtain(islocal,fname,...)
endfor
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
else
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
endif
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
@@ -4849,7 +4823,7 @@ fun! netrw#NetrwObtain(islocal,fname,...)
endif
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('$'))
endif
@@ -5022,19 +4996,16 @@ fun! s:NetrwUpload(fname,tgt,...)
" handle uploading a single file using NetWrite
" call Decho("handle uploading a single file via NetWrite")
1split
- let efname= escape(a:fname,g:netrw_fname_escape)
" call Decho("exe e ".efname)
- exe "e ".efname
+ exe "e ".fnameescape(a:fname)
" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines")
if a:tgt =~ '/$'
let wfname= substitute(a:fname,'^.*/','','')
- let wfname= escape(a:tgt.wfname,g:netrw_fname_escape)
" call Decho("exe w! ".wfname)
- exe "w! ".wfname
+ exe "w! ".fnameescape(a:tgt.wfname)
else
- let wfname= escape(a:tgt,g:netrw_fname_escape)
" call Decho("writing local->remote: exe w ".wfname)
- exe "w ".wfname
+ exe "w ".fnameescape(a:tgt)
" call Decho("done writing local->remote")
endif
q!
@@ -5046,7 +5017,7 @@ fun! s:NetrwUpload(fname,tgt,...)
if a:tgt =~ '^scp:'
exe "keepjumps silent lcd ".fnameescape(fromdir)
let filelist= copy(s:netrwmarkfilelist_{bufnr('%')})
- let args = join(map(filelist,"shellescape(v:val)"))
+ let args = join(map(filelist,"shellescape(v:val,1)"))
if exists("g:netrw_port") && g:netrw_port != ""
let useport= " ".g:netrw_scpport." ".g:netrw_port
else
@@ -5055,7 +5026,7 @@ fun! s:NetrwUpload(fname,tgt,...)
let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','')
let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','')
" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".args." ".shellescape(machine.":".escape(tgt,g:netrw_fname_escape)))
- exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".args." ".shellescape(machine.":".escape(tgt,g:netrw_fname_escape))
+ exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)
exe "keepjumps silent lcd ".fnameescape(curdir)
elseif a:tgt =~ '^ftp:'
@@ -5067,11 +5038,11 @@ fun! s:NetrwUpload(fname,tgt,...)
silent keepjumps new
" call Decho("filter input window#".winnr())
- exe "put ='".g:netrw_ftpmode."'"
+ put =g:netrw_ftpmode
" call Decho("filter input: ".getline('$'))
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('$'))
endif
@@ -5088,11 +5059,11 @@ fun! s:NetrwUpload(fname,tgt,...)
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
else
" call Decho("filter input window#".winnr())
" call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
- exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
+ exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
endif
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
silent g/Local directory now/d
@@ -5136,7 +5107,7 @@ fun! s:NetrwUpload(fname,tgt,...)
endif
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('$'))
endif
@@ -5180,7 +5151,7 @@ fun! s:NetrwPreview(path) range
call s:NetrwSafeOptions()
if has("quickfix")
if !isdirectory(a:path)
- exe (g:netrw_preview? "vert " : "")."pedit ".escape(a:path,g:netrw_fname_escape)
+ exe (g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path)
elseif !exists("g:netrw_quiet")
call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38)
endif
@@ -5998,7 +5969,7 @@ fun! s:NetrwRemoteListing()
" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)")
if g:netrw_scp_cmd =~ '^pscp'
" call Decho("1: exe silent r! ".listcmd.shellescape(s:path))
- exe "silent r! ".listcmd.shellescape(s:path)
+ exe "silent r! ".listcmd.shellescape(s:path,1)
" remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like
g/^Listing directory/d
g/^d[-rwx][-rwx][-rwx]/s+$+/+e
@@ -6012,7 +5983,7 @@ fun! s:NetrwRemoteListing()
exe "silent r! ".listcmd
else
" call Decho("3: exe silent r! ".listcmd.' "'.shellescape(s:path).'"')
- exe "silent r! ".listcmd.' "'.shellescape(s:path).'"'
+ exe "silent r! ".listcmd.' '.shellescape(s:path,1)
" call Decho("listcmd<".listcmd."> path<".s:path.">")
endif
endif
@@ -6203,14 +6174,14 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all)
call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile)
else
let rmfile = substitute(a:path.a:rmfile,'/$','','')
- let netrw_rmdir_cmd = s:MakeSshCmd(g:netrw_rmdir_cmd).' '.rmfile
+ let netrw_rmdir_cmd = s:MakeSshCmd(g:netrw_rmdir_cmd).' '.shellescape(rmfile)
" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
let ret= s:System("system",netrw_rmdir_cmd)
" call Decho("returned=".ret." errcode=".v:shell_error)
if v:shell_error != 0
" call Decho("v:shell_error not 0")
- let netrw_rmf_cmd= s:MakeSshCmd(g:netrw_rmf_cmd).' '.substitute(rmfile,'[\/]$','','e')
+ let netrw_rmf_cmd= s:MakeSshCmd(g:netrw_rmf_cmd).' '.shellescape(substitute(rmfile,'[\/]$','','e'))
" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
let ret= s:System("system",netrw_rmf_cmd)
" call Decho("returned=".ret." errcode=".v:shell_error)
@@ -6256,17 +6227,17 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
put ='cd \"'.a:path.'\"'
endif
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('.'))
endif
call setline(line("$")+1,a:listcmd)
" exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))'
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
- exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
+ exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)
else
" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
- exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
+ exe s:netrw_silentxfer." keepjumps ".w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)
endif
".........................................
@@ -6290,7 +6261,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd)
put ='cd \"'.a:path.'\"'
endif
if exists("g:netrw_ftpextracmd")
- exe "put ='".g:netrw_ftpextracmd."'"
+ put =g:netrw_ftpextracmd
" call Decho("filter input: ".getline('.'))
endif
call setline(line("$")+1,a:listcmd)
@@ -6368,10 +6339,10 @@ fun! s:NetrwRemoteRename(usrhost,path) range
if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
else
- let oldname= a:path.oldname
- let newname= a:path.newname
+ let oldname= shellescape(a:path.oldname)
+ let newname= shellescape(a:path.newname)
" call Decho("system(rename_cmd".' "'.fnameescape(oldname," ").'" "'.escape(newname).'"')
- let ret= s:System("system",rename_cmd.' "'.fnameescape(oldname).'" "'.fnameescape(newname).'"')
+ let ret= s:System("system",rename_cmd.' '.oldname.' '.newname)
endif
endfor
@@ -6393,10 +6364,10 @@ fun! s:NetrwRemoteRename(usrhost,path) range
if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
else
- let oldname= a:path.oldname
- let newname= a:path.newname
+ let oldname= shellescape(a:path.oldname)
+ let newname= shellescape(a:path.newname)
" call Decho("system(rename_cmd".' "'.fnameescape(oldname," ").'" "'.escape(newname).'"')
- let ret= s:System("system",rename_cmd.' "'.fnameescape(oldname).'" "'.fnameescape(newname).'"')
+ let ret= s:System("system",rename_cmd.' '.oldname.' '.newname)
endif
let ctr= ctr + 1
@@ -6639,7 +6610,7 @@ fun! s:LocalBrowseShellCmdRefresh()
if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1
" wipe out any non-displaying netrw buffer
" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">")
- exe "silent! bd ".ibuf
+ exe "silent! bd ".fnameescape(ibuf)
call remove(s:netrw_browselist,ibl)
" call Decho("browselist=".string(s:netrw_browselist))
continue
@@ -7134,7 +7105,7 @@ fun! s:GetTempfile(fname)
let tmpfile= tempname()
" call Decho("tmpfile<".tmpfile."> : from tempname()")
- let tmpfile= escape(substitute(tmpfile,'\','/','ge'),g:netrw_tmpfile_escape)
+ let tmpfile= substitute(tmpfile,'\','/','ge')
" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /")
" sanity check -- does the temporary file's directory exist?
@@ -7176,7 +7147,6 @@ fun! s:GetTempfile(fname)
else
let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
endif
- let suffix = escape(suffix,g:netrw_tmpfile_escape)
" call Decho("suffix<".suffix.">")
let tmpfile= substitute(tmpfile,'\.tmp$','','e')
" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)")
@@ -7286,7 +7256,7 @@ fun! s:NetrwEnew(curdir)
nno <silent> <buffer> [ :silent call <SID>TreeListMove('[')<cr>
nno <silent> <buffer> ] :silent call <SID>TreeListMove(']')<cr>
else
- exe "silent! keepalt file ".b:netrw_curdir
+ exe "silent! keepalt file ".fnameescape(b:netrw_curdir)
endif
endif
@@ -7525,22 +7495,24 @@ fun! s:SetRexDir(islocal,dirname)
" call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)")
" set up Rex and leftmouse-double-click
if a:islocal
- exe 'com! Rexplore call s:NetrwRexplore(1,"'.a:dirname.'")'
+ exe 'com! Rexplore call s:NetrwRexplore(1,"'.escape(a:dirname,'"\').'")'
if g:netrw_retmap
silent! unmap <2-leftmouse>
if !hasmapto("<Plug>NetrwReturn")
nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
endif
- exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(1,"'.a:dirname.'")<cr>'
+ let dir = escape(a:dirname, s:netrw_map_escape)
+ exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(1,"'.dir.'")<cr>'
endif
else
- exe 'com! Rexplore call s:NetrwRexplore(0,"'.a:dirname.'")'
+ exe 'com! Rexplore call s:NetrwRexplore(0,"'.escape(a:dirname,'"\').'")'
if g:netrw_retmap
silent! unmap <2-leftmouse>
if !hasmapto("<Plug>NetrwReturn")
nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
endif
- exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(0,"'.a:dirname.'")<cr>'
+ let dir = escape(a:dirname, s:netrw_map_escape)
+ exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(0,"'.dir.'")<cr>'
endif
endif
" call Dret("s:SetRexDir")
--
Vim packaging
More information about the pkg-vim-maintainers
mailing list