diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-01-07 16:57:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-01-07 16:57:10 +0100 |
commit | 8feef4ff6253afb9dcc61c40082ed4fbb96b685c (patch) | |
tree | b4fcf5ee772cf6eb0ff932c0eb98a322a8c1c273 /runtime | |
parent | a162bc555e74c1a4f1b7b49871e292e05141b054 (diff) |
Update runtime files.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/netrw.vim | 2484 | ||||
-rw-r--r-- | runtime/autoload/netrwSettings.vim | 9 | ||||
-rw-r--r-- | runtime/autoload/netrw_gitignore.vim | 13 | ||||
-rw-r--r-- | runtime/doc/gui_w32.txt | 5 | ||||
-rw-r--r-- | runtime/doc/index.txt | 4 | ||||
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | runtime/doc/pi_netrw.txt | 766 | ||||
-rw-r--r-- | runtime/doc/repeat.txt | 6 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 10 | ||||
-rw-r--r-- | runtime/doc/tags | 21 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 73 | ||||
-rw-r--r-- | runtime/filetype.vim | 5 | ||||
-rw-r--r-- | runtime/ftplugin/less.vim | 20 | ||||
-rw-r--r-- | runtime/ftplugin/man.vim | 6 | ||||
-rw-r--r-- | runtime/ftplugin/matlab.vim | 14 | ||||
-rw-r--r-- | runtime/indent/less.vim | 13 | ||||
-rw-r--r-- | runtime/plugin/netrwPlugin.vim | 44 | ||||
-rw-r--r-- | runtime/syntax/diff.vim | 7 | ||||
-rw-r--r-- | runtime/syntax/html.vim | 7 | ||||
-rw-r--r-- | runtime/syntax/less.vim | 79 | ||||
-rw-r--r-- | runtime/syntax/netrw.vim | 16 | ||||
-rw-r--r-- | runtime/syntax/r.vim | 54 | ||||
-rw-r--r-- | runtime/tutor/tutor.uk.utf-8 | 976 |
23 files changed, 3342 insertions, 1294 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index d8d1857099..42439a57d3 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: May 13, 2014 -" Version: 152 +" Date: Jan 05, 2015 +" Version: 153 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 @@ -29,7 +29,7 @@ if v:version < 704 || !has("patch213") let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v152" +let g:loaded_netrw = "v153" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -51,7 +51,10 @@ setl cpo&vim " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Apr 16, 2014 : max errnum currently is 97 +" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) +" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) +" (this function can optionally take a list of messages) +" May 15, 2014 : max errnum currently is 98 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) @@ -84,18 +87,31 @@ fun! netrw#ErrorMsg(level,msg,errnum) exe bufwinnr("NetrwMessage")."wincmd w" " call Decho("setl ma noro") setl ma noro - keepj call setline(line("$")+1,level.a:msg) - keepj $ + if type(a:msg) == 3 + for msg in a:msg + NetrwKeepj call setline(line("$")+1,level.msg) + endfor + else + NetrwKeepj call setline(line("$")+1,level.a:msg) + endif + NetrwKeepj $ else " call Decho("create a NetrwMessage buffer window") bo 1split sil! call s:NetrwEnew() - sil! keepj call s:NetrwSafeOptions() + sil! NetrwKeepj call s:NetrwSafeOptions() setl bt=nofile - keepj file NetrwMessage + NetrwKeepj file NetrwMessage " call Decho("setl ma noro") setl ma noro - call setline(line("$"),level.a:msg) + if type(a:msg) == 3 + for msg in a:msg + NetrwKeepj call setline(line("$")+1,level.msg) + endfor + else + NetrwKeepj call setline(line("$"),level.a:msg) + endif + NetrwKeepj $ endif " call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) if &fo !~ '[ta]' @@ -118,7 +134,15 @@ fun! netrw#ErrorMsg(level,msg,errnum) elseif a:level == s:ERROR echohl Error endif - echomsg level.a:msg + + if type(a:msg) == 3 + for msg in a:msg + echomsg level.msg + endfor + else + echomsg level.a:msg + endif + " call Decho("echomsg ***netrw*** ".a:msg) echohl None endif @@ -127,7 +151,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) endfun " --------------------------------------------------------------------- -" NetrwInit: initializes variables if they haven't been defined {{{2 +" s:NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. fun s:NetrwInit(varname,value) " call Decho("varname<".a:varname."> value=".a:value) @@ -175,6 +199,13 @@ if !exists("g:netrw_fetch_cmd") let g:netrw_fetch_cmd = "" endif endif +if !exists("g:netrw_file_cmd") + if executable("elinks") + call s:NetrwInit("g:netrw_file_cmd","elinks") + elseif executable("links") + call s:NetrwInit("g:netrw_file_cmd","links") + endif +endif if !exists("g:netrw_ftp_cmd") let g:netrw_ftp_cmd = "ftp" endif @@ -203,6 +234,7 @@ if !exists("g:netrw_http_cmd") endif endif call s:NetrwInit("g:netrw_http_put_cmd","curl -T") +call s:NetrwInit("g:netrw_keepj","keepj") call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") if !exists("g:netrw_scp_cmd") @@ -300,12 +332,20 @@ if !exists("g:netrw_list_cmd") " provide a pscp-based listing command let g:netrw_scp_cmd ="pscp -i C:\\private.ppk" endif - let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + if exists("g:netrw_list_cmd_options") + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME: ".g:netrw_list_cmd_options + else + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + endif elseif executable(g:netrw_ssh_cmd) " provide a scp-based default listing command - let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + if exists("g:netrw_list_cmd_options") + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa ".g:netrw_list_cmd_options + else + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + endif else -" call Decho("g:netrw_ssh_cmd." is not executable") +" call Decho(g:netrw_ssh_cmd." is not executable") let g:netrw_list_cmd= "" endif endif @@ -331,6 +371,19 @@ if !exists("g:netrw_localcopycmd") let g:netrw_localcopycmd= "" endif endif +if !exists("g:netrw_localcopydircmd") + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_localcopydircmd= "cp -R" + else + let g:netrw_localcopycmd= expand("$COMSPEC")." /c xcopy /e /c /h /i /k" + endif + elseif has("unix") || has("macunix") + let g:netrw_localcopydircmd= "cp -R" + else + let g:netrw_localcopycmd= "" + endif +endif if exists("g:netrw_local_mkdir") let g:netrw_localmkdir= g:netrw_local_mkdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87) @@ -399,6 +452,7 @@ else endif call s:NetrwInit("g:netrw_preview" , 0) call s:NetrwInit("g:netrw_scpport" , "-P") +call s:NetrwInit("g:netrw_servername" , "NETRWSERVER") call s:NetrwInit("g:netrw_sshport" , "-p") call s:NetrwInit("g:netrw_rename_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mv") call s:NetrwInit("g:netrw_rm_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm") @@ -407,16 +461,20 @@ call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm " Default values - q-s ---------- {{{3 call s:NetrwInit("g:netrw_quickhelp",0) let s:QuickHelp= ["-:go up dir D:delete R:rename s:sort-by x:special", - \ "%:create new file d:create new directory", - \ "o:split&open v:vert-split&open", - \ "i:style qf:file info O:obtain r:reverse p:preview", - \ "mf:mark file mt:set target mm:move mc:copy", - \ "-bookmarks- mb:make mB:delete qb:list gb:go to", - \ "-history- qb:list u:go up U:go down", - \ "-targets- mt:target Tb:use bookmark Th:use history"] + \ "(create new) %:file d:directory", + \ "(windows split&open) o:horz v:vert p:preview", + \ "i:style qf:file info O:obtain r:reverse", + \ "(marks) mf:mark file mt:set target mm:move mc:copy", + \ "(bookmarks) mb:make mB:delete qb:list gb:go to", + \ "(history) qb:list u:go up U:go down", + \ "(targets) mt:target Tb:use bookmark Th:use history"] " g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\<Char-0x01>" : "\<Char-0xff>") -call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") +if !exists("g:netrw_keepj") || g:netrw_keepj == "keepj" + call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") +else + call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil " : " ") +endif call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size call s:NetrwInit("g:netrw_sort_options" , "") call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...) @@ -488,6 +546,13 @@ if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists( endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif +if g:netrw_keepj =~ "keepj" + com! -nargs=* NetrwKeepj keepj <args> +else + let g:netrw_keepj= "" + com! -nargs=* NetrwKeepj <args> +endif + " ============================== " Netrw Utility Functions: {{{1 " ============================== @@ -525,7 +590,7 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_ " if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -")|endif " if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval") |endif " if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled") |endif -" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on=".g:syntax_on) |endif +" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a") |endif " if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists") |endif endif @@ -655,7 +720,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " else " Decho " call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") endif - keepj norm! 0 + NetrwKeepj norm! 0 if a:0 > 0 " call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">") @@ -751,7 +816,6 @@ fun! netrw#Explore(indx,dosplit,style,...) endif if dirname =~ '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) - "call s:NetrwBrowse(0,dirname) else if dirname == "" let dirname= getcwd() @@ -778,9 +842,9 @@ fun! netrw#Explore(indx,dosplit,style,...) " --------------------------------------------------------------------- " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest " if has("win32") || has("win95") || has("win64") || has("win16") -" keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') +" NetrwKeepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') " else -" keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') +" NetrwKeepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') " endif " --------------------------------------------------------------------- @@ -811,7 +875,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Nexplore " call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")") if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -836,7 +900,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Pexplore " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -861,7 +925,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore " call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")") - keepj keepalt call s:NetrwClearExplore() + NetrwKeepj keepalt call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() @@ -874,7 +938,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) " call Decho("....pattern<".pattern.">") try - exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" + exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) " call Dret("netrw#Explore : unable to find pattern<".pattern.">") @@ -888,7 +952,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") " call Decho("....pattern<".pattern.">") try - exe "sil keepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" + exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif @@ -927,7 +991,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') - keepalt keepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) + keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -947,7 +1011,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx - keepalt keepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) + keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif exe "let dirfile= w:netrw_explore_list[".indx."]" @@ -961,20 +1025,20 @@ fun! netrw#Explore(indx,dosplit,style,...) let w:netrw_liststyle= g:netrw_liststyle endif if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST - keepalt keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") + keepalt NetrwKeepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") else - keepalt keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + keepalt NetrwKeepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") endif let w:netrw_explore_mtchcnt = indx + 1 let w:netrw_explore_bufnr = bufnr("%") let w:netrw_explore_line = line(".") - keepalt keepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') + keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') " call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) else " call Decho("..your vim does not have +path_extra") if !exists("g:netrw_quiet") - keepalt keepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) + keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) endif if has("clipboard") sil! let @* = keepregstar @@ -993,9 +1057,9 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let newdir= dirname if !exists("b:netrw_curdir") - keepj call netrw#LocalBrowseCheck(getcwd()) + NetrwKeepj call netrw#LocalBrowseCheck(getcwd()) else - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) endif endif @@ -1057,50 +1121,99 @@ endfun " --------------------------------------------------------------------- " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 -fun! netrw#Lexplore(...) -" call Dfunc("netrw#Lexplore() a:0=".a:0) +fun! netrw#Lexplore(count,rightside,...) +" call Dfunc("netrw#Lexplore(count=".a:count."rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) + let curwin= winnr() + if a:0 > 0 && a:1 != "" " if a netrw window is already on the left-side of the tab " and a directory has been specified, explore with that " directory. - let lexwinnr= winnr() + let a1 = expand(a:1) +" call Decho("a:1<".a:1."> curwin#".curwin) exe "1wincmd w" if &ft == "netrw" - exe "Explore ".fnameescape(a:1) - exe lexwinnr."wincmd w" +" call Decho("exe Explore ".fnameescape(a:1)) + exe "Explore ".fnameescape(a1) + exe curwin."wincmd w" + if exists("t:netrw_lexposn") +" call Decho("forgetting t:netrw_lexposn") + unlet t:netrw_lexposn + endif +" call Dret("netrw#Lexplore") + return endif - exe lexwinnr."wincmd w" -" call Dret("netrw#Lexplore") - return + exe curwin."wincmd w" + else + let a1= "" endif if exists("t:netrw_lexbufnr") - " close down netrw explorer window + " check if t:netrw_lexbufnr refers to a netrw window let lexwinnr = bufwinnr(t:netrw_lexbufnr) - if lexwinnr != -1 - let curwin = winnr() - exe lexwinnr."wincmd w" - close - exe curwin."wincmd w" - endif + else + let lexwinnr= 0 + endif + + if lexwinnr > 0 + " close down netrw explorer window +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window") + exe lexwinnr."wincmd w" + let g:netrw_winsize = -winwidth(0) + let t:netrw_lexposn = netrw#SavePosn() +" call Decho("saving t:netrw_lexposn") + close + if lexwinnr < curwin + let curwin= curwin - 1 + endif + exe curwin."wincmd w" unlet t:netrw_lexbufnr else " open netrw explorer window +" call Decho("t:netrw_lexbufnr<n/a>: open netrw explorer window") exe "1wincmd w" let keep_altv = g:netrw_altv let g:netrw_altv = 0 - if a:0 > 0 && a:1 != "" - exe "Vexplore ".fnameescape(a:1) + if a:count != 0 + let netrw_winsize = g:netrw_winsize + let g:netrw_winsize = a:count + endif + let curfile= expand("%") +" call Decho("curfile<".curfile.">") + exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" + if a:0 > 0 && a1 != "" +" call Decho("case 1: Explore ".a1) + exe "Explore ".fnameescape(a1) + elseif curfile =~ '^\a\+://' +" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','','')) + exe "Explore ".substitute(curfile,'[^/\\]*$','','') else - Vexplore . +" call Decho("case 3: Explore .") + Explore . endif + if a:count != 0 + let g:netrw_winsize = netrw_winsize + endif + setlocal winfixwidth let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") + if exists("t:netrw_lexposn") +" call Decho("restoring to t:netrw_lexposn") + call netrw#RestorePosn(t:netrw_lexposn) + unlet t:netrw_lexposn + endif endif + + " set up default window for editing via <cr> if exists("g:netrw_chgwin") && g:netrw_chgwin == -1 - let g:netrw_chgwin= 2 + if a:rightside + let g:netrw_chgwin= 1 + else + let g:netrw_chgwin= 2 + endif endif + " call Dret("netrw#Lexplore") endfun @@ -1261,17 +1374,16 @@ fun! netrw#Obtain(islocal,fname,...) let path= "" endif let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) elseif b:netrw_method == 2 " obtain file using ftp + .netrc " call Decho("obtain via ftp+.netrc (method #2)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) endif @@ -1281,7 +1393,7 @@ fun! netrw#Obtain(islocal,fname,...) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif for fname in fnamelist @@ -1289,11 +1401,9 @@ fun! netrw#Obtain(islocal,fname,...) " call Decho("filter input: ".getline('$')) endfor if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) else -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s: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 ' @@ -1306,53 +1416,53 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 3 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) " call Decho("obtain via ftp+mipf (method #3)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('$')) else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('$')) if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif " call Decho("filter input: ".getline('$')) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('$')) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) endif if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') + NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif for fname in fnamelist - keepj call setline(line("$")+1,'get "'.fname.'"') + NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') endfor " call Decho("filter input: ".getline('$')) @@ -1360,14 +1470,13 @@ fun! netrw#Obtain(islocal,fname,...) " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " 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).">") if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,getline(1),5) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif @@ -1379,8 +1488,7 @@ fun! netrw#Obtain(islocal,fname,...) else let localfile= a:fname endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) - exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) elseif !exists("b:netrw_method") || b:netrw_method < 0 " probably a badly formed url; protocol not recognized @@ -1390,7 +1498,7 @@ fun! netrw#Obtain(islocal,fname,...) else " protocol recognized but not supported for Obtain (yet?) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) endif " call Dret("netrw#Obtain : current protocol not supported for obtaining file") return @@ -1398,7 +1506,7 @@ fun! netrw#Obtain(islocal,fname,...) " restore status line if type(a:fname) == 1 && exists("s:netrw_users_stl") - keepj call s:SetupNetrwStatusLine(s:netrw_users_stl) + NetrwKeepj call s:SetupNetrwStatusLine(s:netrw_users_stl) endif endif @@ -1440,7 +1548,7 @@ fun! s:NetrwOptionRestore(vt) if !exists("{a:vt}netrw_optionsave") if exists("s:nbcd_curpos_{bufnr('%')}") " call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") - keepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) + NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) " call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) " call Decho("unlet s:nbcd_curpos_".bufnr('%')) unlet s:nbcd_curpos_{bufnr('%')} @@ -1481,7 +1589,9 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif if exists("{a:vt}netrw_fenkeep") |let &l:fen = {a:vt}netrw_fenkeep |unlet {a:vt}netrw_fenkeep |endif - if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif + if exists("g:netrw_ffkep") && g:netrw_ffkeep + if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |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 @@ -1535,7 +1645,7 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif if exists("s:nbcd_curpos_{bufnr('%')}") " call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") - keepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) + NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) " call Decho("unlet s:nbcd_curpos_".bufnr('%')) if exists("s:nbcd_curpos_".bufnr('%')) unlet s:nbcd_curpos_{bufnr('%')} @@ -1599,7 +1709,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_cpokeep = &l:cpo let {a:vt}netrw_diffkeep = &l:diff let {a:vt}netrw_fenkeep = &l:fen - if !exists("g:netrw_ffkeep") || g:netrw_ffkeep == 1 + if !exists("g:netrw_ffkeep") || g:netrw_ffkeep let {a:vt}netrw_ffkeep = &l:ff endif let {a:vt}netrw_fokeep = &l:fo " formatoptions @@ -1686,10 +1796,10 @@ fun! s:NetrwSafeOptions() " call Decho("ft<".&ft."> ei=".&ei) if &ft == "netrw" " call Decho("do any netrw FileType autocmds (doau FileType netrw)") - sil! keepalt keepj doau FileType netrw + sil! keepalt NetrwKeepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwSafeOptions") endfun @@ -1744,6 +1854,10 @@ fun! netrw#NetRead(mode,...) call s:NetrwOptionSave("w:") call s:NetrwSafeOptions() call s:RestoreCursorline() + " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. + " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. + setl bl +" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -1790,6 +1904,7 @@ fun! netrw#NetRead(mode,...) echomsg ':Nread fetch://machine/path uses fetch' echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' echomsg ':Nread http://[user@]machine/path uses http wget' + echomsg ':Nread file:///path uses elinks' echomsg ':Nread https://[user@]machine/path uses http wget' echomsg ':Nread rcp://[user@]machine/path uses rcp' echomsg ':Nread rsync://machine[:port]/path uses rsync' @@ -1841,7 +1956,7 @@ fun! netrw#NetRead(mode,...) " call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' " call Decho("yes, choice matches '^.*[\/]$'") - keepj call s:NetrwBrowse(0,choice) + NetrwKeepj call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return endif @@ -1875,8 +1990,7 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + call s:NetrwExe(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 @@ -1885,29 +1999,27 @@ 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 - keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline(line("$"))) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd |