diff options
author | Bram Moolenaar <Bram@vim.org> | 2014-01-23 14:24:41 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2014-01-23 14:24:41 +0100 |
commit | 8d04317104f7ab39785aa9451c6810ef22fcec76 (patch) | |
tree | 7bff2ef9af3dae8ef12177c43eb397e596fadc9e /runtime | |
parent | ac8400d48354a62b7b761cf6897641876d2c476d (diff) |
Updated runtime files.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/autoload/getscript.vim | 10 | ||||
-rw-r--r-- | runtime/autoload/netrw.vim | 961 | ||||
-rw-r--r-- | runtime/autoload/netrwSettings.vim | 11 | ||||
-rw-r--r-- | runtime/autoload/netrw_gitignore.vim | 71 | ||||
-rw-r--r-- | runtime/doc/change.txt | 4 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 9 | ||||
-rw-r--r-- | runtime/doc/pi_getscript.txt | 6 | ||||
-rw-r--r-- | runtime/doc/pi_netrw.txt | 240 | ||||
-rw-r--r-- | runtime/doc/tags | 12 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 84 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 24 | ||||
-rw-r--r-- | runtime/ftplugin/changelog.vim | 4 | ||||
-rw-r--r-- | runtime/ftplugin/cobol.vim | 11 | ||||
-rw-r--r-- | runtime/ftplugin/registry.vim | 36 | ||||
-rw-r--r-- | runtime/indent/php.vim | 4 | ||||
-rw-r--r-- | runtime/plugin/getscriptPlugin.vim | 9 | ||||
-rw-r--r-- | runtime/plugin/netrwPlugin.vim | 81 | ||||
-rw-r--r-- | runtime/syntax/netrw.vim | 5 |
18 files changed, 1097 insertions, 485 deletions
diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim index 6b74d37da9..d50bc2edc0 100644 --- a/runtime/autoload/getscript.vim +++ b/runtime/autoload/getscript.vim @@ -1,8 +1,8 @@ " --------------------------------------------------------------------- " getscript.vim " Author: Charles E. Campbell -" Date: Apr 17, 2013 -" Version: 35 +" Date: Jan 21, 2014 +" Version: 36 " Installing: :help glvs-install " Usage: :help glvs " @@ -15,7 +15,7 @@ if exists("g:loaded_getscript") finish endif -let g:loaded_getscript= "v35" +let g:loaded_getscript= "v36" if &cp echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" finish @@ -208,8 +208,8 @@ fun! getscript#GetLatestVimScripts() let lastline = line("$") " call Decho("lastline#".lastline) let firstdir = substitute(&rtp,',.*$','','') - let plugins = split(globpath(firstdir,"plugin/*.vim"),'\n') - let plugins = plugins + split(globpath(firstdir,"AsNeeded/*.vim"),'\n') + let plugins = split(globpath(firstdir,"plugin/**/*.vim"),'\n') + let plugins = plugins + split(globpath(firstdir,"AsNeeded/**/*.vim"),'\n') let foundscript = 0 " this loop updates the GetLatestVimScripts.dat file diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index b077bb73bb..4634a343c5 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: May 18, 2013 -" Version: 149 +" Date: Jan 21, 2014 +" Version: 150 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2012 Charles E. Campbell {{{1 +" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{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, @@ -22,13 +22,7 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v149" -if v:version < 703 || (v:version == 703 && !has("patch465")) - echohl WarningMsg - echo "***warning*** this version of netrw needs vim 7.3.465 or later" - echohl Normal - finish -endif +let g:loaded_netrw = "v150" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -37,7 +31,7 @@ endif let s:keepcpo= &cpo set cpo&vim -"DechoTabOn +"DechoRemOn "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) " ====================== @@ -49,7 +43,7 @@ set cpo&vim " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" May 01, 2013 : max errnum currently is 93 +" Jan 03, 2014 : max errnum currently is 95 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) @@ -200,6 +194,7 @@ if !exists("g:netrw_http_cmd") let g:netrw_http_cmd = "" endif endif +call s:NetrwInit("g:netrw_http_put_cmd","curl -T") call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") if !exists("g:netrw_scp_cmd") @@ -260,6 +255,7 @@ endif call s:NetrwInit("g:netrw_cursor" , 2) let s:netrw_usercul = &cursorline let s:netrw_usercuc = &cursorcolumn +call s:NetrwInit("g:netrw_cygdrive","/cygdrive") " Default values - d-g ---------- {{{3 call s:NetrwInit("s:didstarstar",0) call s:NetrwInit("g:netrw_dirhist_cnt" , 0) @@ -291,23 +287,19 @@ if !exists("g:netrw_ignorenetrc") endif call s:NetrwInit("g:netrw_keepdir",1) if !exists("g:netrw_list_cmd") - if g:netrw_scp_cmd =~ '^pscp' && executable("pscp") if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk") " 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:" - 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" - else " call Decho(g:netrw_ssh_cmd." is not executable") let g:netrw_list_cmd= "" endif - endif call s:NetrwInit("g:netrw_list_hide","") " Default values - lh-lz ---------- {{{3 @@ -434,6 +426,11 @@ endif call s:NetrwInit("g:netrw_menu_escape",'.&? \') call s:NetrwInit("g:netrw_tmpfile_escape",' &;') call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"") +if &enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4' + let s:treedepthstring= "│ " +else + let s:treedepthstring= "| " +endif " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -444,11 +441,18 @@ call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"") " Netrw Initialization: {{{1 " ====================== if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") - let s:initbeval = &beval -" let s:initbexpr = &l:bexpr - let &l:bexpr = "netrw#NetrwBalloonHelp()" - set beval - au BufWinEnter,WinEnter * if &ft == "netrw"|set beval|else|let &beval= s:initbeval|endif +" call Decho("installed beval events") + let &l:bexpr = "netrw#NetrwBalloonHelp()" + au FileType netrw set beval + au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif + au VimEnter * let s:initbeval= &beval +"else " Decho +" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700") | endif +" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval") | endif +" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists") | endif +" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists") | endif +" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting") | endif +" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists") | endif endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif @@ -458,33 +462,44 @@ au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif " --------------------------------------------------------------------- " netrw#NetrwBalloonHelp: {{{2 -if v:version >= 700 && has("balloon_eval") && &beval == 1 && has("syntax") && exists("g:syntax_on") - fun! netrw#NetrwBalloonHelp() - if !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval) - let mesg= "" - elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing" - let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file" - elseif getline(v:beval_lnum) =~ '^"\s*/' - let mesg = "<cr>: edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" - elseif v:beval_text == "Sorted" || v:beval_text == "by" - let mesg = 's: sort by name, time, or file size r: reverse sorting order mt: mark target' - elseif v:beval_text == "Sort" || v:beval_text == "sequence" - let mesg = "S: edit sorting sequence" - elseif v:beval_text == "Hiding" || v:beval_text == "Showing" - let mesg = "a: hiding-showing-all ctrl-h: editing hiding list mh: hide/show by suffix" - elseif v:beval_text == "Quick" || v:beval_text == "Help" - let mesg = "Help: press <F1>" - elseif v:beval_text == "Copy/Move" || v:beval_text == "Tgt" - let mesg = "mt: mark target mc: copy marked file to target mm: move marked file to target" - else - let mesg= "" - endif - return mesg - endfun +if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval") +" call Decho("loading netrw#BalloonHelp()") + fun! netrw#NetrwBalloonHelp() + if &ft != "netrw" + return "" + endif + if !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval) + let mesg= "" + elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing" + let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file" + elseif getline(v:beval_lnum) =~ '^"\s*/' + let mesg = "<cr>: edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" + elseif v:beval_text == "Sorted" || v:beval_text == "by" + let mesg = 's: sort by name, time, or file size r: reverse sorting order mt: mark target' + elseif v:beval_text == "Sort" || v:beval_text == "sequence" + let mesg = "S: edit sorting sequence" + elseif v:beval_text == "Hiding" || v:beval_text == "Showing" + let mesg = "a: hiding-showing-all ctrl-h: editing hiding list mh: hide/show by suffix" + elseif v:beval_text == "Quick" || v:beval_text == "Help" + let mesg = "Help: press <F1>" + elseif v:beval_text == "Copy/Move" || v:beval_text == "Tgt" + let mesg = "mt: mark target mc: copy marked file to target mm: move marked file to target" + else + let mesg= "" + endif + return mesg + endfun +"else " Decho +" 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:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists") |endif endif " ------------------------------------------------------------------------ " s:NetrwOptionSave: save options prior to setting to "netrw-buffer-standard" form {{{2 +" Options get restored by s:NetrwOptionRestore() " 06/08/07 : removed call to NetrwSafeOptions(), either placed " immediately after NetrwOptionSave() calls in NetRead " and NetWrite, or after the s:NetrwEnew() call in @@ -493,6 +508,7 @@ endif fun! s:NetrwOptionSave(vt) " call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) +" call Decho("(s:NetrwOptionSave) 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." a:vt=".a:vt) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 @@ -500,7 +516,7 @@ fun! s:NetrwOptionSave(vt) " call Dret("s:NetrwOptionSave : options already saved") return endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) +" call Decho("(s:NetrwOptionSave) prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) " Save current settings and current directory " call Decho("saving current settings and current directory") @@ -535,6 +551,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_rokeep = &l:ro let {a:vt}netrw_selkeep = &l:sel let {a:vt}netrw_spellkeep = &l:spell + let {a:vt}netrw_starkeep = @* let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth let {a:vt}netrw_wigkeep = &l:wig " wildignore @@ -555,13 +572,15 @@ fun! s:NetrwOptionSave(vt) if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif sil! let {a:vt}netrw_regslash= @/ -" call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho("(s:NetrwOptionSave) 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." a:vt=".a:vt) +" call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun " ------------------------------------------------------------------------ -" s:NetrwOptionRestore: restore options {{{2 +" s:NetrwOptionRestore: restore options (based on prior s:NetrwOptionSave) {{{2 fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) +" call Decho("(NetrwOptionRestore) 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." a:vt=".a:vt) if !exists("{a:vt}netrw_optionsave") if exists("s:nbcd_curpos_{bufnr('%')}") " call Decho("(NetrwOptionRestore) restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") @@ -572,6 +591,7 @@ fun! s:NetrwOptionRestore(vt) else " call Decho("(NetrwOptionRestore) no previous position") endif +" call Decho("(NetrwOptionRestore) 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." a:vt=".a:vt) " call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return @@ -627,6 +647,7 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_rokeep") |let &l:ro = {a:vt}netrw_rokeep |unlet {a:vt}netrw_rokeep |endif if exists("{a:vt}netrw_selkeep") |let &l:sel = {a:vt}netrw_selkeep |unlet {a:vt}netrw_selkeep |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_starkeep") |let @* = {a:vt}netrw_starkeep |unlet {a:vt}netrw_starkeep |endif " Problem: start with liststyle=0; press <i> : result, following line resets l:ts. " if exists("{a:vt}netrw_tskeep") |let &l:ts = {a:vt}netrw_tskeep |unlet {a:vt}netrw_tskeep |endif if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif @@ -639,7 +660,7 @@ fun! s:NetrwOptionRestore(vt) " 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() + let &l:directory= getcwd() sil! let &l:swf = {a:vt}netrw_swfkeep setl directory= unlet {a:vt}netrw_swfkeep @@ -659,7 +680,9 @@ fun! s:NetrwOptionRestore(vt) " call Decho("(NetrwOptionRestore) restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") keepj call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) " call Decho("(NetrwOptionRestore) unlet s:nbcd_curpos_".bufnr('%')) - unlet s:nbcd_curpos_{bufnr('%')} + if exists("s:nbcd_curpos_".bufnr('%')) + unlet s:nbcd_curpos_{bufnr('%')} + endif else " call Decho("no previous position") endif @@ -676,6 +699,7 @@ fun! s:NetrwOptionRestore(vt) " call Decho("(NetrwOptionRestore) filetype detect (ft=".&ft.")") filetype detect endif +" call Decho("(s:NetrwOptionRestore) 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." a:vt=".a:vt) " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun @@ -685,10 +709,12 @@ endfun " Use s:NetrwOptionRestore() to restore user settings fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) -" call Decho("win#".winnr()."'s ft=".&ft) +" call Decho("(s:NetrwSafeOptions) win#".winnr()."'s ft=".&ft) +" call Decho("(s:NetrwSafeOptions) 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) if exists("+acd") | setl noacd | endif setl noai setl noaw + setl nobl setl nobomb setl noci setl nocin @@ -700,7 +726,7 @@ fun! s:NetrwSafeOptions() setl cpo-=a setl cpo-=A setl fo=nroql2 - setl nohid + setl nohid setl noim setl isk+=@ isk+=* isk+=/ setl magic @@ -716,13 +742,14 @@ fun! s:NetrwSafeOptions() call s:NetrwCursor() " allow the user to override safe options -" call Decho("ft<".&ft."> ei=".&ei) +" call Decho("(s:NetrwSafeOptions) ft<".&ft."> ei=".&ei) if &ft == "netrw" -" call Decho("do any netrw FileType autocmds (doau FileType netrw)") +" call Decho("(s:NetrwSafeOptions) do any netrw FileType autocmds (doau FileType netrw)") sil! keepalt keepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) +" call Decho("(s:NetrwSafeOptions) fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) +" call Decho("(s:NetrwSafeOptions) 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 @@ -737,7 +764,7 @@ endfun " * If Hexplore or Vexplore, then this will override " g:netrw_winsize to specify the qty of rows or columns the " newly split window should have. -" dosplit==0: the window will be split iff the current file has been modified +" dosplit==0: the window will be split iff the current file has been modified and hidden not set " dosplit==1: the window will be split before running the local browser " style == 0: Explore style == 1: Explore! " == 2: Hexplore style == 3: Hexplore! @@ -747,9 +774,6 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - let b:netrw_curdir= substitute(b:netrw_curdir,'\','/','g') - endif " call Decho("(Explore) set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") endif let curdir = simplify(b:netrw_curdir) @@ -764,8 +788,10 @@ fun! netrw#Explore(indx,dosplit,style,...) sil! let keepregplus = @+ sil! let keepregslash= @/ - " if dosplit or file has been modified - if a:dosplit || &modified || a:style == 6 + " if dosplit + " -or- file has been modified AND file not hidden when abandoned + " -or- Texplore used + if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6 " call Decho("(Explore) case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") call s:SaveWinVars() let winsz= g:netrw_winsize @@ -1151,11 +1177,11 @@ fun! netrw#Explore(indx,dosplit,style,...) if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") " call Decho("(Explore) s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir - " only update match list if current directory isn't the same as before -" call Decho("(Explore) only update match list if current directory not the same as before") + " only update match list when current directory isn't the same as before +" call Decho("(Explore) only update match list when current directory not the same as before") let s:explore_prvdir = b:netrw_curdir let s:explore_match = "" - let dirlen = s:Strlen(b:netrw_curdir) + let dirlen = strlen(b:netrw_curdir) if b:netrw_curdir !~ '/$' let dirlen= dirlen + 1 endif @@ -1196,6 +1222,37 @@ fun! netrw#Explore(indx,dosplit,style,...) 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) + if exists("t:netrw_lexbufnr") + " close down netrw explorer window + let lexwinnr = bufwinnr(t:netrw_lexbufnr) + if lexwinnr != -1 + let curwin = winnr() + exe lexwinnr."wincmd w" + close + exe curwin."wincmd w" + endif + unlet t:netrw_lexbufnr + + else + " open netrw explorer window + exe "1wincmd w" + let keep_altv = g:netrw_altv + let g:netrw_altv = 0 + if a:0 > 0 && a:1 != "" + Vexplore a:1 + else + Vexplore . + endif + let g:netrw_altv = keep_altv + let t:netrw_lexbufnr = bufnr("%") + endif +" call Dret("netrw#Lexplore") +endfun + +" --------------------------------------------------------------------- " netrw#NetrwMakeTgt: make a target out of the directory name provided {{{2 fun! netrw#NetrwMakeTgt(dname) " call Dfunc("netrw#NetrwMakeTgt(dname<".a:dname.">)") @@ -1637,7 +1694,7 @@ fun! netrw#NetRead(mode,...) endif let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix - " Check if NetrwBrowse() should be handling this request + " Check whether or not 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 !~ '^https\=://' " call Decho("yes, choice matches '^.*[\/]$'") @@ -1659,7 +1716,7 @@ fun! netrw#NetRead(mode,...) " call Decho("read via rcp (method #1)") " ER: nothing done with g:netrw_uid yet? " ER: on Win2K" rcp machine[.user]:file tmpfile - " ER: if machine contains '.' adding .user is required (use $USERNAME) + " ER: when machine contains '.' adding .user is required (use $USERNAME) " ER: the tmpfile is full path: rcp sees C:\... as host C if s:netrw_has_nt_rcp == 1 if exists("g:netrw_uid") && ( g:netrw_uid != "" ) @@ -1978,7 +2035,7 @@ fun! netrw#NetWrite(...) range exe "sil keepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) elseif g:netrw_cygwin " write (selected portion of) file to temporary - let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','') + let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','') " call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) else @@ -1988,7 +2045,7 @@ fun! netrw#NetWrite(...) range endif if curbufname == "" - " if the file is [No Name], and one attempts to Nwrite it, the buffer takes + " when the file is [No Name], and one attempts to Nwrite it, the buffer takes " on the temporary file's name. Deletion of the temporary file during " cleanup then causes an error message. 0file! @@ -2006,7 +2063,7 @@ fun! netrw#NetWrite(...) range else exe "let choice= a:" . ichoice - " Reconstruct Choice if choice starts with '"' + " Reconstruct Choice when choice starts with '"' if match(choice,"?") == 0 echomsg 'NetWrite Usage:"' echomsg ':Nwrite machine:path uses rcp' @@ -2215,8 +2272,13 @@ fun! netrw#NetWrite(...) range " NetWrite: (http) NetWrite Method #5 {{{3 elseif b:netrw_method == 5 " call Decho("write via http (method #5)") - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"currently <netrw.vim> does not support writing using http:",16) + let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","") + if executable(curl) + let url= g:netrw_choice +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) ) + exe s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) + elseif !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) endif "......................................... @@ -2363,6 +2425,36 @@ fun! netrw#NetSource(...) " call Dret("netrw#NetSource") endfun +" --------------------------------------------------------------------- +" netrw#NetrwSetTreetop: resets the tree top to the current directory/specified directory {{{2 +fun! netrw#NetrwSetTreetop(...) +" call Dfunc("netrw#NetrwSetTreetop(".((a:0 > 0)? a:1 : "").") a:0=".a:0) + " clear out the current tree + if exists("w:netrw_treetop") + let inittreetop= w:netrw_treetop + unlet w:netrw_treetop + endif + if exists("w:netrw_treedict") + unlet w:netrw_treedict + endif + if a:1 == "" + let treedir= s:NetrwTreePath(inittreetop) + else + if isdirectory(a:1) + let treedir= a:1 + elseif exists("b:netrw_curdir") && isdirectory(b:netrw_curdir."/".a:1) + let treedir= b:netrw_curdir."/".a:1 + else + call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95) +" call Dret("netrw#NetrwSetTreetop") + return + endif + endif +" call Decho("treedir<".treedir.">") + sil! call netrw#LocalBrowseCheck(treedir) +" call Dret("netrw#NetrwSetTreetop") +endfun + " =========================================== " s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2 " readcmd == %r : replace buffer with newly read file @@ -2394,7 +2486,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " rename the current buffer to the temp file (ie. tfile) if g:netrw_cygwin - let tfile= substitute(a:tfile,'/cygdrive/\(.\)','\1:','') + let tfile= substitute(a:tfile,g:netrw_cygdrive.'/\(.\)','\1:','') else let tfile= a:tfile endif @@ -2435,11 +2527,18 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " call Decho("detect filetype of local version of remote file") let iskkeep= &l:isk setl isk-=/ + " filetype detect " COMBAK - trying filetype detect in NetrwOptionRestore Jan 24, 2013 let &l:isk= iskkeep " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 let line2 = line("$") + elseif !&ma + " attempting to read a file after the current line in the file, but the buffer is not modifiable + keepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) +" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") + return + elseif s:FileReadable(a:tfile) " read file after current line " call Decho("read file<".a:tfile."> after current line") @@ -2912,7 +3011,7 @@ fun! s:NetrwMaps(islocal) " local normal-mode maps nnoremap <buffer> <silent> a :call <SID>NetrwHide(1)<cr> nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(1)<cr> - nnoremap <buffer> <silent> c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir)<cr> + nnoremap <buffer> <silent> c :exe "keepj lcd ".fnameescape(b:netrw_curdir)<cr> nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr> nnoremap <buffer> <silent> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr> @@ -3029,22 +3128,22 @@ fun! s:NetrwMaps(islocal) endif let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 - nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse - nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> - nmap <buffer> <s-rightdrag> <Plug>NetrwRightdrag - nno <buffer> <silent> <Plug>NetrwRightdrag <leftmouse>:call <SID>NetrwRightdrag(1)<cr> - nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse - nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> - nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse - nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> - nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse - nmap <buffer> <silent> <Plug>Netrw2Leftmouse - - imap <buffer> <leftmouse> <Plug>ILeftmouse - ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> - imap <buffer> <middlemouse> <Plug>IMiddlemouse - ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> - imap <buffer> <s-leftmouse> <Plug>ISLeftmouse - ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> + nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> + nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse + nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> + nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse + nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr> + nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag + nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr> + nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse + nmap <buffer> <silent> <Plug>Netrw2Leftmouse - + imap <buffer> <leftmouse> <Plug>ILeftmouse + ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> + imap <buffer> <middlemouse> <Plug>IMiddlemouse + ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> + imap <buffer> <s-leftmouse> <Plug>ISLeftmouse + ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' @@ -3052,15 +3151,15 @@ fun! s:NetrwMaps(islocal) exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetrwMakeDir("")<cr>' + exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr>' exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' - exe 'inoremap <buffer> <silent> <Leader>m <c-o>:call <SID>NetrwMakeDir("")<cr>' - nnoremap <buffer> <F1> :he netrw-quickhelp<cr> + exe 'inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("")<cr>' + nnoremap <buffer> <F1> :he netrw-quickhelp<cr> else " remote " call Decho("(NetrwMaps) make remote maps") @@ -3181,10 +3280,12 @@ fun! s:NetrwMaps(islocal) nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr> nmap <buffer> <leftdrag> <Plug>NetrwLeftdrag nno <buffer> <silent> <Plug>NetrwLeftdrag :call <SID>NetrwLeftdrag(0)<cr> + nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse + nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr> + nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag + nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr> nmap <middlemouse> <Plug>NetrwMiddlemouse nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr> - nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse - nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse nmap <buffer> <silent> <Plug>Netrw2Leftmouse - imap <buffer> <leftmouse> <Plug>ILeftmouse @@ -3344,7 +3445,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) " call Decho("(NetrwBookHistHandler) setl nomod") " call Decho("(NetrwBookHistHandler) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif -" " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_ |