diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-06-24 21:56:24 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-06-24 21:56:24 +0000 |
commit | 446cb837a017fc1c1b144cb5c2a35cb90abfbbcf (patch) | |
tree | 6c1fe56f2db8d4adbeee792b181b0659c4d1f216 /runtime/autoload | |
parent | 3577c6fafb77da5419cd1001dac56f204d480bdc (diff) |
updated for version 7.2a
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/netrw.vim | 7458 | ||||
-rw-r--r-- | runtime/autoload/netrwSettings.vim | 38 | ||||
-rw-r--r-- | runtime/autoload/xml/html40s.vim | 1 | ||||
-rw-r--r-- | runtime/autoload/xml/html40t.vim | 1 | ||||
-rw-r--r-- | runtime/autoload/xml/xhtml11.vim | 1 | ||||
-rw-r--r-- | runtime/autoload/zip.vim | 31 |
6 files changed, 4956 insertions, 2574 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index b4753c27fb..6064a6570d 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,22 +1,19 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: May 05, 2007 -" Version: 109 +" Date: Jun 12, 2008 +" Version: 125 " Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, " netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided -" *as is* and comes with no warranty of any kind, either +" *as is* and come with no warranty of any kind, either " expressed or implied. By using this plugin, you agree that " in no event will the copyright holder be liable for any damages " resulting from the use of this software. -" of this software. -" COMBAK: worked with tmpfile s:GetTempname() in NetRead() NetWrite() -" !!NEEDS DEBUGGING && TESTING!!! -"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore() +"redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore() " " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) @@ -30,11 +27,20 @@ if !exists("s:NOTE") let s:WARNING = 1 let s:ERROR = 2 endif -let g:loaded_netrw = "v109" +let g:loaded_netrw = "v125" + +" sanity checks if v:version < 700 call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1) finish endif +if !exists("*shellescape") + call netrw#ErrorMsg(s:ERROR,"you need to upgade your vim so that it has shellescape()",64) +endif +if !exists("*fnameescape") + call netrw#ErrorMsg(s:ERROR,"you need to upgade your vim so that it has fnameescape()",65) +endif + let s:keepcpo= &cpo setlocal cpo&vim "DechoTabOn @@ -115,6 +121,18 @@ endif " --------------------------------------------------------------------- " Default values for netrw's global variables {{{2 +" Cygwin Detection ------- {{{3 +if !exists("g:netrw_cygwin") + if has("win32") || has("win95") || has("win64") || has("win16") + if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$' + let g:netrw_cygwin= 1 + else + let g:netrw_cygwin= 0 + endif + else + let g:netrw_cygwin= 0 + endif +endif " Default values - a-c ---------- {{{3 if !exists("g:netrw_alto") let g:netrw_alto= &sb @@ -128,26 +146,25 @@ endif if !exists("g:netrw_chgwin") let g:netrw_chgwin = -1 endif -if !exists("g:netrw_cygwin") - if has("win32") || has("win95") || has("win64") || has("win16") - if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$' - let g:netrw_cygwin= 1 - else - let g:netrw_cygwin= 0 - endif - else - let g:netrw_cygwin= 0 - endif -else - let g:netrw_cygwin= 0 +if !exists("g:netrw_compress") + let g:netrw_compress= "gzip" +endif +if !exists("g:netrw_ctags") + let g:netrw_ctags= "ctags" endif -" Default values - d-f ---------- {{{3 +" Default values - d-g ---------- {{{3 if !exists("g:NETRW_DIRHIST_CNT") let g:NETRW_DIRHIST_CNT= 0 endif +if !exists("g:netrw_decompress") + let g:netrw_decompress= { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"} +endif if !exists("g:netrw_dirhistmax") let g:netrw_dirhistmax= 10 endif +if !exists("g:netrw_fastbrowse") + let g:netrw_fastbrowse= 1 +endif if !exists("g:netrw_ftp_browse_reject") let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$' endif @@ -198,9 +215,35 @@ if !exists("g:netrw_list_hide") let g:netrw_list_hide= "" endif " Default values - lh-lz ---------- {{{3 +if !exists("g:netrw_localcopycmd") + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_localcopycmd= "cp" + else + let g:netrw_localcopycmd= "copy" + endif + elseif has("unix") || has("macunix") + let g:netrw_localcopycmd= "cp" + else + let g:netrw_localcopycmd= "" + endif +endif if !exists("g:netrw_local_mkdir") let g:netrw_local_mkdir= "mkdir" endif +if !exists("g:netrw_localmovecmd") + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_localmovecmd= "mv" + else + let g:netrw_localmovecmd= "move" + endif + elseif has("unix") || has("macunix") + let g:netrw_localmovecmd= "mv" + else + let g:netrw_localmovecmd= "" + endif +endif if !exists("g:netrw_local_rmdir") let g:netrw_local_rmdir= "rmdir" endif @@ -215,6 +258,9 @@ if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp' let g:netrw_list_cmd= g:netrw_list_cmd." -l" endif " Default values - m-r ---------- {{{3 +if !exists("g:netrw_markfileesc") + let g:netrw_markfileesc= '*./[\~' +endif if !exists("g:netrw_maxfilenamelen") let g:netrw_maxfilenamelen= 32 endif @@ -224,6 +270,19 @@ endif if !exists("g:netrw_mkdir_cmd") let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir" endif +if !exists("g:netrw_mousemaps") + if exists("&mouse") && &mouse =~ '[anh]' + let g:netrw_mousemaps= 1 + else + let g:netrw_mousemaps= 0 + endif +endif +if !exists("g:netrw_retmap") + let g:netrw_retmap= 0 +endif +if !exists("g:netrw_preview") + let g:netrw_preview= 0 +endif if !exists("g:netrw_scpport") let g:netrw_scpport= "-P" endif @@ -243,27 +302,11 @@ if !exists("g:netrw_rmf_cmd") let g:netrw_rmf_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f" endif " Default values - s ---------- {{{3 + " set up shell quoting character if exists("g:netrw_silent") && g:netrw_silent != 0 - let g:netrw_silentxfer= "silent " + let s:netrw_silentxfer= "silent " else - let g:netrw_silentxfer= "" -endif -if !exists("g:netrw_fastbrowse") - let g:netrw_fastbrowse= 1 -endif -if !exists("g:netrw_shq") - if exists("&shq") && &shq != "" - let g:netrw_shq= &shq - elseif has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - let g:netrw_shq= "'" - else - let g:netrw_shq= '"' - endif - else - let g:netrw_shq= "'" - endif -" call Decho("g:netrw_shq<".g:netrw_shq.">") + let s:netrw_silentxfer= "" endif if !exists("g:netrw_sort_by") " alternatives: date size @@ -274,7 +317,10 @@ if !exists("g:netrw_sort_direction") let g:netrw_sort_direction= "normal" endif if !exists("g:netrw_sort_sequence") - let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,\.[a-np-z]$,*,\.info$,\.swp$,\.o$\.obj$,\.bak$' + let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' +endif +if !exists("g:netrw_special_syntax") + let g:netrw_special_syntax= 0 endif if !exists("g:netrw_ssh_browse_reject") let g:netrw_ssh_browse_reject='^total\s\+\d\+$' @@ -290,6 +336,9 @@ endif if !exists("g:netrw_timefmt") let g:netrw_timefmt= "%c" endif +if !exists("g:netrw_xstrlen") + let g:netrw_xstrlen= 1 +endif if !exists("g:NetrwTopLvlMenu") let g:NetrwTopLvlMenu= "Netrw." endif @@ -304,17 +353,14 @@ if !exists("g:netrw_winsize") endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 -if !exists("s:netrw_cd_escape") - let s:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\" -endif if !exists("g:netrw_fname_escape") - let g:netrw_fname_escape= ' ?&;' + let g:netrw_fname_escape= ' ?&;%' endif -if !exists("g:netrw_tmpfile_escape") - let g:netrw_tmpfile_escape= ' ?&;' +if !exists("g:netrw_glob_escape") + let g:netrw_glob_escape= '[]*?`{~$' endif -if !exists("s:netrw_glob_escape") - let s:netrw_glob_escape= '[]*?`{~$' +if !exists("g:netrw_tmpfile_escape") + let g:netrw_tmpfile_escape= ' &;' endif " BufEnter event ignored by decho when following variable is true @@ -327,184 +373,201 @@ endif " ============================== " ------------------------------------------------------------------------ -" NetSavePosn: saves position of cursor on screen {{{2 -fun! netrw#NetSavePosn() -" call Dfunc("netrw#NetSavePosn()") - " Save current line and column - let w:netrw_winnr= winnr() - let w:netrw_line = line(".") - let w:netrw_col = virtcol(".") - - " Save top-of-screen line - norm! H0 - let w:netrw_hline= line(".") - - call netrw#NetRestorePosn() -" call Dret("netrw#NetSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) -endfun - -" ------------------------------------------------------------------------ -" NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{2 -fun! netrw#NetRestorePosn() -" call Dfunc("netrw#NetRestorePosn() winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1)) - let eikeep= &ei - set ei=all - if expand("%") == "NetrwMessage" - exe s:winBeforeErr."wincmd w" - endif - - " restore window - if exists("w:netrw_winnr") -" call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w") - exe "silent! ".w:netrw_winnr."wincmd w" - endif - if v:shell_error == 0 - " as suggested by Bram M: redraw on no error - " allows protocol error messages to remain visible - redraw! - endif - - " restore top-of-screen line - if exists("w:netrw_hline") -" call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z") - exe "norm! ".w:netrw_hline."G0z\<CR>" - endif - - " restore position - if exists("w:netrw_line") && exists("w:netrw_col") -" call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|") - exe "norm! ".w:netrw_line."G0".w:netrw_col."\<bar>" - endif - - let &ei= eikeep -" call Dret("netrw#NetRestorePosn") -endfun - -" =============================== -" NetOptionSave: save options and set to "standard" form {{{2 -"DechoTabOn -fun! s:NetOptionSave() -" call Dfunc("s:NetOptionSave() win#".winnr()." buf#".bufnr(".")) - if !exists("w:netrw_optionsave") - let w:netrw_optionsave= 1 +" s:NetrwOptionSave: save options and set to "standard" form {{{2 +" 06/08/07 : removed call to NetrwSafeOptions(), either placed +" immediately after NetrwOptionSave() calls in NetRead +" and NetWrite, or after the s:NetrwEnew() call in +" NetrwBrowse. +" vt: normally its "w:" or "s:" (a variable type) +fun! s:NetrwOptionSave(vt) +" call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">") + +" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) + if !exists("{a:vt}netrw_optionsave") + let {a:vt}netrw_optionsave= 1 else -" call Dret("s:NetOptionSave : netoptionsave=".w:netrw_optionsave) +" call Dret("s:NetrwOptionSave : options already saved") return endif +" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) " Save current settings and current directory let s:yykeep = @@ if exists("&l:acd") - let w:netrw_acdkeep = &l:acd - endif - let w:netrw_aikeep = &l:ai - let w:netrw_awkeep = &l:aw - let w:netrw_cikeep = &l:ci - let w:netrw_cinkeep = &l:cin - let w:netrw_cinokeep = &l:cino - let w:netrw_comkeep = &l:com - let w:netrw_cpokeep = &l:cpo + let {a:vt}netrw_acdkeep = &l:acd + endif + let {a:vt}netrw_aikeep = &l:ai + let {a:vt}netrw_awkeep = &l:aw + let {a:vt}netrw_cikeep = &l:ci + let {a:vt}netrw_cinkeep = &l:cin + let {a:vt}netrw_cinokeep = &l:cino + let {a:vt}netrw_comkeep = &l:com + let {a:vt}netrw_cpokeep = &l:cpo if g:netrw_keepdir - let w:netrw_dirkeep = getcwd() - endif - let w:netrw_fokeep = &l:fo " formatoptions - let w:netrw_gdkeep = &l:gd " gdefault - let w:netrw_hidkeep = &l:hidden - let w:netrw_magickeep = &l:magic - let w:netrw_repkeep = &l:report - let w:netrw_spellkeep = &l:spell - let w:netrw_twkeep = &l:tw " textwidth - let w:netrw_wigkeep = &l:wig " wildignore + let {a:vt}netrw_dirkeep = getcwd() + endif + let {a:vt}netrw_fokeep = &l:fo " formatoptions + let {a:vt}netrw_gdkeep = &l:gd " gdefault + let {a:vt}netrw_hidkeep = &l:hidden + let {a:vt}netrw_magickeep = &l:magic + let {a:vt}netrw_repkeep = &l:report + let {a:vt}netrw_spellkeep = &l:spell + let {a:vt}netrw_twkeep = &l:tw " textwidth + let {a:vt}netrw_wigkeep = &l:wig " wildignore if has("win32") && !has("win95") - let w:netrw_swfkeep= &l:swf " swapfile + let {a:vt}netrw_swfkeep= &l:swf " swapfile endif - call s:NetrwSafeOptions() - if &go =~ 'a' | silent! let w:netrw_regstar = @* | endif - silent! let w:netrw_regslash= @/ + if &go =~ 'a' | silent! let {a:vt}netrw_regstar = @* | endif + silent! let {a:vt}netrw_regslash= @/ -" call Dret("s:NetOptionSave") -" call Dret("s:NetOptionSave : win#".winnr()." buf#".bufnr(".")) +" call Dret("s:NetrwOptionSave : win#".winnr()." buf#".bufnr("%")) endfun " ------------------------------------------------------------------------ -" NetOptionRestore: restore options {{{2 -fun! s:NetOptionRestore() -" call Dfunc("s:NetOptionRestore() win#".winnr()." buf#".bufnr(".")) - if !exists("w:netrw_optionsave") -" call Dret("s:NetOptionRestore : w:netrw_optionsave doesn't exist") +" s:NetrwOptionRestore: restore options {{{2 +fun! s:NetrwOptionRestore(vt) +" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")) + if !exists("{a:vt}netrw_optionsave") +" call Decho("ro=".&ro." ma=".&ma." mod=".&mod." wrap=".&wrap) +" call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif - unlet w:netrw_optionsave + unlet {a:vt}netrw_optionsave if exists("&acd") - if exists("w:netrw_acdkeep") |let &l:acd = w:netrw_acdkeep |unlet w:netrw_acdkeep |endif - endif - if exists("w:netrw_aikeep") |let &l:ai = w:netrw_aikeep |unlet w:netrw_aikeep |endif - if exists("w:netrw_awkeep") |let &l:aw = w:netrw_awkeep |unlet w:netrw_awkeep |endif - if exists("w:netrw_cikeep") |let &l:ci = w:netrw_cikeep |unlet w:netrw_cikeep |endif - if exists("w:netrw_cinkeep") |let &l:cin = w:netrw_cinkeep |unlet w:netrw_cinkeep |endif - if exists("w:netrw_cinokeep") |let &l:cino = w:netrw_cinokeep |unlet w:netrw_cinokeep |endif - if exists("w:netrw_comkeep") |let &l:com = w:netrw_comkeep |unlet w:netrw_comkeep |endif - if exists("w:netrw_cpokeep") |let &l:cpo = w:netrw_cpokeep |unlet w:netrw_cpokeep |endif - if exists("w:netrw_dirkeep") |exe "lcd ".w:netrw_dirkeep |unlet w:netrw_dirkeep |endif - if exists("w:netrw_fokeep") |let &l:fo = w:netrw_fokeep |unlet w:netrw_fokeep |endif - if exists("w:netrw_gdkeep") |let &l:gd = w:netrw_gdkeep |unlet w:netrw_gdkeep |endif - if exists("w:netrw_hidkeep") |let &l:hidden = w:netrw_hidkeep |unlet w:netrw_hidkeep |endif - if exists("w:netrw_magic") |let &l:magic = w:netrw_magic |unlet w:netrw_magic |endif - if exists("w:netrw_repkeep") |let &l:report = w:netrw_repkeep |unlet w:netrw_repkeep |endif - if exists("w:netrw_spellkeep")|let &l:spell = w:netrw_spellkeep |unlet w:netrw_spellkeep|endif - if exists("w:netrw_twkeep") |let &l:tw = w:netrw_twkeep |unlet w:netrw_twkeep |endif - if exists("w:netrw_wigkeep") |let &l:wig = w:netrw_wigkeep |unlet w:netrw_wigkeep |endif - if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif - if exists("w:netrw_swfkeep") + if exists("{a:vt}netrw_acdkeep") +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) + let curdir = getcwd() + let &l:acd = {a:vt}netrw_acdkeep + unlet {a:vt}netrw_acdkeep + if &l:acd +" call Decho("exe keepjumps lcd ".fnameescape(curdir)) " NOTE: was g:netrw_fname_escape for some reason + try + if !exists("&l:acd") && !&l:acd + exe 'keepjumps lcd '.fnameescape(curdir) + endif + catch /^Vim\%((\a\+)\)\=:E472/ + call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".curdir."> (permissions?)",61) + endtry + endif + endif + endif + if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif + if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif + if exists("{a:vt}netrw_cikeep") |let &l:ci = {a:vt}netrw_cikeep |unlet {a:vt}netrw_cikeep |endif + if exists("{a:vt}netrw_cinkeep") |let &l:cin = {a:vt}netrw_cinkeep |unlet {a:vt}netrw_cinkeep |endif + if exists("{a:vt}netrw_cinokeep") |let &l:cino = {a:vt}netrw_cinokeep |unlet {a:vt}netrw_cinokeep |endif + if exists("{a:vt}netrw_comkeep") |let &l:com = {a:vt}netrw_comkeep |unlet {a:vt}netrw_comkeep |endif + if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif + if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir + let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') + if exists("{a:vt}netrw_dirkeep") |exe "keepjumps lcd ".fnameescape(dirkeep)|unlet {a:vt}netrw_dirkeep |endif + endif + if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif + if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif + if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif + if exists("{a:vt}netrw_magic") |let &l:magic = {a:vt}netrw_magic |unlet {a:vt}netrw_magic |endif + if exists("{a:vt}netrw_repkeep") |let &l:report = {a:vt}netrw_repkeep |unlet {a:vt}netrw_repkeep |endif + if exists("{a:vt}netrw_spellkeep")|let &l:spell = {a:vt}netrw_spellkeep |unlet {a:vt}netrw_spellkeep|endif + if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif + if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif + if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif + if exists("{a:vt}netrw_swfkeep") if &directory == "" " user hasn't specified a swapfile directory; " netrw will temporarily set the swapfile directory " to the current directory as returned by getcwd(). let &l:directory = getcwd() - silent! let &l:swf = w:netrw_swfkeep + silent! let &l:swf = {a:vt}netrw_swfkeep setlocal directory= - unlet w:netrw_swfkeep - elseif &l:swf != w:netrw_swfkeep - " following line causes a Press ENTER in windows -- can't seem to work around it!!! (COMBAK) - silent! let &l:swf= w:netrw_swfkeep - unlet w:netrw_swfkeep + unlet {a:vt}netrw_swfkeep + elseif &l:swf != {a:vt}netrw_swfkeep + " following line causes a Press ENTER in windows -- can't seem to work around it!!! + silent! let &l:swf= {a:vt}netrw_swfkeep + unlet {a:vt}netrw_swfkeep endif endif - if exists("w:netrw_regstar") |silent! let @*= w:netrw_regstar |unlet w:netrw_regstar |endif - if exists("w:netrw_regslash")|silent! let @/= w:netrw_regslash|unlet w:netrw_regslash|endif + if exists("{a:vt}netrw_regstar") |silent! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif + if exists("{a:vt}netrw_regslash")|silent! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif -" call Dret("s:NetOptionRestore : win#".winnr()." buf#".bufnr(".")) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) +" call Decho("ro=".&ro." ma=".&ma." mod=".&mod." wrap=".&wrap) +" call Dret("s:NetrwOptionRestore : win#".winnr()." buf#".bufnr("%")) endfun " --------------------------------------------------------------------- -" NetrwSafeOptions: sets options to help netrw do its job {{{2 +" s:NetrwSafeOptions: sets options to help netrw do its job {{{2 fun! s:NetrwSafeOptions() -" call Dfunc("s:NetrwSafeOptions()") +" call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">") +" call Decho("window's ft=".&ft) setlocal cino= setlocal com= setlocal cpo-=aA - if exists("&acd") - setlocal noacd nocin noai noci magic nospell nohid wig= noaw - setlocal fo=nroql2 - else - setlocal nocin noai noci magic nospell nohid wig= noaw - setlocal fo=nroql2 - endif + if exists("&acd") | setlocal noacd | endif + setlocal nocin noai noci magic nospell nohid wig= noaw + setlocal fo=nroql2 setlocal tw=0 setlocal report=10000 if g:netrw_use_noswf && has("win32") && !has("win95") setlocal noswf endif +" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) " call Dret("s:NetrwSafeOptions") endfun +" --------------------------------------------------------------------- +" netrw#NetrwClean: remove netrw {{{2 +" supports :NetrwClean -- remove netrw from first directory on runtimepath +" :NetrwClean! -- remove netrw from all directories on runtimepath +fun! netrw#NetrwClean(sys) +" call Dfunc("netrw#NetrwClean(sys=".a:sys.")") + + if a:sys + let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No") + else + let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") + endif +" call Decho("choice=".choice) + let diddel= 0 + let diddir= "" + + if choice == 1 + for dir in split(&rtp,',') + if filereadable(dir."/plugin/netrwPlugin.vim") +" call Decho("removing netrw-related files from ".dir) + if s:System("delete",dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif + if s:System("delete",dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif + if s:System("delete",dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif + if s:System("delete",dir."/autoload/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrw.vim",55) |endif + if s:System("delete",dir."/syntax/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrw.vim",55) |endif + if s:System("delete",dir."/syntax/netrwlist.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrwlist.vim",55) |endif + let diddir= dir + let diddel= diddel + 1 + if !a:sys|break|endif + endif + endfor + endif + + echohl WarningMsg + if diddel == 0 + echomsg "netrw is either not installed or not removable" + elseif diddel == 1 + echomsg "removed one copy of netrw from <".diddir.">" + else + echomsg "removed ".diddel." copies of netrw" + endif + echohl None + +" call Dret("netrw#NetrwClean") +endfun + " ------------------------------------------------------------------------ " Netrw Transfer Functions: {{{1 " =============================== " ------------------------------------------------------------------------ -" NetRead: responsible for reading a file over the net {{{2 +" netrw#NetRead: responsible for reading a file over the net {{{2 " mode: =0 read remote file and insert before current line " =1 read remote file and insert after current line " =2 replace with remote file @@ -513,7 +576,8 @@ fun! netrw#NetRead(mode,...) " call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw) " save options {{{3 - call s:NetOptionSave() + call s:NetrwOptionSave("w:") + call s:NetrwSafeOptions() " interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -599,14 +663,14 @@ fun! netrw#NetRead(mode,...) let ichoice= ichoice + 1 " Determine method of read (ftp, rcp, etc) {{{3 - call s:NetMethod(choice) + call s:NetrwMethod(choice) let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix - " Check if NetBrowse() should be handling this request -" call Decho("checking if NetBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") + " Check if NetrwBrowse() should be handling this request +" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://' " call Decho("yes, choice matches '^.*[\/]$'") - keepjumps call s:NetBrowse(0,choice) + keepjumps call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return endif @@ -640,9 +704,9 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) +" 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) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -650,22 +714,22 @@ fun! netrw#NetRead(mode,...) elseif b:netrw_method == 2 " read with ftp + <.netrc> " call Decho("read via ftp+.netrc (method #2)") let netrw_fname= b:netrw_fname - new + call s:SaveBufVars()|new|call s:RestoreBufVars() setlocal ff=unix exe "put ='".g:netrw_ftpmode."'" -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) if exists("g:netrw_ftpextracmd") exe "put ='".g:netrw_ftpextracmd."'" -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) endif exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'" -" call Decho("filter input: ".getline(".")) +" 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 g: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 else " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine + exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine 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 ' @@ -674,8 +738,8 @@ fun! netrw#NetRead(mode,...) call netrw#ErrorMsg(s:ERROR,getline(1),4) let &debug= debugkeep endif - bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + call s:SaveBufVars()|bd!|call s:RestoreBufVars() + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -684,36 +748,36 @@ fun! netrw#NetRead(mode,...) " Construct execution string (four lines) which will be passed through filter " call Decho("read via ftp+mipf (method #3)") let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - new + call s:SaveBufVars()|new|call s:RestoreBufVars() setlocal ff=unix if exists("g:netrw_port") && g:netrw_port != "" put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) else put ='open '.g:netrw_machine -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) endif if exists("g:netrw_ftp") && g:netrw_ftp == 1 put =g:netrw_uid -" call Decho("filter input: ".getline(".")) - put ='\"'.g:netrw_passwd.'\"' -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) + put ='\"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.')) else - put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"' -" call Decho("filter input: ".getline(".")) + put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.')) endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" put =g:netrw_ftpmode -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) endif if exists("g:netrw_ftpextracmd") exe "put ='".g:netrw_ftpextracmd."'" -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) endif put ='get \"'.netrw_fname.'\" '.tmpfile -" call Decho("filter input: ".getline(".")) +" call Decho("filter input: ".getline('.')) " perform ftp: " -i : turns off interactive prompting from ftp @@ -721,7 +785,7 @@ fun! netrw#NetRead(mode,...) " -n win32: quit being obnoxious about password norm! 1Gdd " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" + exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" " call Decho("error<".getline(1).">") @@ -729,8 +793,8 @@ fun! netrw#NetRead(mode,...) call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif - bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + call s:SaveBufVars()|bd!|call s:RestoreBufVars() + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -742,9 +806,9 @@ fun! netrw#NetRead(mode,...) else let useport= "" endif -" call Decho("executing: !".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_shq.g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape).g:netrw_shq." ".tmpfile - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) +" 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 + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -759,22 +823,24 @@ 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 - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) -" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname) - exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) +" 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) + 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,"^.*#","","") " call Decho("netrw_html<".netrw_html.">") " call Decho("netrw_tag <".netrw_tag.">") -" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) - exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) +" 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) + 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>" endif @@ -795,16 +861,16 @@ fun! netrw#NetRead(mode,...) else put ='open '.g:netrw_machine endif - put ='user '.g:netrw_uid.' '.g:netrw_passwd + put ='user '.g:netrw_uid.' '.s:netrw_passwd put ='get '.netrw_fname.' '.tmpfile put ='quit' " perform cadaver operation: norm! 1Gdd " call Decho("executing: %!".g:netrw_dav_cmd) - exe g:netrw_silentxfer."%!".g:netrw_dav_cmd + exe s:netrw_silentxfer."%!".g:netrw_dav_cmd bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -812,9 +878,9 @@ fun! netrw#NetRead(mode,...) 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("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile - let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) +" 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 + let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -836,15 +902,15 @@ fun! netrw#NetRead(mode,...) endif " call Decho("read via fetch for ".netrw_option) - if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != "" -" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname) - exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname + 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) else -" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname) - exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname +" 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) endif - let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) |