| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | " netrwPlugin.vim: Handles file transfer and remote directory listing across a network | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  | "            PLUGIN SECTION | 
					
						
							| 
									
										
										
										
											2010-07-27 22:50:36 +02:00
										 |  |  | " Date:		Jul 27, 2010 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  | " Maintainer:	Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim | 
					
						
							| 
									
										
										
										
											2008-08-06 17:06:04 +00:00
										 |  |  | " Copyright:    Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | "               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 | 
					
						
							|  |  |  | "               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. | 
					
						
							|  |  |  | " | 
					
						
							|  |  |  | "  But be doers of the Word, and not only hearers, deluding your own selves {{{1 | 
					
						
							|  |  |  | "  (James 1:22 RSV) | 
					
						
							|  |  |  | " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | 
					
						
							|  |  |  | " Load Once: {{{1 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  | if &cp || exists("g:loaded_netrwPlugin") | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  |  finish | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2010-07-28 18:17:41 +02:00
										 |  |  | let g:loaded_netrwPlugin = "v140" | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | if v:version < 702 | 
					
						
							|  |  |  |  echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None | 
					
						
							| 
									
										
										
										
											2005-10-12 20:52:20 +00:00
										 |  |  |  finish | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | let s:keepcpo = &cpo | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | set cpo&vim | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " --------------------------------------------------------------------- | 
					
						
							|  |  |  | " Public Interface: {{{1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Local Browsing: {{{2 | 
					
						
							|  |  |  | augroup FileExplorer | 
					
						
							|  |  |  |  au! | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  |  au BufEnter * silent! call s:LocalBrowse(expand("<amatch>")) | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  |  au VimEnter * silent! call s:VimEnter(expand("<amatch>")) | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  |  if has("win32") || has("win95") || has("win64") || has("win16") | 
					
						
							|  |  |  |   au BufEnter .* silent! call s:LocalBrowse(expand("<amatch>")) | 
					
						
							|  |  |  |  endif | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | augroup END | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Network Browsing Reading Writing: {{{2 | 
					
						
							|  |  |  | augroup Network | 
					
						
							|  |  |  |  au! | 
					
						
							|  |  |  |  if has("win32") || has("win95") || has("win64") || has("win16") | 
					
						
							| 
									
										
										
										
											2008-08-06 17:06:04 +00:00
										 |  |  |   au BufReadCmd  file://*		exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("<amatch>")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',""))|exe "bwipe ".fnameescape(expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand("<amatch>"))) | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  |  else | 
					
						
							| 
									
										
										
										
											2008-08-06 17:06:04 +00:00
										 |  |  |   au BufReadCmd  file://*		exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("<amatch>")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',""))|exe "bwipe ".fnameescape(expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand("<amatch>"))) | 
					
						
							|  |  |  |   au BufReadCmd  file://localhost/*	exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("<amatch>")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("<amatch>")),'file://localhost/\(.*\)','\1',""))|exe "bwipe ".fnameescape(substitute(expand("<amatch>"),'file://\(\k\+@\)\=','',''))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand("<amatch>"))) | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  |  endif | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  au BufReadCmd   ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://*	exe "silent doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(expand("<amatch>")) | 
					
						
							|  |  |  |  au FileReadCmd  ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://*	exe "silent doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "silent doau FileReadPost ".fnameescape(expand("<amatch>")) | 
					
						
							| 
									
										
										
										
											2008-08-06 17:06:04 +00:00
										 |  |  |  au BufWriteCmd  ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://*		exe "silent doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau BufWritePost ".fnameescape(expand("<amatch>")) | 
					
						
							|  |  |  |  au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://*		exe "silent doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau FileWritePost ".fnameescape(expand("<amatch>")) | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  |  try | 
					
						
							| 
									
										
										
										
											2008-08-06 17:06:04 +00:00
										 |  |  |   au SourceCmd   ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://*	exe 'Nsource '.fnameescape(expand("<amatch>")) | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  |  catch /^Vim\%((\a\+)\)\=:E216/ | 
					
						
							| 
									
										
										
										
											2008-08-06 17:06:04 +00:00
										 |  |  |   au SourcePre   ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://*	exe 'Nsource '.fnameescape(expand("<amatch>")) | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  |  endtry | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | augroup END | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Commands: :Nread, :Nwrite, :NetUserPass {{{2 | 
					
						
							| 
									
										
										
										
											2008-06-24 20:19:36 +00:00
										 |  |  | com! -count=1 -nargs=*	Nread		call netrw#NetrwSavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#NetrwRestorePosn() | 
					
						
							|  |  |  | com! -range=% -nargs=*	Nwrite		call netrw#NetrwSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetrwRestorePosn() | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | com! -nargs=*		NetUserPass	call NetUserPass(<f-args>) | 
					
						
							| 
									
										
										
										
											2008-06-24 20:19:36 +00:00
										 |  |  | com! -nargs=*	        Nsource		call netrw#NetrwSavePosn()<bar>call netrw#NetSource(<f-args>)<bar>call netrw#NetrwRestorePosn() | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2 | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  | com! -nargs=* -bar -bang -count=0 -complete=dir	Explore		call netrw#Explore(<count>,0,0+<bang>0,<q-args>) | 
					
						
							|  |  |  | com! -nargs=* -bar -bang -count=0 -complete=dir	Sexplore	call netrw#Explore(<count>,1,0+<bang>0,<q-args>) | 
					
						
							|  |  |  | com! -nargs=* -bar -bang -count=0 -complete=dir	Hexplore	call netrw#Explore(<count>,1,2+<bang>0,<q-args>) | 
					
						
							|  |  |  | com! -nargs=* -bar -bang -count=0 -complete=dir	Vexplore	call netrw#Explore(<count>,1,4+<bang>0,<q-args>) | 
					
						
							|  |  |  | com! -nargs=* -bar       -count=0 -complete=dir	Texplore	call netrw#Explore(<count>,0,6        ,<q-args>) | 
					
						
							|  |  |  | com! -nargs=* -bar -bang			Nexplore	call netrw#Explore(-1,0,0,<q-args>) | 
					
						
							|  |  |  | com! -nargs=* -bar -bang			Pexplore	call netrw#Explore(-2,0,0,<q-args>) | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Commands: NetrwSettings {{{2 | 
					
						
							| 
									
										
										
										
											2008-06-24 20:19:36 +00:00
										 |  |  | com! -nargs=0	NetrwSettings	call netrwSettings#NetrwSettings() | 
					
						
							|  |  |  | com! -bang	NetrwClean	call netrw#NetrwClean(<bang>0) | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | " Maps: | 
					
						
							| 
									
										
										
										
											2010-07-27 22:50:36 +02:00
										 |  |  | if !exists("g:netrw_nogx") && maparg('gx','n') == "" | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  |  if !hasmapto('<Plug>NetrwBrowseX') | 
					
						
							|  |  |  |   nmap <unique> gx <Plug>NetrwBrowseX | 
					
						
							|  |  |  |  endif | 
					
						
							| 
									
										
										
										
											2008-06-24 20:19:36 +00:00
										 |  |  |  nno <silent> <Plug>NetrwBrowseX :call netrw#NetrwBrowseX(expand("<cWORD>"),0)<cr> | 
					
						
							| 
									
										
										
										
											2006-02-01 21:47:16 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | " --------------------------------------------------------------------- | 
					
						
							|  |  |  | " LocalBrowse: {{{2 | 
					
						
							|  |  |  | fun! s:LocalBrowse(dirname) | 
					
						
							|  |  |  |   " unfortunate interaction -- debugging calls can't be used here; | 
					
						
							|  |  |  |   " the BufEnter event causes triggering when attempts to write to | 
					
						
							|  |  |  |   " the DBG buffer are made. | 
					
						
							| 
									
										
										
										
											2007-05-05 17:10:09 +00:00
										 |  |  | "  echomsg "dirname<".a:dirname.">" | 
					
						
							|  |  |  |   if has("amiga") | 
					
						
							|  |  |  |    " The check against '' is made for the Amiga, where the empty | 
					
						
							|  |  |  |    " string is the current directory and not checking would break | 
					
						
							|  |  |  |    " things such as the help command. | 
					
						
							|  |  |  |    if a:dirname != '' && isdirectory(a:dirname) | 
					
						
							|  |  |  |     silent! call netrw#LocalBrowseCheck(a:dirname) | 
					
						
							|  |  |  |    endif | 
					
						
							|  |  |  |   elseif isdirectory(a:dirname) | 
					
						
							|  |  |  | "   echomsg "dirname<".dirname."> isdir" | 
					
						
							|  |  |  |    silent! call netrw#LocalBrowseCheck(a:dirname) | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  |   endif | 
					
						
							|  |  |  |   " not a directory, ignore it | 
					
						
							|  |  |  | endfun | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | " --------------------------------------------------------------------- | 
					
						
							|  |  |  | " s:VimEnter: {{{2 | 
					
						
							|  |  |  | fun! s:VimEnter(dirname) | 
					
						
							| 
									
										
										
										
											2010-07-28 18:17:41 +02:00
										 |  |  |   let curwin= winnr() | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  |   windo if a:dirname != expand("%")|call s:LocalBrowse(expand("%:p"))|endif | 
					
						
							| 
									
										
										
										
											2010-07-28 18:17:41 +02:00
										 |  |  |   exe curwin."wincmd w" | 
					
						
							| 
									
										
										
										
											2010-05-14 23:24:24 +02:00
										 |  |  | endfun | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  | " --------------------------------------------------------------------- | 
					
						
							|  |  |  | " NetrwStatusLine: {{{1 | 
					
						
							|  |  |  | fun! NetrwStatusLine() | 
					
						
							| 
									
										
										
										
											2006-03-14 22:51:38 +00:00
										 |  |  | "  let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".") | 
					
						
							|  |  |  |   if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") | 
					
						
							| 
									
										
										
										
											2005-09-29 18:26:07 +00:00
										 |  |  |    let &stl= s:netrw_explore_stl | 
					
						
							|  |  |  |    if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif | 
					
						
							|  |  |  |    if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif | 
					
						
							|  |  |  |    return "" | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  |    return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  | endfun | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " ------------------------------------------------------------------------ | 
					
						
							|  |  |  | " NetUserPass: set username and password for subsequent ftp transfer {{{1 | 
					
						
							|  |  |  | "   Usage:  :call NetUserPass()			-- will prompt for userid and password | 
					
						
							|  |  |  | "	    :call NetUserPass("uid")		-- will prompt for password | 
					
						
							|  |  |  | "	    :call NetUserPass("uid","password") -- sets global userid and password | 
					
						
							|  |  |  | fun! NetUserPass(...) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  " get/set userid | 
					
						
							|  |  |  |  if a:0 == 0 | 
					
						
							|  |  |  | "  call Dfunc("NetUserPass(a:0<".a:0.">)") | 
					
						
							|  |  |  |   if !exists("g:netrw_uid") || g:netrw_uid == "" | 
					
						
							|  |  |  |    " via prompt | 
					
						
							|  |  |  |    let g:netrw_uid= input('Enter username: ') | 
					
						
							|  |  |  |   endif | 
					
						
							|  |  |  |  else	" from command line | 
					
						
							|  |  |  | "  call Dfunc("NetUserPass(a:1<".a:1.">) {") | 
					
						
							|  |  |  |   let g:netrw_uid= a:1 | 
					
						
							|  |  |  |  endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  " get password | 
					
						
							|  |  |  |  if a:0 <= 1 " via prompt | 
					
						
							|  |  |  | "  call Decho("a:0=".a:0." case <=1:") | 
					
						
							|  |  |  |   let g:netrw_passwd= inputsecret("Enter Password: ") | 
					
						
							|  |  |  |  else " from command line | 
					
						
							|  |  |  | "  call Decho("a:0=".a:0." case >1: a:2<".a:2.">") | 
					
						
							|  |  |  |   let g:netrw_passwd=a:2 | 
					
						
							|  |  |  |  endif | 
					
						
							|  |  |  | "  call Dret("NetUserPass") | 
					
						
							|  |  |  | endfun | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " ------------------------------------------------------------------------ | 
					
						
							|  |  |  | " Modelines And Restoration: {{{1 | 
					
						
							|  |  |  | let &cpo= s:keepcpo | 
					
						
							|  |  |  | unlet s:keepcpo | 
					
						
							|  |  |  | " vim:ts=8 fdm=marker |