⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.124
Server IP:
50.28.103.30
Server:
Linux host.jcukjv-lwsites.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
Server Software:
nginx/1.28.0
PHP Version:
8.3.12
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
1856814
/
root
/
usr
/
share
/
vim
/
vim80
/
autoload
/
Edit File: netrw.vim
" netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION " Date: Apr 20, 2016 " Version: 156 " Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 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, " netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided " *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. "redraw!|call DechoSep()|call inputsave()|call input("Press
to continue")|call inputrestore() " " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Load Once: {{{1 if &cp || exists("g:loaded_netrw") finish endif " netrw requires vim having patch 213; netrw will benefit from vim's having patch#656, too if v:version < 704 || !has("patch213") if !exists("s:needpatch213") unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" endif let s:needpatch213= 1 finish endif let g:loaded_netrw = "v156" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 let s:ERROR = 2 endif let s:keepcpo= &cpo setl cpo&vim "let g:dechofuncname= 1 "DechoRemOn "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("
")) " ====================== " Netrw Variables: {{{1 " ====================== " --------------------------------------------------------------------- " netrw#ErrorMsg: {{{2 " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR " 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) " Jan 19, 2016 : max errnum currently is 103 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) if a:level < g:netrw_errorlvl " call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g:netrw_errorlvl=".g:netrw_errorlvl) return endif if a:level == 1 let level= "**warning** (netrw) " elseif a:level == 2 let level= "**error** (netrw) " else let level= "**note** (netrw) " endif " call Decho("level=".level,'~'.expand("
")) if g:netrw_use_errorwindow " (default) netrw creates a one-line window to show error/warning " messages (reliably displayed) " record current window number let s:winBeforeErr= winnr() " call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("
")) " getting messages out reliably is just plain difficult! " This attempt splits the current window, creating a one line window. if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 " call Decho("write to NetrwMessage buffer",'~'.expand("
")) exe bufwinnr("NetrwMessage")."wincmd w" " call Decho("setl ma noro",'~'.expand("
")) setl ma noro 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",'~'.expand("
")) bo 1split sil! call s:NetrwEnew() sil! NetrwKeepj call s:NetrwSafeOptions() setl bt=nofile NetrwKeepj file NetrwMessage " call Decho("setl ma noro",'~'.expand("
")) setl ma noro 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(),'~'.expand("
")) if &fo !~ '[ta]' syn clear syn match netrwMesgNote "^\*\*note\*\*" syn match netrwMesgWarning "^\*\*warning\*\*" syn match netrwMesgError "^\*\*error\*\*" hi link netrwMesgWarning WarningMsg hi link netrwMesgError Error endif " call Decho("setl noma ro bh=wipe",'~'.expand("
")) setl ro nomod noma bh=wipe else " (optional) netrw will show messages using echomsg. Even if the " message doesn't appear, at least it'll be recallable via :messages " redraw! if a:level == s:WARNING echohl WarningMsg elseif a:level == s:ERROR echohl Error endif if type(a:msg) == 3 for msg in a:msg unsilent echomsg level.msg endfor else unsilent echomsg level.a:msg endif " call Decho("echomsg ***netrw*** ".a:msg,'~'.expand("
")) echohl None endif " call Dret("netrw#ErrorMsg") endfun " --------------------------------------------------------------------- " 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,'~'.expand("
")) if !exists(a:varname) if type(a:value) == 0 exe "let ".a:varname."=".a:value elseif type(a:value) == 1 && a:value =~ '^[{[]' exe "let ".a:varname."=".a:value elseif type(a:value) == 1 exe "let ".a:varname."="."'".a:value."'" else exe "let ".a:varname."=".a:value endif endif endfun " --------------------------------------------------------------------- " Netrw Constants: {{{2 call s:NetrwInit("g:netrw_dirhist_cnt",0) if !exists("s:LONGLIST") call s:NetrwInit("s:THINLIST",0) call s:NetrwInit("s:LONGLIST",1) call s:NetrwInit("s:WIDELIST",2) call s:NetrwInit("s:TREELIST",3) call s:NetrwInit("s:MAXLIST" ,4) endif " --------------------------------------------------------------------- " Default values for netrw's global protocol variables {{{2 call s:NetrwInit("g:netrw_use_errorwindow",1) if !exists("g:netrw_dav_cmd") if executable("cadaver") let g:netrw_dav_cmd = "cadaver" elseif executable("curl") let g:netrw_dav_cmd = "curl" else let g:netrw_dav_cmd = "" endif endif if !exists("g:netrw_fetch_cmd") if executable("fetch") let g:netrw_fetch_cmd = "fetch -o" else 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 let s:netrw_ftp_cmd= g:netrw_ftp_cmd if !exists("g:netrw_ftp_options") let g:netrw_ftp_options= "-i -n" endif if !exists("g:netrw_http_cmd") if executable("elinks") let g:netrw_http_cmd = "elinks" call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("links") let g:netrw_http_cmd = "links" call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("curl") let g:netrw_http_cmd = "curl" call s:NetrwInit("g:netrw_http_xcmd","-o") elseif executable("wget") let g:netrw_http_cmd = "wget" call s:NetrwInit("g:netrw_http_xcmd","-q -O") elseif executable("fetch") let g:netrw_http_cmd = "fetch" call s:NetrwInit("g:netrw_http_xcmd","-o") else let 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") if executable("scp") call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") elseif executable("pscp") if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable('c:\private.ppk') call s:NetrwInit("g:netrw_scp_cmd", 'pscp -i c:\private.ppk') else call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q') endif else call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") endif endif call s:NetrwInit("g:netrw_sftp_cmd" , "sftp") call s:NetrwInit("g:netrw_ssh_cmd" , "ssh") if (has("win32") || has("win95") || has("win64") || has("win16")) \ && exists("g:netrw_use_nt_rcp") \ && g:netrw_use_nt_rcp \ && executable( $SystemRoot .'/system32/rcp.exe') let s:netrw_has_nt_rcp = 1 let s:netrw_rcpmode = '-b' else let s:netrw_has_nt_rcp = 0 let s:netrw_rcpmode = '' 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 has("win32unix") && &shell =~ '\%(\
\|\
\)\%(\.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 call s:NetrwInit("g:netrw_alto" , &sb) call s:NetrwInit("g:netrw_altv" , &spr) call s:NetrwInit("g:netrw_banner" , 1) call s:NetrwInit("g:netrw_browse_split", 0) call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro nornu") call s:NetrwInit("g:netrw_chgwin" , -1) call s:NetrwInit("g:netrw_compress" , "gzip") call s:NetrwInit("g:netrw_ctags" , "ctags") if exists("g:netrw_cursorline") && !exists("g:netrw_cursor") call netrw#ErrorMsg(s:NOTE,'g:netrw_cursorline is deprecated; use g:netrw_cursor instead',77) let g:netrw_cursor= g:netrw_cursorline 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) call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }') call s:NetrwInit("g:netrw_dirhistmax" , 10) call s:NetrwInit("g:netrw_errorlvl" , s:NOTE) call s:NetrwInit("g:netrw_fastbrowse" , 1) call s:NetrwInit("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$') if !exists("g:netrw_ftp_list_cmd") if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) let g:netrw_ftp_list_cmd = "ls -lF" let g:netrw_ftp_timelist_cmd = "ls -tlF" let g:netrw_ftp_sizelist_cmd = "ls -slF" else let g:netrw_ftp_list_cmd = "dir" let g:netrw_ftp_timelist_cmd = "dir" let g:netrw_ftp_sizelist_cmd = "dir" endif endif call s:NetrwInit("g:netrw_ftpmode",'binary') " Default values - h-lh ---------- {{{3 call s:NetrwInit("g:netrw_hide",1) if !exists("g:netrw_ignorenetrc") if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$' let g:netrw_ignorenetrc= 1 else let g:netrw_ignorenetrc= 0 endif 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 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 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",'~'.expand("
")) let g:netrw_list_cmd= "" endif endif call s:NetrwInit("g:netrw_list_hide","") " Default values - lh-lz ---------- {{{3 if exists("g:netrw_local_copycmd") let g:netrw_localcopycmd= g:netrw_local_copycmd call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84) endif if !exists("g:netrw_localcmdshell") let g:netrw_localcmdshell= "" endif 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= expand("$COMSPEC")." /c copy" endif elseif has("unix") || has("macunix") let g:netrw_localcopycmd= "cp" else 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) endif if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin call s:NetrwInit("g:netrw_localmkdir","mkdir") else let g:netrw_localmkdir= expand("$COMSPEC")." /c mkdir" endif else call s:NetrwInit("g:netrw_localmkdir","mkdir") endif call s:NetrwInit("g:netrw_remote_mkdir","mkdir") if exists("g:netrw_local_movecmd") let g:netrw_localmovecmd= g:netrw_local_movecmd call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88) 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= expand("$COMSPEC")." /c move" endif elseif has("unix") || has("macunix") let g:netrw_localmovecmd= "mv" else let g:netrw_localmovecmd= "" endif endif if v:version < 704 || !has("patch1109") if exists("g:netrw_local_rmdir") let g:netrw_localrmdir= g:netrw_local_rmdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) endif if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin call s:NetrwInit("g:netrw_localrmdir","rmdir") else let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" endif else call s:NetrwInit("g:netrw_localrmdir","rmdir") endif endif call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) " sanity checks if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST let g:netrw_liststyle= s:THINLIST endif 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 call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') call s:NetrwInit("g:netrw_maxfilenamelen", 32) call s:NetrwInit("g:netrw_menu" , 1) call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh]')) call s:NetrwInit("g:netrw_retmap" , 0) if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") elseif has("win32") || has("win95") || has("win64") || has("win16") call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM") else call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") 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") call s:NetrwInit("g:netrw_rmdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir") call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f ") " 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: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")? "\
" : "\
") 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 ...) if !exists("g:netrw_sort_sequence") if has("unix") let g:netrw_sort_sequence= '[\/]$,\
,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' else let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' endif endif call s:NetrwInit("g:netrw_special_syntax" , 0) call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') call s:NetrwInit("g:netrw_suppress_gx_mesg", 1) call s:NetrwInit("g:netrw_use_noswf" , 1) call s:NetrwInit("g:netrw_sizestyle" ,"b") " Default values - t-w ---------- {{{3 call s:NetrwInit("g:netrw_timefmt","%c") if !exists("g:netrw_xstrlen") if exists("g:Align_xstrlen") let g:netrw_xstrlen= g:Align_xstrlen elseif exists("g:drawit_xstrlen") let g:netrw_xstrlen= g:drawit_xstrlen elseif &enc == "latin1" || !has("multi_byte") let g:netrw_xstrlen= 0 else let g:netrw_xstrlen= 1 endif endif call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") call s:NetrwInit("g:netrw_win95ftp",1) call s:NetrwInit("g:netrw_winsize",50) call s:NetrwInit("g:netrw_wiw",1) if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 call s:NetrwInit("g:netrw_fname_escape",' ?&;%') if has("win32") || has("win95") || has("win64") || has("win16") call s:NetrwInit("g:netrw_glob_escape",'*?`{[]$') else call s:NetrwInit("g:netrw_glob_escape",'*[]?`{~$\') endif call s:NetrwInit("g:netrw_menu_escape",'.&? \') call s:NetrwInit("g:netrw_tmpfile_escape",' &;') call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\
\"") if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4') let s:treedepthstring= "│ " else let s:treedepthstring= "| " endif call s:NetrwInit("s:netrw_nbcd",'{}') " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so " files read by network transfer aren't appropriately highlighted. "let g:decho_bufenter = 1 "Decho " ====================== " Netrw Initialization: {{{1 " ====================== if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") " call Decho("installed beval events",'~'.expand("
")) let &l:bexpr = "netrw#BalloonHelp()" au FileType netrw setl 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","~".expand("
")) | endif " if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval","~".expand("
")) | endif " if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists","~".expand("
")) | endif " if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists","~".expand("
")) | endif " if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting","~".expand("
")) | endif " if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists","~".expand("
")) | endif endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif if g:netrw_keepj =~# "keepj" com! -nargs=* NetrwKeepj keepj
else let g:netrw_keepj= "" com! -nargs=* NetrwKeepj
endif " ============================== " Netrw Utility Functions: {{{1 " ============================== " --------------------------------------------------------------------- " netrw#BalloonHelp: {{{2 if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval") " call Decho("loading netrw#BalloonHelp()",'~'.expand("
")) fun! netrw#BalloonHelp() 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 = "
: 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, file size, extension 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
" 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 -","~".expand("
"))|endif " if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval","~".expand("
")) |endif " if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled","~".expand("
")) |endif " if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a","~".expand("
")) |endif " if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists","~".expand("
")) |endif endif " ------------------------------------------------------------------------ " netrw#Explore: launch the local browser in the directory of the current file {{{2 " indx: == -1: Nexplore " == -2: Pexplore " == +: this is overloaded: " * If Nexplore/Pexplore is in use, then this refers to the " indx'th item in the w:netrw_explore_list[] of items which " matched the */pattern **/pattern *//pattern **//pattern " * 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 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! " == 4: Vexplore style == 5: Vexplore! " == 6: Texplore 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("%")." ft=".&ft) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("
")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("
")) endif " record current file for Rexplore's benefit if &ft != "netrw" let w:netrw_rexfile= expand("%:p") endif " record current directory let curdir = simplify(b:netrw_curdir) let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) let curdir= substitute(curdir,'\','/','g') endif " call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("
")) " using completion, directories with spaces in their names (thanks, Bill Gates, for a truly dumb idea) " will end up with backslashes here. Solution: strip off backslashes that precede white space and " try Explore again. if a:0 > 0 " call Decho('considering retry: a:1<'.a:1.'>: '. \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. \ ((filereadable(s:NetrwFile(a:1)))? 'is readable' : 'is not readable').', '. \ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory', \ '~'.expand("
")) if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1)) " call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("
")) call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g')) " call Dret("netrw#Explore : returning from retry") return " else " Decho " call Decho("retry not needed",'~'.expand("
")) endif endif " save registers if has("clipboard") sil! let keepregstar = @* sil! let keepregplus = @+ endif sil! let keepregslash= @/ " 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("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("
")) call s:SaveWinVars() let winsz= g:netrw_winsize if a:indx > 0 let winsz= a:indx endif if a:style == 0 " Explore, Sexplore " call Decho("style=0: Explore or Sexplore",'~'.expand("
")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "noswapfile ".winsz."wincmd s" " call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("
")) elseif a:style == 1 "Explore!, Sexplore! " call Decho("style=1: Explore! or Sexplore!",'~'.expand("
")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile ".winsz."wincmd v" " call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("
")) elseif a:style == 2 " Hexplore " call Decho("style=2: Hexplore",'~'.expand("
")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile bel ".winsz."wincmd s" " call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("
")) elseif a:style == 3 " Hexplore! " call Decho("style=3: Hexplore!",'~'.expand("
")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile abo ".winsz."wincmd s" " call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("
")) elseif a:style == 4 " Vexplore " call Decho("style=4: Vexplore",'~'.expand("
")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile lefta ".winsz."wincmd v" " call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("
")) elseif a:style == 5 " Vexplore! " call Decho("style=5: Vexplore!",'~'.expand("
")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile rightb ".winsz."wincmd v" " call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("
")) elseif a:style == 6 " Texplore call s:SaveBufVars() " call Decho("style = 6: Texplore",'~'.expand("
")) exe "keepalt tabnew ".fnameescape(curdir) " call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("
")) call s:RestoreBufVars() endif call s:RestoreWinVars() " else " Decho " call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("
")) endif NetrwKeepj norm! 0 if a:0 > 0 " call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">",'~'.expand("
")) if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) " call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin",'~'.expand("
")) let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) " call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)",'~'.expand("
")) elseif a:1 == '.' " call Decho("..case a:1<".a:1.">: matches .",'~'.expand("
")) let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) if dirname !~ '/$' let dirname= dirname."/" endif " call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")",'~'.expand("
")) elseif a:1 =~ '\$' " call Decho("..case a:1<".a:1.">: matches ending $",'~'.expand("
")) let dirname= simplify(expand(a:1)) " call Decho("..using user-specified dirname<".dirname."> with $env-var",'~'.expand("
")) elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://' " call Decho("..case a:1<".a:1.">: other, not pattern or filepattern",'~'.expand("
")) let dirname= simplify(a:1) " call Decho("..using user-specified dirname<".dirname.">",'~'.expand("
")) else " call Decho("..case a:1: pattern or filepattern",'~'.expand("
")) let dirname= a:1 endif else " clear explore " call Decho("case a:0=".a:0.": clearing Explore list",'~'.expand("
")) call s:NetrwClearExplore() " call Dret("netrw#Explore : cleared list") return endif " call Decho("dirname<".dirname.">",'~'.expand("
")) if dirname =~ '\.\./\=$' let dirname= simplify(fnamemodify(dirname,':p:h')) elseif dirname =~ '\.\.' || dirname == '.' let dirname= simplify(fnamemodify(dirname,':p')) endif " call Decho("dirname<".dirname."> (after simplify)",'~'.expand("
")) if dirname =~ '^\*//' " starpat=1: Explore *//pattern (current directory only search for files containing pattern) " call Decho("case starpat=1: Explore *//pattern",'~'.expand("
")) let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') let starpat= 1 " call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("
")) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif dirname =~ '^\*\*//' " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) " call Decho("case starpat=2: Explore **//pattern",'~'.expand("
")) let pattern= substitute(dirname,'^\*\*//','','') let starpat= 2 " call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("
")) elseif dirname =~ '/\*\*/' " handle .../**/.../filepat " call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("
")) let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) let b:netrw_curdir = prefixdir else let b:netrw_curdir= getcwd().'/'.prefixdir endif let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') let starpat= 4 " call Decho("..pwd<".getcwd()."> dirname<".dirname.">",'~'.expand("
")) " call Decho("..case Explore ../**/../filepat (starpat=".starpat.")",'~'.expand("
")) elseif dirname =~ '^\*/' " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat) let starpat= 3 " call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")",'~'.expand("
")) elseif dirname=~ '^\*\*/' " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) let starpat= 4 " call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")",'~'.expand("
")) else let starpat= 0 " call Decho("case starpat=0: default",'~'.expand("
")) endif if starpat == 0 && a:indx >= 0 " [Explore Hexplore Vexplore Sexplore] [dirname] " call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore",'~'.expand("
")) if dirname == "" let dirname= curfiledir " call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("
")) endif if dirname =~# '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) else if dirname == "" let dirname= getcwd() elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', " depending on whether backslashes have been converted to forward slashes by earlier code). if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+' let dirname= b:netrw_curdir."/".dirname endif elseif dirname !~ '^/' let dirname= b:netrw_curdir."/".dirname endif " call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)",'~'.expand("
")) call netrw#LocalBrowseCheck(dirname) " call Decho(" modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("
")) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("
")) endif if exists("w:netrw_bannercnt") " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. " If one wants to return the same place in the netrw window, use :Rex instead. exe w:netrw_bannercnt endif " call Decho("curdir<".curdir.">",'~'.expand("
")) " --------------------------------------------------------------------- " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest " if has("win32") || has("win95") || has("win64") || has("win16") " NetrwKeepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') " else " NetrwKeepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') " endif " --------------------------------------------------------------------- " starpat=1: Explore *//pattern (current directory only search for files containing pattern) " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) elseif a:indx <= 0 " Nexplore, Pexplore, Explore: handle starpat " call Decho("case a:indx<=0: Nexplore, Pexplore,
,
starpat=".starpat." a:indx=".a:indx,'~'.expand("
")) if !mapcheck("
","n") && !mapcheck("
","n") && exists("b:netrw_curdir") " call Decho("..set up
and
maps",'~'.expand("
")) let s:didstarstar= 1 nnoremap
:Pexplore
nnoremap
:Nexplore
endif if has("path_extra") " call Decho("..starpat=".starpat.": has +path_extra",'~'.expand("
")) if !exists("w:netrw_explore_indx") let w:netrw_explore_indx= 0 endif let indx = a:indx " call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]",'~'.expand("
")) if indx == -1 " Nexplore " call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("
")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or
improperly; see help for netrw-starstar",40) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore") return endif let indx= w:netrw_explore_indx if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] " call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("
")) while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] let indx= indx + 1 " call Decho("....indx=".indx." (Nexplore while loop)",'~'.expand("
")) endwhile if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif " call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("
")) elseif indx == -2 " Pexplore " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("
")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or
improperly; see help for netrw-starstar",41) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore") return endif let indx= w:netrw_explore_indx if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] " call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("
")) while indx >= 0 && curfile == w:netrw_explore_list[indx] let indx= indx - 1 " call Decho("....indx=".indx." (Pexplore while loop)",'~'.expand("
")) endwhile if indx < 0 | let indx= 0 | endif " call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("
")) else " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore " call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")",'~'.expand("
")) NetrwKeepj keepalt call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() endif " call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("
")) " switch on starpat to build the w:netrw_explore_list of files if starpat == 1 " starpat=1: Explore *//pattern (current directory only search for files containing pattern) " call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls,'~'.expand("
")) " call Decho("....pattern<".pattern.">",'~'.expand("
")) try 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.">") return endtry let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif starpat == 2 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) " call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)",'~'.expand("
")) " call Decho("....pattern<".pattern.">",'~'.expand("
")) try 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 if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : no files matched pattern") return endtry let s:netrw_curdir = b:netrw_curdir let w:netrw_explore_list = getqflist() let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif starpat == 3 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) " call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls,'~'.expand("
")) let filepat= substitute(dirname,'^\*/','','') let filepat= substitute(filepat,'^[%#<]','\\&','') " call Decho("....b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("
")) " call Decho("....filepat<".filepat.">",'~'.expand("
")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif elseif starpat == 4 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) " call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls,'~'.expand("
")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif endif " switch on starpat to build w:netrw_explore_list let w:netrw_explore_listlen = len(w:netrw_explore_list) " call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">",'~'.expand("
")) " call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen,'~'.expand("
")) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : no files matched") return endif endif " if indx ... endif " NetrwStatusLine support - for exploring support let w:netrw_explore_indx= indx " call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen,'~'.expand("
")) " wrap the indx around, but issue a note if indx >= w:netrw_explore_listlen || indx < 0 " call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")",'~'.expand("
")) let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif exe "let dirfile= w:netrw_explore_list[".indx."]" " call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">",'~'.expand("
")) let newdir= substitute(dirfile,'/[^/]*$','','e') " call Decho("....newdir<".newdir.">",'~'.expand("
")) " call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)",'~'.expand("
")) call netrw#LocalBrowseCheck(newdir) if !exists("w:netrw_liststyle") let w:netrw_liststyle= g:netrw_liststyle endif if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST keepalt NetrwKeepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") else 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 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,'~'.expand("
")) else " call Decho("..your vim does not have +path_extra",'~'.expand("
")) if !exists("g:netrw_quiet") 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 sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : missing +path_extra") return endif else " call Decho("..default case: Explore newdir<".dirname.">",'~'.expand("
")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' sil! unlet w:netrw_treedict sil! unlet w:netrw_treetop endif let newdir= dirname if !exists("b:netrw_curdir") NetrwKeepj call netrw#LocalBrowseCheck(getcwd()) else NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) endif endif " visual display of **/ **// */ Exploration files " call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"),'~'.expand("
")) " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">",'~'.expand("
")) if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") " call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"),'~'.expand("
")) if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir " only update match list when current directory isn't the same as before " call Decho("only update match list when current directory not the same as before",'~'.expand("
")) let s:explore_prvdir = b:netrw_curdir let s:explore_match = "" let dirlen = strlen(b:netrw_curdir) if b:netrw_curdir !~ '/$' let dirlen= dirlen + 1 endif let prvfname= "" for fname in w:netrw_explore_list " call Decho("fname<".fname.">",'~'.expand("
")) if fname =~ '^'.b:netrw_curdir if s:explore_match == "" let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' else let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' endif elseif fname !~ '^/' && fname != prvfname if s:explore_match == "" let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' else let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' endif endif let prvfname= fname endfor " call Decho("explore_match<".s:explore_match.">",'~'.expand("
")) exe "2match netrwMarkFile /".s:explore_match."/" endif echo "
==Pexplore
==Nexplore" else 2match none if exists("s:explore_match") | unlet s:explore_match | endif if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif echo " " " call Decho("cleared explore match list",'~'.expand("
")) endif " since Explore may be used to initialize netrw's browser, " there's no danger of a late FocusGained event on initialization. " Consequently, set s:netrw_events to 2. let s:netrw_events= 2 if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar endif sil! let @/ = keepregslash " call Dret("netrw#Explore : @/<".@/.">") endfun " --------------------------------------------------------------------- " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 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 a1 = expand(a:1) " call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("
")) exe "1wincmd w" if &ft == "netrw" " call Decho("exe Explore ".fnameescape(a:1),'~'.expand("
")) exe "Explore ".fnameescape(a1) exe curwin."wincmd w" if exists("t:netrw_lexposn") " call Decho("forgetting t:netrw_lexposn",'~'.expand("
")) unlet t:netrw_lexposn endif " call Dret("netrw#Lexplore") return endif exe curwin."wincmd w" else let a1= "" endif if exists("t:netrw_lexbufnr") " check if t:netrw_lexbufnr refers to a netrw window let lexwinnr = bufwinnr(t:netrw_lexbufnr) 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",'~'.expand("
")) exe lexwinnr."wincmd w" let g:netrw_winsize = -winwidth(0) let t:netrw_lexposn = winsaveview() " call Decho("saving posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("
")) " call Decho("saving t:netrw_lexposn",'~'.expand("
")) 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
: open netrw explorer window",'~'.expand("
")) exe "1wincmd w" let keep_altv = g:netrw_altv let g:netrw_altv = 0 if a:count != 0 let netrw_winsize = g:netrw_winsize let g:netrw_winsize = a:count endif let curfile= expand("%") " call Decho("curfile<".curfile.">",'~'.expand("
")) 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,'~'.expand("
")) exe "Explore ".fnameescape(a1) elseif curfile =~ '^\a\{3,}://' " call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("
")) exe "Explore ".substitute(curfile,'[^/\\]*$','','') else " call Decho("case 3: Explore .",'~'.expand("
")) 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",'~'.expand("
")) " call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("
")) call winrestview(t:netrw_lexposn) unlet t:netrw_lexposn endif endif " set up default window for editing via
if exists("g:netrw_chgwin") && g:netrw_chgwin == -1 if a:rightside let g:netrw_chgwin= 1 else let g:netrw_chgwin= 2 endif endif " call Dret("netrw#Lexplore") endfun " --------------------------------------------------------------------- " netrw#Clean: remove netrw {{{2 " supports :NetrwClean -- remove netrw from first directory on runtimepath " :NetrwClean! -- remove netrw from all directories on runtimepath fun! netrw#Clean(sys) " call Dfunc("netrw#Clean(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,'~'.expand("
")) 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,'~'.expand("
")) if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif if s:NetrwDelete(dir."/autoload/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrw.vim",55) |endif if s:NetrwDelete(dir."/syntax/netrw.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/syntax/netrw.vim",55) |endif if s:NetrwDelete(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#Clean") endfun " --------------------------------------------------------------------- " netrw#MakeTgt: make a target out of the directory name provided {{{2 fun! netrw#MakeTgt(dname) " call Dfunc("netrw#MakeTgt(dname<".a:dname.">)") " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) let svpos = winsaveview() " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("
")) let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://') " call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("
")) if s:netrwmftgt_islocal let netrwmftgt= simplify(a:dname) else let netrwmftgt= a:dname endif if exists("s:netrwmftgt") && netrwmftgt == s:netrwmftgt " re-selected target, so just clear it unlet s:netrwmftgt s:netrwmftgt_islocal else let s:netrwmftgt= netrwmftgt endif if g:netrw_fastbrowse <= 1 call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir) endif " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("
"))" call winrestview(svpos) " call Dret("netrw#MakeTgt") endfun " --------------------------------------------------------------------- " netrw#Obtain: {{{2 " netrw#Obtain(islocal,fname[,tgtdirectory]) " islocal=0 obtain from remote source " =1 obtain from local source " fname : a filename or a list of filenames " tgtdir : optional place where files are to go (not present, uses getcwd()) fun! netrw#Obtain(islocal,fname,...) " call Dfunc("netrw#Obtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0) " NetrwStatusLine support - for obtaining support if type(a:fname) == 1 let fnamelist= [ a:fname ] elseif type(a:fname) == 3 let fnamelist= a:fname else call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62) " call Dret("netrw#Obtain") return endif " call Decho("fnamelist<".string(fnamelist).">",'~'.expand("
")) if a:0 > 0 let tgtdir= a:1 else let tgtdir= getcwd() endif " call Decho("tgtdir<".tgtdir.">",'~'.expand("
")) if exists("b:netrw_islocal") && b:netrw_islocal " obtain a file from local b:netrw_curdir to (local) tgtdir " call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("
")) if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir let topath= s:ComposePath(tgtdir,"") if (has("win32") || has("win95") || has("win64") || has("win16")) " transfer files one at time " call Decho("transfer files one at a time",'~'.expand("
")) for fname in fnamelist " call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("
")) call system(g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) return endif endfor else " transfer files with one command " call Decho("transfer files with one command",'~'.expand("
")) let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("
")) call system(g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) return endif endif elseif !exists("b:netrw_curdir") call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) else call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37) endif else " obtain files from remote b:netrw_curdir to local tgtdir " call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir,'~'.expand("
")) if type(a:fname) == 1 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) endif call s:NetrwMethod(b:netrw_curdir) if b:netrw_method == 4 " obtain file using scp " call Decho("obtain via scp (method#4)",'~'.expand("
")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else let useport= "" endif if b:netrw_fname =~ '/' let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','') else let path= "" endif let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)')) call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) elseif b:netrw_method == 2 " obtain file using ftp + .netrc " call Decho("obtain via ftp+.netrc (method #2)",'~'.expand("
")) call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif if exists("b:netrw_fname") && b:netrw_fname != "" call setline(line("$")+1,'cd "'.b:netrw_fname.'"') " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif for fname in fnamelist call setline(line("$")+1,'get "'.fname.'"') " call Decho("filter input: ".getline('$'),'~'.expand("
")) endfor if exists("g:netrw_port") && g:netrw_port != "" call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s: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 ' let debugkeep= &debug setl debug=msg call netrw#ErrorMsg(s:ERROR,getline(1),4) let &debug= debugkeep endif elseif b:netrw_method == 3 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) " call Decho("obtain via ftp+mipf (method #3)",'~'.expand("
")) call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('$'),'~'.expand("
")) else NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('$'),'~'.expand("
")) if exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif " call Decho("filter input: ".getline('$'),'~'.expand("
")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif if exists("b:netrw_fname") && b:netrw_fname != "" NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$'),'~'.expand("
")) endif for fname in fnamelist NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') endfor " call Decho("filter input: ".getline('$'),'~'.expand("
")) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password 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).">",'~'.expand("
")) if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif elseif b:netrw_method == 9 " obtain file using sftp " call Decho("obtain via sftp (method #9)",'~'.expand("
")) if a:fname =~ '/' let localfile= substitute(a:fname,'^.*/','','') else let localfile= a:fname endif call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1).s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir)) elseif !exists("b:netrw_method") || b:netrw_method < 0 " probably a badly formed url; protocol not recognized " call Dret("netrw#Obtain : unsupported method") return else " protocol recognized but not supported for Obtain (yet?) if !exists("g:netrw_quiet") 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 endif " restore status line if type(a:fname) == 1 && exists("s:netrw_users_stl") NetrwKeepj call s:SetupNetrwStatusLine(s:netrw_users_stl) endif endif " cleanup if exists("tmpbufnr") if bufnr("%") != tmpbufnr exe tmpbufnr."bw!" else q! endif endif " call Dret("netrw#Obtain") endfun " --------------------------------------------------------------------- " netrw#Nread: save position, call netrw#NetRead(), and restore position {{{2 fun! netrw#Nread(mode,fname) " call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") let svpos= winsaveview() " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("
")) call netrw#NetRead(a:mode,a:fname) " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("
")) call winrestview(svpos) if exists("w:netrw_liststyle") && w:netrw_liststyle != s:TREELIST if exists("w:netrw_bannercnt") " start with cursor just after the banner exe w:netrw_bannercnt endif endif " call Dret("netrw#Nread") endfun " ------------------------------------------------------------------------ " 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("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,'~'.expand("
")) if !exists("{a:vt}netrw_optionsave") call s:RestorePosn(s:netrw_nbcd) " 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." a:vt=".a:vt,'~'.expand("
")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("
")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif unlet {a:vt}netrw_optionsave if exists("+acd") if exists("{a:vt}netrw_acdkeep") " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("
")) let curdir = getcwd() let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep if &l:acd call s:NetrwLcd(curdir) 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_blkeep") |let &l:bl = {a:vt}netrw_blkeep |unlet {a:vt}netrw_blkeep |endif if exists("{a:vt}netrw_btkeep") |let &l:bt = {a:vt}netrw_btkeep |unlet {a:vt}netrw_btkeep |endif if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif if exists("{a:vt}netrw_cedit") |let &cedit = {a:vt}netrw_cedit |unlet {a:vt}netrw_cedit |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_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("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 if exists("{a:vt}netrw_imkeep") |let &l:im = {a:vt}netrw_imkeep |unlet {a:vt}netrw_imkeep |endif if exists("{a:vt}netrw_iskkeep") |let &l:isk = {a:vt}netrw_iskkeep |unlet {a:vt}netrw_iskkeep |endif if exists("{a:vt}netrw_lskeep") |let &l:ls = {a:vt}netrw_lskeep |unlet {a:vt}netrw_lskeep |endif if exists("{a:vt}netrw_makeep") |let &l:ma = {a:vt}netrw_makeep |unlet {a:vt}netrw_makeep |endif if exists("{a:vt}netrw_magickeep")|let &l:magic = {a:vt}netrw_magickeep |unlet {a:vt}netrw_magickeep|endif if exists("{a:vt}netrw_modkeep") |let &l:mod = {a:vt}netrw_modkeep |unlet {a:vt}netrw_modkeep |endif if exists("{a:vt}netrw_nukeep") |let &l:nu = {a:vt}netrw_nukeep |unlet {a:vt}netrw_nukeep |endif if exists("{a:vt}netrw_rnukeep") |let &l:rnu = {a:vt}netrw_rnukeep |unlet {a:vt}netrw_rnukeep |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_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 has("clipboard") if exists("{a:vt}netrw_starkeep") |let @* = {a:vt}netrw_starkeep |unlet {a:vt}netrw_starkeep |endif endif " Problem: start with liststyle=0; press
: 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 if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif if exists("{a:vt}netrw_wrapkeep") |let &l:wrap = {a:vt}netrw_wrapkeep |unlet {a:vt}netrw_wrapkeep |endif if exists("{a:vt}netrw_writekeep")|let &l:write = {a:vt}netrw_writekeep |unlet {a:vt}netrw_writekeep|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() sil! let &l:swf = {a:vt}netrw_swfkeep setl directory= unlet {a:vt}netrw_swfkeep elseif &l:swf != {a:vt}netrw_swfkeep if !g:netrw_use_noswf " following line causes a Press ENTER in windows -- can't seem to work around it!!! sil! let &l:swf= {a:vt}netrw_swfkeep endif unlet {a:vt}netrw_swfkeep endif endif if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') if exists("{a:vt}netrw_dirkeep") call s:NetrwLcd(dirkeep) unlet {a:vt}netrw_dirkeep endif endif if has("clipboard") if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif endif if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif call s:RestorePosn(s:netrw_nbcd) " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("
")) " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("
")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("
")) " call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("
")) " call Decho("ts=".&l:ts,'~'.expand("
")) " Moved the filetype detect here from NetrwGetFile() because remote files " were having their filetype detect-generated settings overwritten by " NetrwOptionRestore. if &ft != "netrw" " call Decho("filetype detect (ft=".&ft.")",'~'.expand("
")) filetype detect endif " 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." a:vt=".a:vt,'~'.expand("
")) " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun " --------------------------------------------------------------------- " 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 " 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("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("
")) " 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." a:vt=".a:vt,'~'.expand("
")) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 else " call Dret("s:NetrwOptionSave : options already saved") return endif " call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("
")) " Save current settings and current directory " call Decho("saving current settings and current directory",'~'.expand("
")) let s:yykeep = @@ if exists("&l:acd")|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_bhkeep = &l:bh let {a:vt}netrw_blkeep = &l:bl let {a:vt}netrw_btkeep = &l:bt let {a:vt}netrw_bombkeep = &l:bomb let {a:vt}netrw_cedit = &cedit 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 let {a:vt}netrw_diffkeep = &l:diff let {a:vt}netrw_fenkeep = &l:fen if !exists("g:netrw_ffkeep") || g:netrw_ffkeep let {a:vt}netrw_ffkeep = &l:ff 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_imkeep = &l:im let {a:vt}netrw_iskkeep = &l:isk let {a:vt}netrw_lskeep = &l:ls let {a:vt}netrw_makeep = &l:ma let {a:vt}netrw_magickeep = &l:magic let {a:vt}netrw_modkeep = &l:mod let {a:vt}netrw_nukeep = &l:nu let {a:vt}netrw_rnukeep = &l:rnu let {a:vt}netrw_repkeep = &l:report let {a:vt}netrw_rokeep = &l:ro let {a:vt}netrw_selkeep = &l:sel let {a:vt}netrw_spellkeep = &l:spell if !g:netrw_use_noswf let {a:vt}netrw_swfkeep = &l:swf endif if has("clipboard") let {a:vt}netrw_starkeep = @* endif let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth let {a:vt}netrw_wigkeep = &l:wig " wildignore let {a:vt}netrw_wrapkeep = &l:wrap let {a:vt}netrw_writekeep = &l:write " save a few selected netrw-related variables " call Decho("saving a few selected netrw-related variables",'~'.expand("
")) if g:netrw_keepdir let {a:vt}netrw_dirkeep = getcwd() endif if has("clipboard") if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif endif sil! let {a:vt}netrw_regslash= @/ " 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." a:vt=".a:vt,'~'.expand("
")) " call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun " ------------------------------------------------------------------------ " s:NetrwSafeOptions: sets options to help netrw do its job {{{2 " Use s:NetrwSaveOptions() to save user settings " 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,'~'.expand("
")) " 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,'~'.expand("
")) if exists("+acd") | setl noacd | endif setl noai setl noaw setl nobl setl nobomb setl bt=nofile setl noci setl nocin setl bh=hide setl cino= setl com= setl cpo-=a setl cpo-=A setl fo=nroql2 setl nohid setl noim setl isk+=@ isk+=* isk+=/ setl magic if g:netrw_use_noswf setl noswf endif setl report=10000 setl sel=inclusive setl nospell setl tw=0 setl wig= setl cedit& call s:NetrwCursor() " allow the user to override safe options " call Decho("ft<".&ft."> ei=".&ei,'~'.expand("
")) if &ft == "netrw" " call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("
")) sil! keepalt NetrwKeepj doau FileType netrw endif " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("
")) " 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,'~'.expand("
")) " call Dret("s:NetrwSafeOptions") endfun " --------------------------------------------------------------------- " NetrwStatusLine: {{{2 fun! NetrwStatusLine() " vvv NetrwStatusLine() debugging vvv " let g:stlmsg="" " if !exists("w:netrw_explore_bufnr") " let g:stlmsg="!X
" " elseif w:netrw_explore_bufnr != bufnr("%") " let g:stlmsg="explore_bufnr!=".bufnr("%") " endif " if !exists("w:netrw_explore_line") " let g:stlmsg=" !X
" " elseif w:netrw_explore_line != line(".") " let g:stlmsg=" explore_line!={line(.)<".line(".").">" " endif " if !exists("w:netrw_explore_list") " let g:stlmsg=" !X
" " endif " ^^^ NetrwStatusLine() debugging ^^^ 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") " restore user's status line let &stl = s:netrw_users_stl let &laststatus = s:netrw_users_ls 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 " --------------------------------------------------------------------- " Netrw Transfer Functions: {{{1 " =============================== " ------------------------------------------------------------------------ " 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 " =3 obtain file, but leave in temporary format fun! netrw#NetRead(mode,...) " call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw.((a:0 > 0)? " a:1<".a:1.">" : "")) " NetRead: save options {{{3 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,'~'.expand("
")) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line let readcmd = "0r" elseif a:mode == 1 " read file after current line let readcmd = "r" elseif a:mode == 2 " replace with remote file let readcmd = "%r" elseif a:mode == 3 " skip read of file (leave as temporary) let readcmd = "t" else exe a:mode let readcmd = "r" endif let ichoice = (a:0 == 0)? 0 : 1 " call Decho("readcmd<".readcmd."> ichoice=".ichoice,'~'.expand("
")) " NetRead: get temporary filename {{{3 let tmpfile= s:GetTempfile("") if tmpfile == "" " call Dret("netrw#NetRead : unable to get a tempfile!") return endif while ichoice <= a:0 " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("
")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else exe "let choice= a:" . ichoice " call Decho("no lastfile: choice<" . choice . ">",'~'.expand("
")) if match(choice,"?") == 0 " give help echomsg 'NetRead Usage:' echomsg ':Nread machine:path uses rcp' echomsg ':Nread "machine path" uses ftp with <.netrc>' echomsg ':Nread "machine id password path" uses ftp' echomsg ':Nread dav://machine[:port]/path uses cadaver' 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' echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp' echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp' sleep 4 break elseif match(choice,'^"') != -1 " Reconstruct Choice if choice starts with '"' " call Decho("reconstructing choice",'~'.expand("
")) if match(choice,'"$') != -1 " case "..." let choice= strpart(choice,1,strlen(choice)-2) else " case "... ... ..." let choice = strpart(choice,1,strlen(choice)-1) let wholechoice = "" while match(choice,'"$') == -1 let wholechoice = wholechoice . " " . choice let ichoice = ichoice + 1 if ichoice > a:0 if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) endif " call Dret("netrw#NetRead :2 getcwd<".getcwd().">") return endif let choice= a:{ichoice} endwhile let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1) endif endif endif " call Decho("choice<" . choice . ">",'~'.expand("
")) let ichoice= ichoice + 1 " NetRead: Determine method of read (ftp, rcp, etc) {{{3 call s:NetrwMethod(choice) if !exists("b:netrw_method") || b:netrw_method < 0 " call Dfunc("netrw#NetRead : unsupported method") return endif let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix " 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.">",'~'.expand("
")) if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' " call Decho("yes, choice matches '^.*[\/]$'",'~'.expand("
")) NetrwKeepj call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return endif " ============ " NetRead: Perform Protocol-Based Read {{{3 " =========================== if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your read request..." endif "......................................... " NetRead: (rcp) NetRead Method #1 {{{3 if b:netrw_method == 1 " read with rcp " call Decho("read via rcp (method #1)",'~'.expand("
")) " ER: nothing done with g:netrw_uid yet? " ER: on Win2K" rcp machine[.user]:file tmpfile " 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 != "" ) let uid_machine = g:netrw_machine .'.'. g:netrw_uid else " Any way needed it machine contains a '.' let uid_machine = g:netrw_machine .'.'. $USERNAME endif else if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_uid .'@'. g:netrw_machine else let uid_machine = g:netrw_machine endif endif call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 elseif b:netrw_method == 2 " read with ftp + <.netrc> " call Decho("read via ftp+.netrc (method #2)",'~'.expand("
")) let netrw_fname= b:netrw_fname NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline(line("$")),'~'.expand("
")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline(line("$")),'~'.expand("
")) endif call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) " call Decho("filter input: ".getline(line("$")),'~'.expand("
")) if exists("g:netrw_port") && g:netrw_port != "" call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s: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 ' let debugkeep = &debug setl debug=msg NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),4) let &debug = debugkeep endif call s:SaveBufVars() keepj bd! if bufname("%") == "" && getline("$") == "" && line('$') == 1 " needed when one sources a file in a nolbl setting window via ftp q! endif call s:RestoreBufVars() let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname " Construct execution string (four lines) which will be passed through filter " call Decho("read via ftp+mipf (method #3)",'~'.expand("
")) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('.'),'~'.expand("
")) else NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('.'),'~'.expand("
")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('.'),'~'.expand("
")) if exists("s:netrw_passwd") NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif " call Decho("filter input: ".getline('.'),'~'.expand("
")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('.'),'~'.expand("
")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('.'),'~'.expand("
")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('.'),'~'.expand("
")) endif NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile " call Decho("filter input: ".getline('.'),'~'.expand("
")) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password 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).">",'~'.expand("
")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif call s:SaveBufVars()|keepj bd!|call s:RestoreBufVars() let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (scp) NetRead Method #4 {{{3 elseif b:netrw_method == 4 " read with scp " call Decho("read via scp (method #4)",'~'.expand("
")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else let useport= "" endif " 'C' in 'C:\path\to\file' is handled as hostname on windows. " This is workaround to avoid mis-handle windows local-path: if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16")) let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '') else let tmpfile_get = tmpfile endif call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (http) NetRead Method #5 (wget) {{{3 elseif b:netrw_method == 5 " call Decho("read via http (method #5)",'~'.expand("
")) if g:netrw_http_cmd == "" if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) endif " call Dret("netrw#NetRead :4 getcwd<".getcwd().">") return endif if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) " call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)",'~'.expand("
")) if exists("g:netrw_http_xcmd") call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".s:ShellEscape(tmpfile,1)) else call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) else " wget/curl/fetch 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.">)",'~'.expand("
")) let netrw_html= substitute(b:netrw_fname,"#.*$","","") let netrw_tag = substitute(b:netrw_fname,"^.*#","","") " call Decho("netrw_html<".netrw_html.">",'~'.expand("
")) " call Decho("netrw_tag <".netrw_tag.">",'~'.expand("
")) call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/','~'.expand("
")) exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\
" endif let b:netrw_lastfile = choice " call Decho("setl ro",'~'.expand("