From 5b8d8fdb526bd21dbac64a3ea815a1e628b93b41 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 16 Aug 2005 23:01:50 +0000 Subject: updated for version 7.0131 --- runtime/autoload/netrw.vim | 3355 +++++++++++++++++++++++++++++++++ runtime/doc/eval.txt | 16 +- runtime/doc/map.txt | 19 +- runtime/doc/pi_netrw.txt | 379 ++-- runtime/doc/spell.txt | 25 +- runtime/doc/tags | 11 + runtime/doc/todo.txt | 10 +- runtime/doc/version7.txt | 11 +- runtime/filetype.vim | 4 +- runtime/menu.vim | 11 +- runtime/plugin/NetrwFileHandlers.vim | 30 +- runtime/plugin/NetrwPlugin.vim | 156 ++ runtime/plugin/NetrwSettings.vim | 157 ++ runtime/plugin/netrw.vim | 3378 ---------------------------------- runtime/spell/af/main.aap | 4 +- runtime/spell/bg/main.aap | 7 +- runtime/spell/ca/main.aap | 4 +- runtime/spell/cs/main.aap | 6 +- runtime/spell/da/da_DK.diff | 16 + runtime/spell/da/main.aap | 6 +- runtime/spell/de/main.aap | 4 +- runtime/spell/el/main.aap | 78 + runtime/spell/en.ascii.spl | Bin 566601 -> 566603 bytes runtime/spell/en.latin1.spl | Bin 568696 -> 568698 bytes runtime/spell/en.utf-8.spl | Bin 569127 -> 569129 bytes runtime/spell/en/en_AU.diff | 11 +- runtime/spell/en/en_CA.diff | 18 +- runtime/spell/en/en_GB.diff | 4 +- runtime/spell/en/en_NZ.diff | 29 +- runtime/spell/en/en_US.diff | 22 +- runtime/spell/en/main.aap | 6 +- runtime/spell/eo/eo_l3.diff | 0 runtime/spell/eo/main.aap | 80 + runtime/spell/fo/fo_FO.diff | 14 + runtime/spell/fo/main.aap | 78 + runtime/spell/fr/main.aap | 4 +- runtime/spell/gl/gl_ES.diff | 15 + runtime/spell/gl/main.aap | 78 + runtime/spell/he/main.aap | 4 +- runtime/spell/hr/main.aap | 8 +- runtime/spell/hu/hu_HU.diff | 128 ++ runtime/spell/hu/main.aap | 81 + runtime/spell/it/main.aap | 6 +- runtime/spell/main.aap | 18 +- runtime/spell/nl/main.aap | 4 +- runtime/spell/ny/main.aap | 8 +- runtime/spell/pl/main.aap | 6 +- runtime/spell/sk/main.aap | 8 +- runtime/spell/yi/!yi.diff | 11 +- runtime/spell/yi/!yi_tr.diff | 8 + runtime/spell/yi/README.txt | 3 + runtime/spell/yi/main.aap | 44 +- runtime/spell/yi/yi.diff | 13 +- runtime/spell/yi/yi_tr.diff | 18 + runtime/syntax/sh.vim | 30 +- runtime/syntax/tex.vim | 60 +- runtime/syntax/vim.vim | 26 +- src/eval.c | 14 +- src/ex_docmd.c | 4 + src/gui.c | 5 + src/message.c | 24 +- src/regexp.c | 2 +- src/screen.c | 9 +- src/spell.c | 295 ++- src/structs.h | 1 + src/syntax.c | 1 + src/version.h | 4 +- 67 files changed, 5032 insertions(+), 3857 deletions(-) create mode 100644 runtime/autoload/netrw.vim create mode 100644 runtime/plugin/NetrwPlugin.vim create mode 100644 runtime/plugin/NetrwSettings.vim delete mode 100644 runtime/plugin/netrw.vim create mode 100644 runtime/spell/da/da_DK.diff create mode 100644 runtime/spell/el/main.aap create mode 100644 runtime/spell/eo/eo_l3.diff create mode 100644 runtime/spell/eo/main.aap create mode 100644 runtime/spell/fo/fo_FO.diff create mode 100644 runtime/spell/fo/main.aap create mode 100644 runtime/spell/gl/gl_ES.diff create mode 100644 runtime/spell/gl/main.aap create mode 100644 runtime/spell/hu/hu_HU.diff create mode 100644 runtime/spell/hu/main.aap create mode 100644 runtime/spell/yi/!yi_tr.diff create mode 100644 runtime/spell/yi/yi_tr.diff diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim new file mode 100644 index 000000000..e077e25e7 --- /dev/null +++ b/runtime/autoload/netrw.vim @@ -0,0 +1,3355 @@ +" netrw.vim: Handles file transfer and remote directory listing across a network +" AUTOLOAD PORTION +" Last Change: Aug 16, 2005 +" Maintainer: Charles E Campbell, Jr +" Version: 63 +" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrw.vim is 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) +" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +let s:keepcpo= &cpo +set cpo&vim +" call Decho("doing autoload/netrw.vim") + +" --------------------------------------------------------------------- +" Default values for global netrw variables {{{1 +if !exists("g:netrw_ftpmode") + let g:netrw_ftpmode= "binary" +endif +if !exists("g:netrw_win95ftp") + let g:netrw_win95ftp= 1 +endif +if !exists("g:netrw_cygwin") + if has("win32") || has("win95") || has("win64") || has("win16") + if &shell == "bash" + let g:netrw_cygwin= 1 + else + let g:netrw_cygwin= 0 + endif + else + let g:netrw_cygwin= 0 + endif +endif +if !exists("g:netrw_list_cmd") + if executable("ssh") + " provide a default listing command + let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" + else +" call Decho("ssh is not executable, can't do remote directory exploring with ssh") + let g:netrw_list_cmd= "" + endif +endif +if !exists("g:netrw_ftp_list_cmd") + if has("unix") || exists("g:netrw_cygwin") + let g:netrw_ftp_list_cmd= "ls -lF" + else + let g:netrw_ftp_list_cmd= "dir" + endif +endif +if !exists("g:netrw_rm_cmd") + let g:netrw_rm_cmd = "ssh HOSTNAME rm" +endif +if !exists("g:netrw_rmf_cmd") + let g:netrw_rmf_cmd = "ssh HOSTNAME rm -f" +endif +if !exists("g:netrw_rmdir_cmd") + let g:netrw_rmdir_cmd = "ssh HOSTNAME rmdir" +endif +if !exists("g:netrw_rename_cmd") + let g:netrw_rename_cmd= "ssh HOSTNAME mv" +endif +if exists("g:netrw_silent") && g:netrw_silent != 0 + let g:netrw_silentxfer= "silent " +else + let g:netrw_silentxfer= "" +endif +if !exists("g:netrw_winsize") + let g:netrw_winsize= "" +endif +if !exists("g:netrw_list_hide") + let g:netrw_list_hide= "" +endif +if !exists("g:netrw_sort_by") + " alternatives: date size + let g:netrw_sort_by= "name" +endif +if !exists("g:netrw_sort_sequence") + let g:netrw_sort_sequence= '[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$' +endif +if !exists("g:netrw_sort_direction") + " alternative: reverse (z y x ...) + let g:netrw_sort_direction= "normal" +endif +if !exists("g:netrw_longlist") || g:netrw_longlist == 0 + let g:netrw_longlist= 0 + let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" +else + let g:netrw_longlist= 1 + let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa -l" +endif +if !exists("g:netrw_list_cmd") +endif +if !exists("g:netrw_timefmt") + let g:netrw_timefmt= "%c" +endif +if !exists("g:netrw_local_rmdir") + let g:netrw_local_rmdir= "rmdir" +endif +if !exists("g:netrw_local_mkdir") + let g:netrw_local_mkdir= "mkdir" +endif +if !exists("g:netrw_mkdir_cmd") + let g:netrw_mkdir_cmd= "ssh HOSTNAME mkdir" +endif +if !exists("g:netrw_hide") + let g:netrw_hide= 1 +endif +if !exists("g:netrw_ftp_browse_reject") + let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$' +endif +if !exists("g:netrw_ssh_browse_reject") + let g:netrw_ssh_browse_reject='^total\s\+\d\+$' +endif +if !exists("g:netrw_keepdir") + let g:netrw_keepdir= 1 +endif +if !exists("s:netrw_cd_escape") + if has("win32") || has("win95") || has("win64") || has("win16") + let s:netrw_cd_escape="#% " + else + let s:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\" + endif +endif +if !exists("s:netrw_glob_escape") + if has("win32") || has("win95") || has("win64") || has("win16") + let s:netrw_glob_escape= "" + else + let s:netrw_glob_escape= '[]*?`{~$' + endif +endif +if !exists("g:netrw_alto") + let g:netrw_alto= 0 +endif +if !exists("g:netrw_altv") + let g:netrw_altv= 0 +endif +if !exists("g:netrw_maxfilenamelen") + let g:netrw_maxfilenamelen= 32 +endif +if !exists("g:netrw_dirhistmax") + let g:netrw_dirhistmax= 10 +endif +if !exists("g:NETRW_DIRHIST_CNT") + let g:NETRW_DIRHIST_CNT= 0 +endif + +" 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 + +" --------------------------------------------------------------------- +" Default values for global protocol variables {{{1 +if !exists("g:netrw_rcp_cmd") + let g:netrw_rcp_cmd = "rcp" +endif +if !exists("g:netrw_ftp_cmd") + let g:netrw_ftp_cmd = "ftp" +endif +if !exists("g:netrw_scp_cmd") + let g:netrw_scp_cmd = "scp -q" +endif +if !exists("g:netrw_sftp_cmd") + let g:netrw_sftp_cmd = "sftp" +endif +if !exists("g:netrw_http_cmd") + if executable("wget") + let g:netrw_http_cmd = "wget -q -O" + elseif executable("fetch") + let g:netrw_http_cmd = "fetch -o" + else + let g:netrw_http_cmd = "" + endif +endif +if !exists("g:netrw_dav_cmd") + let g:netrw_dav_cmd = "cadaver" +endif +if !exists("g:netrw_rsync_cmd") + let g:netrw_rsync_cmd = "rsync" +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 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 + +" ------------------------------------------------------------------------ +" NetSavePosn: saves position of cursor on screen {{{1 +fun! netrw#NetSavePosn() +" call Dfunc("NetSavePosn()") + " Save current line and column + let w:netrw_winnr= winnr() + let w:netrw_line = line(".") + let w:netrw_col = virtcol(".") + + " Save top-of-screen line + norm! H0 + let w:netrw_hline= line(".") + + call netrw#NetRestorePosn() +" call Dret("NetSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) +endfun + +" ------------------------------------------------------------------------ +" NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{1 +fun! netrw#NetRestorePosn() +" call Dfunc("NetRestorePosn() winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) + let eikeep= &ei + set ei=all + + " restore window +" call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w") + exe "silent! ".w:netrw_winnr."wincmd w" +" if v:shell_error == 0 +" " as suggested by Bram M: redraw on no error +" " allows protocol error messages to remain visible +" redraw! +" endif + + " restore top-of-screen line +" call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z") + exe "norm! ".w:netrw_hline."G0z\" + + " restore position +" call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|") + exe "norm! ".w:netrw_line."G0".w:netrw_col."\" + + let &ei= eikeep +" call Dret("NetRestorePosn") +endfun + +" ------------------------------------------------------------------------ +" NetRead: responsible for reading a file over the net {{{1 +fun! netrw#NetRead(...) +" call Dfunc("NetRead(a:1<".a:1.">)") + + " save options + call s:NetOptionSave() + + " Special Exception: if a file is named "0r", then + " "0r" will be used to read the + " following files instead of "r" + if a:0 == 0 + let readcmd= "r" + let ichoice= 0 + elseif a:1 == "0r" + let readcmd = "0r" + let ichoice = 2 + else + let readcmd = "r" + let ichoice = 1 + endif + + " get name of a temporary file and set up shell-quoting character + let tmpfile= tempname() + if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) + echohl Error | echo "***netrw*** your ".substitute(tmpfile,'[^/]\+$','','e')." directory is missing!" + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("NetRead") + return + endif + +" call Decho("ichoice=".ichoice." readcmd<".readcmd.">") + 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 . ">") + let choice = b:netrw_lastfile + let ichoice= ichoice + 1 + + else + exe "let choice= a:" . ichoice +" call Decho("no lastfile: choice<" . choice . ">") + + 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 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' + break + + elseif match(choice,"^\"") != -1 + " Reconstruct Choice if choice starts with '"' +" call Decho("reconstructing choice") + 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") + echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("NetRead") + 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 . ">") + let ichoice= ichoice + 1 + + " fix up windows urls + if has("win32") || has("win95") || has("win64") || has("win16") + let choice = substitute(choice,'\\','/','ge') +" call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile) + + exe 'lcd ' . fnamemodify(tmpfile,':h') + let tmpfile = fnamemodify(tmpfile,':t') + endif + + " Determine method of read (ftp, rcp, etc) + call s:NetMethod(choice) + + " Check if NetBrowse() should be handling this request +" call Decho("checking if netlist: choice<".choice."> netrw_list_cmd<".g:netrw_list_cmd.">") + if choice =~ "^.*[\/]$" + keepjumps call s:NetBrowse(choice) +" call Dret("NetRead") + return + endif + + " ============ + " Perform Read + " ============ + + "......................................... + " rcp: NetRead Method #1 + if b:netrw_method == 1 " read with rcp +" call Decho("read via rcp (method #1)") + " ER: noting done with g:netrw_uid yet? + " ER: on Win2K" rcp machine[.user]:file tmpfile + " ER: if machine contains '.' adding .user is required (use $USERNAME) + " ER: 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 Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " ftp + <.netrc>: NetRead Method #2 + elseif b:netrw_method == 2 " read with ftp + <.netrc> +" call Decho("read via ftp+.netrc (method #2)") + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + exe "put ='".g:netrw_ftpmode."'" + exe "put ='"."get ".netrw_fname." ".tmpfile."'" + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' + let debugkeep= &debug + set debug=msg + echohl Error | echo "***netrw*** ".getline(1) | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + let &debug= debugkeep + endif + bd! + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " ftp + machine,id,passwd,filename: NetRead Method #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)") + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid + put =g:netrw_passwd + else + put ='user '.g:netrw_uid.' '.g:netrw_passwd + endif + + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + put =g:netrw_ftpmode + endif + put ='get '.netrw_fname.' '.tmpfile + + " 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 +" call Decho('performing ftp -i -n') + norm! 1Gdd +" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" +" call Decho("error<".getline(1).">") + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** ".getline(1) | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + endif + bd! + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " scp: NetRead Method #4 + elseif b:netrw_method == 4 " read with scp +" call Decho("read via scp (method #4)") + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " -P ".g:netrw_port + else + let useport= "" + endif + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile + else +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile + endif + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + elseif b:netrw_method == 5 " read with http (wget) +" call Decho("read via http (method #5)") + if g:netrw_http_cmd == "" + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + exit + endif + + if match(b:netrw_fname,"#") == -1 + " simple wget +" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&') + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + + else + " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) + let netrw_html= substitute(b:netrw_fname,"#.*$","","") + let netrw_tag = substitute(b:netrw_fname,"^.*#","","") +" call Decho("netrw_html<".netrw_html.">") +" call Decho("netrw_tag <".netrw_tag.">") +" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) + exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') + exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" + endif + let b:netrw_lastfile = choice + + "......................................... + " cadaver: NetRead Method #6 + elseif b:netrw_method == 6 " read with cadaver +" call Decho("read via cadaver (method #6)") + + " Construct execution string (four lines) which will be passed through filter + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + put ='user '.g:netrw_uid.' '.g:netrw_passwd + + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') + put ='get '.netrw_fname.' '.cygtmpfile + else + put ='get '.netrw_fname.' '.tmpfile + endif + put ='quit' + + " perform cadaver operation: + norm! 1Gdd +" call Decho("executing: %!".g:netrw_dav_cmd) + exe g:netrw_silentxfer."%!".g:netrw_dav_cmd + bd! + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " rsync: NetRead Method #7 + elseif b:netrw_method == 7 " read with rsync +" call Decho("read via rsync (method #7)") + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') +" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile + else +" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile + endif + let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " fetch: NetRead Method #8 + " fetch://[user@]host[:http]/path + elseif b:netrw_method == 8 " read with fetch + if g:netrw_fetch_cmd == "" + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** fetch command not available" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + exit + endif + if exists("g:netrw_option") && g:netrw_option == ":http" + let netrw_option= "http" + else + let netrw_option= "ftp" + endif +" call Decho("read via fetch for ".netrw_option) + + if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != "" +" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&') + else +" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&') + endif + + let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + " sftp: NetRead Method #9 + elseif b:netrw_method == 9 " read with sftp +" call Decho("read via sftp (method #4)") + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') +" call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) +" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) + exe "!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile + else +" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile + endif + let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + + "......................................... + else " Complain + echo "***warning*** unable to comply with your request<" . choice . ">" + endif + endwhile + + " cleanup +" call Decho("cleanup") + if exists("b:netrw_method") + unlet b:netrw_method + unlet b:netrw_fname + endif + call s:NetOptionRestore() + +" call Dret("NetRead") +endfun + +" ------------------------------------------------------------------------ +" NetGetFile: Function to read file "fname" with command "readcmd". {{{1 +fun! s:NetGetFile(readcmd, fname, method) +" call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)") + + if exists("*NetReadFixup") + " for the use of NetReadFixup (not otherwise used internally) + let line2= line("$") + endif + + " transform paths from / to \ for Windows (except for cygwin) + if &term == "win32" + if g:netrw_cygwin + let fname= a:fname +" call Decho("(win32 && cygwin) fname<".fname.">") + else + let fname= substitute(a:fname,'/','\\\\','ge') +" call Decho("(win32 && !cygwin) fname<".fname.">") + endif + else + let fname= a:fname +" call Decho("(copied) fname<".fname.">") + endif + + if a:readcmd[0] == '0' + " get file into buffer + + " record remote filename + let rfile= bufname(".") +" call Decho("remotefile<".rfile.">") +" call Dredir("ls!","starting buffer list") + + " rename the current buffer to the temp file (ie. fname) + if v:version < 700 + exe "file ".fname + else + keepalt exe "file ".fname + endif +" call Dredir("ls!","after renaming current buffer to <".fname.">") + + " edit temporary file + e +" call Dredir("ls!","after editing temporary file") + + " rename buffer back to remote filename + if v:version < 700 + exe "file ".rfile + else + keepalt exe "file ".rfile + endif +" call Dredir("ls!","renaming buffer back to remote filename<".rfile.">") + let line1 = 1 + let line2 = line("$") + + elseif filereadable(fname) + " read file after current line + let curline = line(".") + let lastline= line("$") +" call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname."> line#".curline) + exe a:readcmd." ".v:cmdarg." ".fname + let line1 = curline + 1 + let line2 = line("$") - lastline + 1 + let s:netrw_line = s:netrw_line + 1 + let s:netrw_col = 1 + else + " not readable +" call Dret("NetGetFile : fname<".fname."> not readable") + return + endif + + " User-provided (ie. optional) fix-it-up command + if exists("*NetReadFixup") +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") + call NetReadFixup(a:method, line1, line2) +" else " Decho +" call Decho("NetReadFixup() not called, doesn't exist") + endif + + " update the Buffers menu + if has("gui") && has("gui_running") + silent! emenu Buffers.Refresh\ menu + endif + +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> fname<".a:fname."> readable=".filereadable(a:fname)) + + " insure that we have the right filetype and that its being displayed + filetype detect + redraw! +" call Dret("NetGetFile") +endfun + +" ------------------------------------------------------------------------ +" NetWrite: responsible for writing a file over the net {{{1 +fun! netrw#NetWrite(...) range +" call Dfunc("NetWrite(a:0=".a:0.")") + + " option handling + let mod= 0 + call s:NetOptionSave() + + " Get Temporary Filename + let tmpfile= tempname() + if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) + echohl Error | echo "***netrw*** your ".substitute(tmpfile,'[^/]\+$','','e')." directory is missing!" + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("NetRead") + return + endif + + if a:0 == 0 + let ichoice = 0 + else + let ichoice = 1 + endif + + " write (selected portion of) file to temporary + silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile + + 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 . ">") + let choice = b:netrw_lastfile + let ichoice= ichoice + 1 + else + exe "let choice= a:" . ichoice + + " Reconstruct Choice if choice starts with '"' + if match(choice,"?") == 0 + echomsg 'NetWrite Usage:"' + echomsg ':Nwrite machine:path uses rcp' + echomsg ':Nwrite "machine path" uses ftp with <.netrc>' + echomsg ':Nwrite "machine id password path" uses ftp' + echomsg ':Nwrite dav://[user@]machine/path uses cadaver' + echomsg ':Nwrite fetch://[user@]machine/path uses fetch' + echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)' + echomsg ':Nwrite rcp://machine/path uses rcp' + echomsg ':Nwrite rsync://[user@]machine/path uses rsync' + echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp' + echomsg ':Nwrite sftp://[user@]machine/path uses sftp' + break + + elseif match(choice,"^\"") != -1 + 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 choice > a:0 + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("NetWrite") + 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 . ">") + let ichoice= ichoice + 1 + + " fix up windows urls + if has("win32") || has("win95") || has("win64") || has("win16") + let choice= substitute(choice,'\\','/','ge') + "ER: see NetRead() + exe 'lcd ' . fnamemodify(tmpfile,':h') + let tmpfile = fnamemodify(tmpfile,':t') + endif + + " Determine method of read (ftp, rcp, etc) + call s:NetMethod(choice) + + " ============= + " Perform Write + " ============= + + "......................................... + " rcp: NetWrite Method #1 + if b:netrw_method == 1 " write with rcp +" Decho "write via rcp (method #1)" + 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 + 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 Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&') + let b:netrw_lastfile = choice + + "......................................... + " ftp + <.netrc>: NetWrite Method #2 + elseif b:netrw_method == 2 " write with ftp + <.netrc> + let netrw_fname = b:netrw_fname + new + setlocal ff=unix + exe "put ='".g:netrw_ftpmode."'" +" call Decho(" NetWrite: put ='".g:netrw_ftpmode."'") + exe "put ='"."put ".tmpfile." ".netrw_fname."'" +" call Decho("put ='"."put ".tmpfile." ".netrw_fname."'") + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** ".getline(1) | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + let mod=1 + endif + bd! + let b:netrw_lastfile = choice + + "......................................... + " ftp + machine, id, passwd, filename: NetWrite Method #3 + elseif b:netrw_method == 3 " write with ftp + machine, id, passwd, and fname + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid + put =g:netrw_passwd + else + put ='user '.g:netrw_uid.' '.g:netrw_passwd + endif + put ='put '.tmpfile.' '.netrw_fname + " save choice/id/password for future use + let b:netrw_lastfile = choice + + " 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 +" call Decho('performing ftp -i -n') + norm! 1Gdd +" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" + " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) + if getline(1) !~ "^$" + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** ".getline(1) | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + let mod=1 + endif + bd! + + "......................................... + " scp: NetWrite Method #4 + elseif b:netrw_method == 4 " write with scp + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " -P ".g:netrw_port + else + let useport= "" + endif + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') + else +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') + endif + let b:netrw_lastfile = choice + + "......................................... + " http: NetWrite Method #5 + elseif b:netrw_method == 5 + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** currently does not support writing using http:" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + + "......................................... + " dav: NetWrite Method #6 + elseif b:netrw_method == 6 " write with cadaver +" call Decho("write via cadaver (method #6)") + + " Construct execution string (four lines) which will be passed through filter + let netrw_fname= b:netrw_fname + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + put ='user '.g:netrw_uid.' '.g:netrw_passwd + + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') + put ='put '.cygtmpfile.' '.netrw_fname + else + put ='put '.tmpfile.' '.netrw_fname + endif + + " perform cadaver operation: + norm! 1Gdd +" call Decho("executing: %!".g:netrw_dav_cmd) + exe g:netrw_silentxfer."%!".g:netrw_dav_cmd + bd! + let b:netrw_lastfile = choice + + "......................................... + " rsync: NetWrite Method #7 + elseif b:netrw_method == 7 " write with rsync + if g:netrw_cygwin == 1 + let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') +" call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') + else +" call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') + endif + let b:netrw_lastfile = choice + + "......................................... + " scp: NetWrite Method #9 + elseif b:netrw_method == 9 " write with sftp + let netrw_fname= b:netrw_fname + 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 + new + setlocal ff=unix + put ='put '.tmpfile.' '.netrw_fname + norm! 1Gdd +" call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine) + exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine + bd! + let b:netrw_lastfile= choice + + "......................................... + else " Complain + echo "***warning*** unable to comply with your request<" . choice . ">" + endif + endwhile + + " cleanup +" call Decho("cleanup") + let result=delete(tmpfile) + call s:NetOptionRestore() + + if a:firstline == 1 && a:lastline == line("$") + let &mod= mod " usually equivalent to set nomod + endif + +" call Dret("NetWrite") +endfun + +" =========================================== +" Remote Directory Browsing Support: {{{1 +" =========================================== + +" NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2 +" of the contents of a remote directory. It is assumed that the +" g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted +" with the requested remote hostname first. +fun! s:NetBrowse(dirname) +" call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".g:netrw_longlist) + + if exists("s:netrw_skipbrowse") + unlet s:netrw_skipbrowse +" call Dret("NetBrowse") + return + endif + + " sanity check + if exists("b:netrw_method") && b:netrw_method =~ '[235]' +" call Decho("b:netrw_method=".b:netrw_method) + if !executable("ftp") + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ftp" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("NetBrowse") + return + endif + elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ssh" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + +" call Dret("NetBrowse") + return + endif + + " use buffer-oriented WinVars if buffer ones exist but window ones don't + call s:UseBufWinVars() + + " make this buffer modifiable + setlocal ma nonu nowrap + + " analyze a:dirname and g:netrw_list_cmd + let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' + let dirname = substitute(a:dirname,'\\','/','ge') +" call Decho("dirpat<".dirpat.">") + if dirname !~ dirpat + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("NetBrowse : badly formatted dirname<".dirname.">") + return + endif + + let method = substitute(dirname,dirpat,'\1','') + let user = substitute(dirname,dirpat,'\2','') + let machine = substitute(dirname,dirpat,'\3','') + let path = substitute(dirname,dirpat,'\4','') + let fname = substitute(dirname,'^.*/\ze.','','') +" call Decho("set up method <".method .">") +" call Decho("set up user <".user .">") +" call Decho("set up machine<".machine.">") +" call Decho("set up path <".path .">") +" call Decho("set up fname <".fname .">") + + if method == "ftp" || method == "http" + let method = "ftp" + let listcmd = g:netrw_ftp_list_cmd + else + let listcmd = substitute(g:netrw_list_cmd,'\',user.machine,'') + endif + + if exists("b:netrw_method") +" call Decho("setting w:netrw_method<".b:netrw_method.">") + let w:netrw_method= b:netrw_method + endif + + " optionally sort by time (-t) or by size (-S) + if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]" + echohl WarningMsg | echo "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + else + if g:netrw_sort_by =~ "^t" + let listcmd= listcmd."t" + elseif g:netrw_sort_by =~ "^s" + let listcmd= listcmd."S" + endif + " optionally sort in reverse + if g:netrw_sort_direction =~ "^r" && listcmd == "dir" + let listcmd= listcmd."r" + endif + endif + +" call Decho("set up listcmd<".listcmd.">") + if fname =~ '@$' && fname !~ '^"' +" call Decho("attempt transfer of symlink as file") + call s:NetBrowse(substitute(dirname,'@$','','e')) + redraw! +" call Dret("NetBrowse : symlink") + return + + elseif fname !~ '[\/]$' && fname !~ '^"' + " looks like a regular file, attempt transfer +" call Decho("attempt transfer as regular file<".dirname.">") + + " remove any filetype indicator from end of dirname, except for the + " "this is a directory" indicator (/). There shouldn't be one of those, + " anyway. + let path= substitute(path,'[*=@|]$','','e') +" call Decho("new path<".path.">") + + " remote-read the requested file into current buffer + enew! +" call Decho("exe file .method."://".user.machine."/".escape(path,s:netrw_cd_escape)) + exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape) + exe "silent doau BufReadPre ".fname + silent call netrw#NetRead(method."://".user.machine."/".path) + exe "silent doau BufReadPost ".fname + keepjumps 1d + + " save certain window-oriented variables into buffer-oriented variables + call s:BufWinVars() + + setlocal nonu nomod noma + +" call Dret("NetBrowse : file<".fname.">") + return + endif + + " --------------------------------------------------------------------- + " Perform Directory Listing: +" call Decho("Perform directory listing...") + " set up new buffer and map + let bufname = method.'://'.user.machine.'/'.path + let bufnamenr = bufnr(bufname.'$') +" call Decho("bufname<".bufname."> bufnamenr=".bufnamenr) + if bufnamenr != -1 + " buffer already exists, switch to it! +" call Decho("buffer already exists, switching to it") + exe "b ".bufnamenr + if line("$") >= 5 +" call Dret("NetBrowse") + return + endif + else +" call Decho("generate a new buffer") + enew! + endif + + " rename file to reflect where its from + setlocal bt=nofile bh=wipe nobl noswf + exe "setlocal ts=".g:netrw_maxfilenamelen +" call Decho("exe file ".escape(bufname,s:netrw_cd_escape)) + exe 'file '.escape(bufname,s:netrw_cd_escape) +" call Decho("renaming file to bufname<".bufname.">") + setlocal bh=hide nobl nonu + + " save current directory on directory history list + call NetBookmarkDir(3,expand("%")) + + " set up buffer-local mappings +" call Decho("set up buffer-local mappings") + nnoremap :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) + nnoremap :call NetRefresh(NetBrowseChgDir(expand("%"),'./')) + nnoremap - :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'../')) + nnoremap a :let g:netrw_hide=(g:netrw_hide+1)%3exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) + nnoremap b :call NetBookmarkDir(0,expand("%")) + nnoremap B :call NetBookmarkDir(1,expand("%")) + nnoremap :call NetHideEdit(0) + nnoremap i :call NetLongList(0) + nnoremap o :call NetSplit(0) + nnoremap q :call NetBookmarkDir(2,expand("%")) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) + nnoremap s :call NetSaveWordPosn()let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./'))call NetRestoreWordPosn() + nnoremap S :call NetSortSequence(0) + nnoremap u :call NetBookmarkDir(4,expand("%")) + nnoremap U :call NetBookmarkDir(5,expand("%")) + nnoremap v :call NetSplit(1) + nnoremap x :exe "norm! 0"call NetBrowseX(NetBrowseChgDir(expand("%"),NetGetWord()),1) + nnoremap <2-leftmouse> :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) + exe 'nnoremap :exe "norm! 0"call NetBrowseRm("'.user.machine.'","'.path.'")' + exe 'vnoremap :call NetBrowseRm("'.user.machine.'","'.path.'")' + exe 'nnoremap d :call NetMakeDir("'.user.machine.'")' + exe 'nnoremap D :exe "norm! 0"call NetBrowseRm("'.user.machine.'","'.path.'")' + exe 'vnoremap D :call NetBrowseRm("'.user.machine.'","'.path.'")' + exe 'nnoremap R :exe "norm! 0"call NetBrowseRename("'.user.machine.'","'.path.'")' + exe 'vnoremap R :call NetBrowseRename("'.user.machine.'","'.path.'")' + nnoremap ? :he netrw-browse-cmds + setlocal ma nonu nowrap + + " Set up the banner +" call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method.">") + keepjumps put ='\" ===========================================================================' + keepjumps put ='\" Netrw Remote Directory Listing' + keepjumps put ='\" '.bufname + let w:netrw_bannercnt = 7 + let sortby = g:netrw_sort_by + if g:netrw_sort_direction =~ "^r" + let sortby = sortby." reversed" + endif + + if g:netrw_sort_by =~ "^n" + " sorted by name + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + keepjumps put ='\" Sorted by '.sortby + keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence + else + " sorted by size or date + keepjumps put ='\" Sorted by '.sortby + endif + if g:netrw_list_hide != "" && g:netrw_hide + if g:netrw_hide == 1 + keepjumps put ='\" Hiding: '.g:netrw_list_hide + else + keepjumps put ='\" Showing: '.g:netrw_list_hide + endif + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + endif + keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec' + keepjumps put ='\" ===========================================================================' + + " remote read the requested directory listing + " Use ftp if that was the file-transfer method selected, otherwise use ssh + " Note that not all ftp servers honor the options for ls + if method == "ftp" + " use ftp to get remote file listing +" call Decho("use ftp to get remote file listing") + call s:NetBrowseFtpCmd(path,listcmd) + keepjumps 1d + + if !g:netrw_longlist + " shorten the listing +" call Decho("generate short listing") + exe "keepjumps ".w:netrw_bannercnt + + " cleanup + if g:netrw_ftp_browse_reject != "" + exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d" + endif + + " if there's no ../ listed, then put ./ and ../ in + let line1= line(".") + keepjumps 1 + silent keepjumps call search('^\.\.\/\%(\s\|$\)','W') + let line2= line(".") + if line2 == 0 + keepjumps put='../' + keepjumps put='./' + endif + exe "keepjumps ".line1 + keepjumps norm! 0 + + " more cleanup + exe 'keepjumps silent! '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' + exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' + exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' + endif + + else + " use ssh to get remote file listing +" call Decho("use ssh to get remote file listing") + let shq= &shq? &shq : ( &sxq? &sxq : "'") +" call Decho("exe silent r! ".listcmd." '".shq.escape(path,s:netrw_cd_escape).shq."'") + exe "silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq + keepjumps 1d + " cleanup + if g:netrw_ftp_browse_reject != "" + exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d" + endif + endif + + + " set up syntax highlighting + if has("syntax") + setlocal ft=netrwlist + if !exists("g:syntax_on") || !g:syntax_on + setlocal ft= + " Ugly workaround -- when syntax highlighting is off and laststatus==2, + " sometimes the laststatus highlight bleeds into the entire display. + " Only seems to happen with remote browsing. Weird. + redraw + endif + endif + + " manipulate the directory listing (hide, sort) + if line("$") >= w:netrw_bannercnt + if g:netrw_hide && g:netrw_list_hide != "" + call s:NetrwListHide() + endif + + if g:netrw_longlist + " do a long listing; these substitutions need to be done prior to sorting +" call Decho("manipulate long listing") + + if method == "ftp" + " cleanup + exe "keepjumps ".w:netrw_bannercnt + while getline(".") =~ g:netrw_ftp_browse_reject + keepjumps d + endwhile + " if there's no ../ listed, then put ./ and ../ in + let line1= line(".") + keepjumps 1 + silent keepjumps call search('^\.\.\/\%(\s\|$\)','W') + let line2= line(".") + if line2 == 0 + exe 'keepjumps '.w:netrw_bannercnt."put='./'" + exe 'keepjumps '.w:netrw_bannercnt."put='../'" + endif + exe "keepjumps ".line1 + keepjumps norm! 0 + endif + + exe 'keepjumps silent '.w:netrw_bannercnt.',$s/ -> .*$//e' + exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' + exe w:netrw_bannercnt + endif + + if line("$") >= w:netrw_bannercnt + if g:netrw_sort_by =~ "^n" + call s:SetSort() + if v:version < 700 + exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()' + elseif g:netrw_sort_direction =~ 'n' + exe 'keepjumps silent '.w:netrw_bannercnt.',$sort' + else + exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!' + endif + exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e' + endif + if g:netrw_longlist + " shorten the list to keep its width <= 80 characters + exe "keepjumps silent ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e' + endif + endif + endif + exe "keepjumps ".w:netrw_bannercnt + + setlocal nomod noma nonu + +" call Dret("NetBrowse") + return +endfun + +" --------------------------------------------------------------------- +" NetBrowseChgDir: {{{2 +fun! s:NetBrowseChgDir(dirname,newdir) +" call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)") + + let dirname= a:dirname + let newdir = a:newdir + + if newdir !~ '[\/]$' + " handling a file + let dirname= dirname.newdir +" call Decho("handling a file: dirname<".dirname.">") + + elseif newdir == './' + " refresh the directory list +" call Decho("refresh directory listing") + setlocal ma nobl bh=hide + %d + + elseif newdir == '../' + " go up one directory + let trailer= substitute(a:dirname,'^\(\w\+://\%(\w\+@\)\=\w\+/\)\(.*\)$','\2','') + + if trailer =~ '^\%(\.\./\)*$' + " tack on a ../" + let dirname= dirname.'../' + + else + " strip off a directory name from dirname + let dirname= substitute(dirname,'^\(.*/\)[^/]\+/','\1','') + endif +" call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">") + + else + " go down one directory + let dirname= dirname.newdir +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") + endif + +" call Dret("NetBrowseChgDir <".dirname.">") + return dirname +endfun + +" --------------------------------------------------------------------- +" NetGetWord: it gets the directory named under the cursor +fun! s:NetGetWord() +" call Dfunc("NetGetWord() line#".line(".")) + call s:UseBufWinVars() + + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt + let dirname= "./" + let curline= getline(".") + if curline =~ '"\s*Sorted by\s' + norm s + let s:netrw_skipbrowse= 1 + echo 'Pressing "s" also works' + elseif curline =~ '"\s*Sort sequence:' + let s:netrw_skipbrowse= 1 + echo 'Press "S" to edit sorting sequence' + elseif curline =~ '"\s*Quick Help:' + norm ? + let s:netrw_skipbrowse= 1 + echo 'Pressing "?" also works' + elseif curline =~ '"\s*\%(Hiding\|Showing\):' + norm a + let s:netrw_skipbrowse= 1 + echo 'Pressing "a" also works' + elseif line("$") > w:netrw_bannercnt + exe w:netrw_bannercnt + endif + else + let dirname= getline(".") + if dirname =~ '\t' + let dirname= substitute(dirname,'\t.*$','','e') + endif + endif +" call Dret("NetGetWord <".dirname.">") + return dirname +endfun + +" --------------------------------------------------------------------- +" NetBrowseRm: remove/delete a remote file or directory {{{2 +fun! s:NetBrowseRm(usrhost,path) range +" call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">)") +" call Decho("firstline=".a:firstline." lastline=".a:lastline) + + " preparation for removing multiple files/directories + let ctr= a:firstline + let all= 0 + + " remove multiple files and directories + while ctr <= a:lastline + exe ctr + + norm! 0 + let rmfile= s:NetGetWord() +" call Decho("rmfile<".rmfile.">") + + if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') + " attempt to remove file + if !all + echohl Statement + call inputsave() + let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + echohl NONE + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + + if all || ok =~ 'y\%[es]' || ok == "" + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) + silent! keepjumps .,$d + call s:NetBrowseFtpCmd(a:path,"delete ".rmfile) + else + let netrw_rm_cmd= substitute(g:netrw_rm_cmd,'HOSTNAME',a:usrhost,'').' "'.escape(a:path.rmfile,s:netrw_cd_escape).'"' +" call Decho("attempt to remove file: system(".netrw_rm_cmd.")") + let ret= system(netrw_rm_cmd) +" call Decho("returned=".ret." errcode=".v:shell_error) + endif + elseif ok =~ 'q\%[uit]' + break + endif + + else + " attempt to remove directory + if !all + call inputsave() + let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + + if all || ok =~ 'y\%[es]' || ok == "" + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) + call s:NetBrowseFtpCmd(a:path,"rmdir ".rmfile) + else + let rmfile = a:path.rmfile + let netrw_rmdir_cmd= substitute(g:netrw_rmdir_cmd,'HOSTNAME',a:usrhost,'').' '."'".'"'.rmfile.'"'."'" +" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") + let ret= system(netrw_rmdir_cmd) +" call Decho("returned=".ret." errcode=".v:shell_error) + + if v:shell_error != 0 + let netrw_rmf_cmd= substitute(g:netrw_rmf_cmd,'HOSTNAME',a:usrhost,'').' '.substitute(rmfile,'[\/]$','','e') +" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") + let ret= system(netrw_rmf_cmd) +" call Decho("returned=".ret." errcode=".v:shell_error) + + if v:shell_error != 0 && !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + endif + endif + + elseif ok =~ 'q\%[uit]' + break + endif + endif + + let ctr= ctr + 1 + endwhile + + " refresh the directory + let curline= line(".")-1 +" call Decho("refresh the directory") + call NetBrowse(NetBrowseChgDir(expand("%"),'./')) + exe curline + +" call Dret("NetBrowseRm") +endfun + +" --------------------------------------------------------------------- +" NetBrowseRename: rename a remote file or directory {{{2 +fun! s:NetBrowseRename(usrhost,path) range +" call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)") + + " preparation for removing multiple files/directories + let ctr = a:firstline + let rename_cmd = substitute(g:netrw_rename_cmd,'\',a:usrhost,'') + + " attempt to rename files/directories + while ctr <= a:lastline + exe "keepjumps ".ctr + + norm! 0 + let oldname= s:NetGetWord() +" call Decho("oldname<".oldname.">") + + call inputsave() + let newname= input("Moving ".oldname." to : ",oldname) + call inputrestore() + + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) + call s:NetBrowseFtpCmd(a:path,"rename ".oldname." ".newname) + else + let oldname= a:path.oldname + let newname= a:path.newname +" call Decho("system(rename_cmd".' "'.escape(oldname," ").'" "'.escape(newname,s:netrw_cd_escape).'"') + let ret= system(rename_cmd.' "'.escape(oldname,s:netrw_cd_escape).'" "'.escape(newname,s:netrw_cd_escape).'"') + endif + + let ctr= ctr + 1 + endwhile + + " refresh the directory + let curline= line(".") + call NetBrowse(NetBrowseChgDir(expand("%"),'./')) + exe "keepjumps ".curline +" call Dret("NetBrowseRename") +endfun + +" --------------------------------------------------------------------- +" NetRefresh: {{{2 +fun! s:NetRefresh(dirname) +" call Dfunc("NetRefresh(dirname<".a:dirname.">)") + set ma + %d + call NetBrowse(dirname) + redraw! +" call Dret("NetRefresh") +endfun + +" --------------------------------------------------------------------- +" NetSplit: mode {{{2 +" =0 : net and o +" =1 : net and v +" =2 : local and o +" =3 : local and v +fun! s:NetSplit(mode) +" call Dfunc("NetSplit(mode=".a:mode.")") + + call s:SaveWinVars() + if a:mode == 0 + exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + call s:CopyWinVars() + exe "norm! 0" + call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) + elseif a:mode ==1 + exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" + call s:CopyWinVars() + exe "norm! 0" + call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) + elseif a:mode ==2 + exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" + call s:CopyWinVars() + exe "norm! 0" + call s:LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) + else + exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" + call s:CopyWinVars() + exe "norm! 0" + call s:LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) + endif + +" call Dret("NetSplit") +endfun + +" --------------------------------------------------------------------- +" NetBrowseX: allows users to write custom functions to operate on {{{2 +" files given their extension. Passes 0=local, 1=remote +fun! s:NetBrowseX(fname,remote) +" call Dfunc("NetBrowseX(".a:fname." remote=".a:remote.")") + + " set up the filename + " (lower case the extension, make a local copy of a remote file) + let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') + if has("win32") || has("win95") || has("win64") || has("win16") + let exten= substitute(exten,'^.*$','\L&\E','') + endif + let fname= escape(a:fname,"%#") +" call Decho("fname<".fname."> after escape()") + + if a:remote == 1 + " create a local copy + let fname= tempname().".".exten +" call Decho("create a local copy of <".a:fname."> as <".fname.">") + exe "keepjumps silent bot 1new ".a:fname + set bh=delete + exe "w! ".fname + q + endif +" call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten)) + + " set up redirection + if &srr =~ "%s" + let redir= substitute(&srr,"%s","/dev/null"."") + else + let redir= &srr . "/dev/null" + endif +" call Decho("redir:".redir.":") + + " execute the file handler + if has("win32") || has("win64") +" call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"') + exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"' + let ret= v:shell_error + + elseif has("unix") && executable("kfmclient") +" call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir) + exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir + let ret= v:shell_error + + elseif has("unix") && executable("gnome-open") +" call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir) + exe "silent !gnome-open '".escape(fname,'%#')."'".redir + let ret= v:shell_error + + elseif exten != "" && exists("*NetrwFileHandler_".exten) +" call Decho("let ret= NetrwFileHandler_".exten.'("'.fname.'")') + exe "let ret= NetrwFileHandler_".exten.'("'.fname.'")' + endif + redraw! + + " cleanup: remove temporary file, + " delete current buffer if success with handler, + " return to prior buffer (directory listing) + if a:remote == 1 && fname != a:fname +" call Decho("deleting temporary file<".fname.">") + call delete(fname) + endif + + if a:remote == 1 + set bh=delete bt=nofile noswf + exe "norm! \" + redraw! + endif + +" call Dret("NetBrowseX") +endfun + +" --------------------------------------------------------------------- +" NetBrowseFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2 +" This function assumes that a long listing will be received. Size, time, +" and reverse sorts will be requested of the server but not otherwise +" enforced here. +fun! s:NetBrowseFtpCmd(path,cmd) +" call Dfunc("NetBrowseFtpCmd(path<".a:path."> cmd<".a:cmd.">) netrw_method=".w:netrw_method) + + " because WinXX ftp uses unix style input + " curline is one more than the bannercnt in order to account + " for the unwanted first blank line (doing a :put to an empty + " buffer yields a blank first line) + let ffkeep= &ff + setlocal ma ff=unix + let curline= w:netrw_bannercnt+1 + exe "silent! keepjumps ".curline.",$d" + + "......................................... + if w:netrw_method == 2 || w:netrw_method == 5 + " ftp + <.netrc>: Method #2 + if a:path != "" + put ='cd '.a:path + endif + exe "put ='".a:cmd."'" +" redraw!|call inputsave()|call input("Pausing...")|call inputrestore() + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) + exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port + else +" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine) + exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine + endif + + "......................................... + elseif w:netrw_method == 3 + " ftp + machine,id,passwd,filename: Method #3 + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + put =g:netrw_uid + put =g:netrw_passwd + else + put ='user '.g:netrw_uid.' '.g:netrw_passwd + endif + + if a:path != "" + put ='cd '.a:path + endif + exe "put ='".a:cmd."'" + + " 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 +" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n") + exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n" + + "......................................... + else + echo "***warning*** unable to comply with your request<" . choice . ">" + endif + + " cleanup for Windows + if has("win32") || has("win95") || has("win64") || has("win16") + keepjumps silent!! %s/\r$//e + endif + if a:cmd == "dir" + " infer directory/link based on the file permission string + keepjumps silent! g/d\%([-r][-w][-x]\)\{3}/s@$@/@ + keepjumps silent! g/l\%([-r][-w][-x]\)\{3}/s/$/@/ + if !g:netrw_longlist + exe "keepjumps silent! ".curline.',$s/^\%(\S\+\s\+\)\{8}//e' + endif + endif + + " restore settings + let &ff= ffkeep +" call Dret("NetBrowseFtpCmd") +endfun + +" --------------------------------------------------------------------- +" NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 +" separated patterns given in g:netrw_list_hide +fun! s:NetrwListHide() +" call Dfunc("NetrwListHide() listhide<".g:netrw_list_hide.">") + + let listhide= g:netrw_list_hide + while listhide != "" + if listhide =~ ',' + let hide = substitute(listhide,',.*$','','e') + let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e') + else + let hide = listhide + let listhide= "" + endif + + " Prune the list by hiding any files which match +" call Decho("pruning <".hide."> listhide<".listhide.">") + if g:netrw_hide == 1 + exe 'keepjumps silent '.w:netrw_bannercnt.',$g~'.hide.'~d' + elseif g:netrw_hide == 2 + exe 'keepjumps silent '.w:netrw_bannercnt.',$v~'.hide.'~d' + endif + endwhile + +" call Dret("NetrwListHide") +endfun + +" --------------------------------------------------------------------- +" NetHideEdit: allows user to edit the file/directory hiding list +fun! s:NetHideEdit(mode) +" call Dfunc("NetHideEdit(mode=".a:mode.")") + + call inputsave() + let newhide= input("Edit Hiding List: ",g:netrw_list_hide) + call inputrestore() + + " refresh the listing + let g:netrw_list_hide= newhide + if a:mode == 0 + silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) + else + silent call s:LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,"./")) + endif + +" call Dret("NetHideEdit") +endfun + +" --------------------------------------------------------------------- +" NetSortSequence: allows user to edit the sorting sequence +fun! s:NetSortSequence(mode) +" call Dfunc("NetSortSequence(mode=".a:mode.")") + + call inputsave() + let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) + call inputrestore() + + " refresh the listing + let g:netrw_sort_sequence= newsortseq + if a:mode == 0 + silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) + else + silent call s:LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,"./")) + endif + +" call Dret("NetSortSequence") +endfun + +" --------------------------------------------------------------------- +" NetLongList: {{{2 +fun! s:NetLongList(mode) +" call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".g:netrw_longlist) + call netrw#NetSavePosn() + + if g:netrw_longlist != 0 + " turn long listing off +" call Decho("turn long listing off") + let g:netrw_longlist = 0 + let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') + + else + " turn long listing on +" call Decho("turn long listing on") + let g:netrw_longlist = 1 + let g:netrw_list_cmd = g:netrw_list_cmd." -l" + endif + setlocal ma + + " clear buffer - this will cause NetBrowse/LocalBrowse to do a refresh + %d + + " refresh the listing + if a:mode == 0 + silent call NetBrowse(NetBrowseChgDir(expand("%"),"./")) + else + silent call s:LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,"./")) + endif + + call netrw#NetRestorePosn() + +" call Dret("NetLongList : g:netrw_longlist=".g:netrw_longlist) +endfun + +" --------------------------------------------------------------------- +" NetSaveWordPosn: used by the "s" command in both remote and local {{{2 +" browsing. Along with NetRestoreWordPosn(), it keeps the cursor on +" the same word even though the sorting has changed its order of appearance. +fun! s:NetSaveWordPosn() +" call Dfunc("NetSaveWordPosn()") + let s:netrw_saveword= '^'.escape(getline("."),s:netrw_cd_escape).'$' +" call Dret("NetSaveWordPosn : saveword<".s:netrw_saveword.">") +endfun + +" --------------------------------------------------------------------- +" NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2 +fun! s:NetRestoreWordPosn() +" call Dfunc("NetRestoreWordPosn()") + silent! call search(s:netrw_saveword,'w') +" call Dret("NetRestoreWordPosn") +endfun + +" --------------------------------------------------------------------- +" NetMakeDir: this function makes a directory (both local and remote) {{{2 +fun! s:NetMakeDir(usrhost) +" call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)") + + " get name of new directory from user. A bare will skip. + " if its currently a directory, also request will be skipped, but with + " a message. + call inputsave() + let newdirname= input("Please give directory name: ") + call inputrestore() +" call Decho("newdirname<".newdirname.">") + + if newdirname == "" +" call Dret("NetMakeDir : user aborted with bare ") + return + endif + + if a:usrhost == "" + + " Local mkdir: + " sanity checks + let fullnewdir= b:netrw_curdir.'/'.newdirname +" call Decho("fullnewdir<".fullnewdir.">") + if isdirectory(fullnewdir) + if !exists("g:netrw_quiet") + echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("NetMakeDir : directory<".newdirname."> exists previously") + return + endif + if filereadable(fullnewdir) + if !exists("g:netrw_quiet") + echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("NetMakeDir : file<".newdirname."> exists previously") + return + endif + + " requested new local directory is neither a pre-existing file or + " directory, so make it! + if exists("*mkdir") + call mkdir(fullnewdir,"p") + else + let netrw_origdir= s:NetGetcwd(1) + exe 'cd '.b:netrw_curdir +" call Decho("netrw_origdir<".netrw_origdir."> b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("exe silent! !".g:netrw_local_mkdir.' "'.newdirname.'"') + exe "silent! !".g:netrw_local_mkdir.' "'.newdirname.'"' + if !g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif + endif + + if v:shell_error == 0 + " refresh listing +" call Decho("refresh listing") + let linenum= line(".") + norm! H0 + let hline = line(".") + set ma|norm! 2D + call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./')) + exe "norm! ".hline."G0z\" + exe linenum + elseif !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + redraw! + + else + " Remote mkdir: + let mkdircmd = substitute(g:netrw_mkdir_cmd,'\',a:usrhost,'') + let newdirname= "'".'"'.substitute(expand("%"),'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname.'"'."'" +" call Decho("exe silent! !".mkdircmd." ".newdirname) + exe "silent! !".mkdircmd." ".newdirname + if v:shell_error == 0 + " refresh listing + let linenum= line(".") + norm! H0 + let hline = line(".") + call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) + exe "norm! ".hline."G0z\" + exe linenum + elseif !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + redraw! + endif + +" call Dret("NetMakeDir") +endfun + +" --------------------------------------------------------------------- +" NetBookmarkDir: {{{2 +" 0: (user: ) bookmark current directory +" 1: (user: ) change to the bookmarked directory +" 2: (user: ) list bookmarks +" 3: (LocalBrowse) record current directory history +" 4: (user: ) go up (previous) bookmark +" 5: (user: ) go down (next) bookmark +fun! s:NetBookmarkDir(chg,curdir) +" call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count) + if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt + " looks like a "b" was pressed while in the banner region + if line("$") > w:netrw_bannercnt + exe w:netrw_bannercnt + endif + echo "" +" call Dret("NetBookmarkDir - ignoring") + return + endif + + if a:chg == 0 + " bookmark the current directory + let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir + if !exists("g:NETRW_BOOKMARKMAX") + let g:NETRW_BOOKMARKMAX= v:count + elseif v:count > g:NETRW_BOOKMARKMAX + let g:NETRW_BOOKMARKMAX= v:count + endif + echo "bookmarked the current directory" + + elseif a:chg == 1 + " change to the bookmarked directory + if exists("g:NETRW_BOOKMARKDIR_{v:count}") + exe "e ".g:NETRW_BOOKMARKDIR_{v:count} + else + echomsg "Sorry, bookmark#".v:count." doesn't exist!" + endif + + elseif a:chg == 2 + " list user's bookmarks + if exists("g:NETRW_BOOKMARKMAX") +" call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]") + let cnt= 0 + while cnt <= g:NETRW_BOOKMARKMAX + if exists("g:NETRW_BOOKMARKDIR_{cnt}") +" call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}) + echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt} + endif + let cnt= cnt + 1 + endwhile + endif + + " list directory history + let cnt = g:NETRW_DIRHIST_CNT + let first = 1 + let histcnt = 0 + while ( first || cnt != g:NETRW_DIRHIST_CNT ) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT) + let histcnt= histcnt + 1 + if exists("g:NETRW_DIRHIST_{cnt}") +" call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}) + echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt} + endif + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + if cnt < 0 + let cnt= cnt + g:netrw_dirhistmax + endif + endwhile + + elseif a:chg == 3 + " saves most recently visited directories (when they differ) + if !exists("g:NETRW_DIRHIST_0") || g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} != a:curdir + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax + let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e') +" call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + endif + + elseif a:chg == 4 + " u: change to the previous directory stored on the history list + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax + if g:NETRW_DIRHIST_CNT < 0 + let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax + endif + if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") +" call Decho("changedir u#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} + else + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax + echo "Sorry, no predecessor directory exists yet" + endif + + elseif a:chg == 5 + " U: change to the subsequent directory stored on the history list + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax + if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") +" call Decho("changedir U#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} + else + let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax + if g:NETRW_DIRHIST_CNT < 0 + let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax + endif + echo "Sorry, no successor directory exists yet" + endif + endif +" call Dret("NetBookmarkDir") +endfun + +" ========================================== +" Local Directory Browsing Support: {{{1 +" ========================================== + +" --------------------------------------------------------------------- +" 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. + if isdirectory(a:dirname) + call netrw#DirBrowse(a:dirname) + endif + " not a directory, ignore it +endfun + +" --------------------------------------------------------------------- +" DirBrowse: supports local file/directory browsing {{{2 +fun! netrw#DirBrowse(dirname) +" call Dfunc("DirBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by) +" call Dredir("ls!") + + if exists("s:netrw_skipbrowse") + unlet s:netrw_skipbrowse +" call Dret("DirBrowse") + return + endif + + if v:version < 603 + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** vim version<".v:version."> too old for browsing with netrw" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("DirBrowse : vim version<".v:version."> too old") + return + endif + + " record autochdir setting and then insure its unset (tnx to David Fishburn) + if has("netbeans_intg") || has("sun_workshop") + let keep_autochdir= &autochdir + set noautochdir + endif + + " use buffer-oriented WinVars if buffer ones exist but window ones don't + call s:UseBufWinVars() + + " find buffer number of buffer named precisely the same as a:dirname + let bufnum= bufnr(escape(a:dirname,'\')) +" call Decho("findbuf: bufnum=".bufnum) + if bufnum > 0 && bufname(bufnum) != a:dirname + let ibuf= 1 + let buflast= bufnr("$") + while bufname(ibuf) !~ '^'.a:dirname.'\=$' && ibuf <= buflast +" call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".a:dirname.">") + let ibuf= ibuf + 1 + endwhile + if ibuf > buflast + let bufnum= -1 + else + let bufnum= ibuf + endif +" call Decho("findbuf: bufnum=".bufnum." (final)") + endif + + " get cleared buffer + if bufnum < 0 + if v:version < 700 + enew! + else + keepalt enew! + endif +" call Decho("enew buffer") + else + if v:version < 700 + exe "b ".bufnum + else + exe "keepalt b ".bufnum + endif + if exists("s:last_sort_by") && g:netrw_sort_by == s:last_sort_by + if getline(2) =~ '^" Directory Listing ' + if !g:netrw_keepdir +" call Decho("change directory: cd ".b:netrw_curdir) + exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape) + endif +" call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">") + return + endif + endif + endif + let s:last_sort_by= g:netrw_sort_by + + " get the new directory name + if has("win32") || has("win95") || has("win64") || has("win16") + let b:netrw_curdir= substitute(a:dirname,'\\','/','ge') + else + let b:netrw_curdir= a:dirname + endif + if b:netrw_curdir =~ '[/\\]$' + let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') + endif +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") + + " make netrw's idea of the current directory vim's if the user wishes + if !g:netrw_keepdir +" call Decho("change directory: cd ".b:netrw_curdir) + try + exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape) + catch /^Vim\%((\a\+)\)\=:E472/ + echohl Error | echo "***netrw*** unable to change directory to <".b:netrw_curdir."> (permissions?)" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + if exists("w:netrw_prvdir") + let b:netrw_curdir= w:netrw_prvdir + else +" call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">") + return + endif + endtry + endif + + " change the name of the buffer to reflect the b:netrw_curdir + exe 'silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape) + + " make this buffer modifiable and hidden + setlocal ma hidden nonu bt=nofile + if v:version < 700 + silent! %d + else + keepalt silent! %d + endif + + " --------------------------- + " Perform Directory Listing: + + " save current directory on directory history list + call NetBookmarkDir(3,b:netrw_curdir) + + " set up all the maps +" call Decho("Setting up local browser maps") + nnoremap :exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) + nnoremap :set ma%dcall LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,'./'))redraw! + nnoremap - :exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,'../')) + nnoremap a :let g:netrw_hide=(g:netrw_hide+1)%3exe "norm! 0"call LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,'./')) + nnoremap b :call NetBookmarkDir(0,b:netrw_curdir) + nnoremap B :call NetBookmarkDir(1,b:netrw_curdir) + nnoremap c :exe "cd ".b:netrw_curdir + nnoremap d :call NetMakeDir("") + nnoremap :call NetHideEdit(1) + nnoremap i :call NetLongList(1) + nnoremap o :call NetSplit(2) + nnoremap p :exe "norm! 0"call LocalPreview(LocalBrowseChgDir(b:netrw_curdir,NetGetWord(),1)) + nnoremap q :call NetBookmarkDir(2,b:netrw_curdir) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,'./')) + nnoremap s :call NetSaveWordPosn()let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,'./'))call NetRestoreWordPosn() + nnoremap S :call NetSortSequence(1) + nnoremap u :call NetBookmarkDir(4,expand("%")) + nnoremap U :call NetBookmarkDir(5,expand("%")) + nnoremap v :call NetSplit(3) + nnoremap x :exe "norm! 0"call NetBrowseX(LocalBrowseChgDir(b:netrw_curdir,NetGetWord(),0),0) + nnoremap <2-leftmouse> :exe "norm! 0"call LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) + nnoremap :Pexplore + nnoremap :Nexplore + exe 'nnoremap :exe "norm! 0"call LocalBrowseRm("'.b:netrw_curdir.'")' + exe 'vnoremap :call LocalBrowseRm("'.b:netrw_curdir.'")' + exe 'nnoremap D :exe "norm! 0"call LocalBrowseRm("'.b:netrw_curdir.'")' + exe 'vnoremap D :call LocalBrowseRm("'.b:netrw_curdir.'")' + exe 'nnoremap R :exe "norm! 0"call LocalBrowseRename("'.b:netrw_curdir.'")' + exe 'vnoremap R :call LocalBrowseRename("'.b:netrw_curdir.'")' + exe 'nnoremap m :call NetMakeDir("")' + nnoremap ? :he netrw-dir + + " Set up the banner +" call Decho("set up banner") + keepjumps put ='\" ============================================================================' + keepjumps 1d + keepjumps put ='\" Directory Listing (netrw '.g:loaded_netrw.')' + keepjumps put ='\" '.b:netrw_curdir + let w:netrw_bannercnt= 3 + + let sortby= g:netrw_sort_by + if g:netrw_sort_direction =~ "^r" + let sortby= sortby." reversed" + endif + + " Sorted by... + if g:netrw_sort_by =~ "^n" +" call Decho("directories will be sorted by name") + " sorted by name + keepjumps put ='\" Sorted by '.sortby + keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence + let w:netrw_bannercnt= w:netrw_bannercnt + 2 + else +" call Decho("directories will be sorted by size or date") + " sorted by size or date + keepjumps put ='\" Sorted by '.sortby + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + endif + + " Hiding... -or- Showing... + if g:netrw_list_hide != "" && g:netrw_hide + if g:netrw_hide == 1 + keepjumps put ='\" Hiding: '.g:netrw_list_hide + else + keepjumps put ='\" Showing: '.g:netrw_list_hide + endif + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + endif + keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec' + keepjumps put ='\" ============================================================================' + let w:netrw_bannercnt= w:netrw_bannercnt + 2 + + " bannercnt should index the line just after the banner + let w:netrw_bannercnt= w:netrw_bannercnt + 1 +" call Decho("bannercnt=".w:netrw_bannercnt) + + " generate the requested directory listing + call s:LocalBrowseList() + + " set up syntax highlighting + if has("syntax") + setlocal ft=netrwlist + if !exists("g:syntax_on") || !g:syntax_on + setlocal ft= + endif + endif + + " manipulate the directory listing (hide, sort) + if line("$") >= w:netrw_bannercnt + if g:netrw_hide && g:netrw_list_hide != "" + call s:NetrwListHide() + endif + if line("$") >= w:netrw_bannercnt + + if g:netrw_sort_by =~ "^n" + call s:SetSort() + + if v:version < 700 + exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()' + elseif g:netrw_sort_direction =~ 'n' + exe 'keepjumps silent '.w:netrw_bannercnt.',$sort' + else + exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!' + endif + exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e' + + else + if v:version < 700 + exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()' + elseif g:netrw_sort_direction =~ 'n' + exe 'keepjumps silent '.w:netrw_bannercnt.',$sort' + else + exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!' + endif + exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{-}\///e' + endif + + endif + endif + if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt + exe w:netrw_bannercnt + endif + + " record previous current directory + let w:netrw_prvdir= b:netrw_curdir + + " save certain window-oriented variables into buffer-oriented variables + call s:BufWinVars() + + setlocal noma nomod nonu bh=hide nobl + if has("netbeans_intg") || has("sun_workshop") + let &autochdir= keep_autochdir + endif + +" call Dret("DirBrowse : file<".expand("%:p")."> bufname<".bufname("%").">") +endfun + +" --------------------------------------------------------------------- +" LocalBrowseList: does the job of "ls" for local directories {{{2 +fun! s:LocalBrowseList() +" call Dfunc("LocalBrowseList() b:netrw_curdir<".b:netrw_curdir.">") + + " get the list of files contained in the current directory + let dirname = escape(b:netrw_curdir,s:netrw_glob_escape) + let dirnamelen = strlen(b:netrw_curdir) + let filelist = glob(dirname."/*") +" call Decho("glob(dirname<".dirname.">,*)=".filelist) + if filelist != "" + let filelist= filelist."\n" + endif + let filelist= filelist.glob(dirname."/.*") +" call Decho("glob(dirname<".dirname.">,.*)=".glob(dirname.".*")) + + " if the directory name includes a "$", and possibly other characters, + " the glob() doesn't include "." and ".." entries. + if filelist !~ '[\\/]\.[\\/]\=\(\n\|$\)' +" call Decho("forcibly tacking on .") + if filelist == "" + let filelist= dirname."." + else + let filelist= filelist."\n".b:netrw_curdir."." + endif +" call Decho("filelist<".filelist.">") + endif + if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' +" call Decho("forcibly tacking on ..") + let filelist= filelist."\n".b:netrw_curdir.".." +" call Decho("filelist<".filelist.">") + endif + let filelist= substitute(filelist,'\n\{2,}','\n','ge') + +" call Decho("dirname<".dirname.">") +" call Decho("dirnamelen<".dirnamelen.">") +" call Decho("filelist<".filelist.">") + + while filelist != "" + if filelist =~ '\n' + let filename = substitute(filelist,'\n.*$','','e') + let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') + else + let filename = filelist + let filelist = "" + endif + let pfile= filename + if isdirectory(filename) + let pfile= filename."/" + endif + if pfile =~ '//$' + let pfile= substitute(pfile,'//$','/','e') + endif + let pfile= strpart(pfile,dirnamelen) + let pfile= substitute(pfile,'^/','','e') +" call Decho(" ") +" call Decho("filename<".filename.">") +" call Decho("pfile <".pfile.">") + + if g:netrw_longlist + let sz = getfsize(filename) + if v:version <= 700 + let fsz = strpart(" ",1,15-strlen(sz)).sz + let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) + else + let pfile= printf('%-'.g:netrw_maxfilenamelen.'s%15d%s',pfile,sz,getftime(filename)) + endif +" call Decho("sz=".sz." fsz=".fsz) + endif + + if g:netrw_sort_by =~ "^t" + " sort by time (handles time up to 1 quintillion seconds, US) +" call Decho("getftime(".filename.")=".getftime(filename)) + let t = getftime(filename) + let ft = strpart("000000000000000000",1,18-strlen(t)).t +" call Decho("exe keepjumps put ='".ft.'/'.filename."'") + let ftpfile= ft.'/'.pfile + keepjumps put=ftpfile + + elseif g:netrw_sort_by =~ "^s" + " sort by size (handles file sizes up to 1 quintillion bytes, US) +" call Decho("getfsize(".filename.")=".getfsize(filename)) + let sz = getfsize(filename) + let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz +" call Decho("exe keepjumps put ='".fsz.'/'.filename."'") + let fszpfile= fsz.'/'.pfile + keepjumps put =fszpfile + + else + " sort by name +" call Decho("exe keepjumps put ='".pfile."'") + keepjumps put=pfile + endif + endwhile + setlocal ts=32 + +" call Dret("LocalBrowseList") +endfun + +" --------------------------------------------------------------------- +" LocalBrowseChgDir: constructs a new directory based on the current {{{2 +" directory and a new directory name +fun! s:LocalBrowseChgDir(dirname,newdir,...) +" call Dfunc("LocalBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">) a:0=".a:0) + + let dirname= substitute(a:dirname,'\\','','ge') + let newdir = a:newdir + + if dirname !~ '[\/]$' + " apparently vim is "recognizing" that it is in the home directory and + " is removing the "/". Bad idea, so I have to put it back. + let dirname= dirname.'/' +" call Decho("adjusting dirname<".dirname.">") + endif + + if newdir !~ '[\/]$' + " handling a file + let dirname= dirname.newdir +" call Decho("handling a file: dirname<".dirname.">") + " this lets NetBrowseX avoid the edit + if a:0 < 1 +" call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">") +" call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">") + exe "e! ".escape(dirname,s:netrw_cd_escape) + endif + + elseif newdir == './' + " refresh the directory list +" call Decho("refresh directory listing") + + elseif newdir == '../' + " go up one directory + let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e') +" call Decho("go up one dir: dirname<".dirname.">") + + else + " go down one directory + let dirname= dirname.newdir +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") + endif + +" call Dret("LocalBrowseChgDir <".dirname.">") + return dirname +endfun + +" --------------------------------------------------------------------- +" LocalBrowseRm: {{{2 +fun! s:LocalBrowseRm(path) range +" call Dfunc("LocalBrowseRm(path<".a:path.">)") +" call Decho("firstline=".a:firstline." lastline=".a:lastline) + + " preparation for removing multiple files/directories + let ctr = a:firstline + let ret = 0 + let all= 0 + + " remove multiple files and directories + while ctr <= a:lastline + exe "keepjumps ".ctr + + " sanity checks + if line(".") < w:netrw_bannercnt + let ctr= ctr + 1 + continue + endif + let curword= s:NetGetWord() + if curword == "./" || curword == "../" + let ctr= ctr + 1 + continue + endif + + norm! 0 + let rmfile= a:path."/".curword +" call Decho("rmfile<".rmfile.">") + + if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') + " attempt to remove file + if !all + echohl Statement + call inputsave() + let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + echohl NONE + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + + if all || ok =~ 'y\%[es]' || ok == "" + let ret= delete(rmfile) +" call Decho("errcode=".v:shell_error." ret=".ret) + elseif ok =~ 'q\%[uit]' + break + endif + + else + " attempt to remove directory + if !all + echohl Statement + call inputsave() + let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") + call inputrestore() + let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') + if ok =~ 'a\%[ll]' + let all= 1 + endif + endif + let rmfile= substitute(rmfile,'[\/]$','','e') + + if all || ok =~ 'y\%[es]' || ok == "" +" call Decho("1st attempt: system(".g:netrw_local_rmdir.' "'.rmfile.'")') + call system(g:netrw_local_rmdir.' "'.rmfile.'"') +" call Decho("v:shell_error=".v:shell_error) + + if v:shell_error != 0 +" call Decho("2nd attempt to remove directory<".rmfile.">") + let errcode= delete(rmfile) +" call Decho("errcode=".errcode) + + if errcode != 0 + if has("unix") +" call Decho("3rd attempt to remove directory<".rmfile.">") + call system("rm ".rmfile) + if v:shell_error != 0 && !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + elseif !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + endif + endif + + elseif ok =~ 'q\%[uit]' + break + endif + endif + + let ctr= ctr + 1 + endwhile + + " refresh the directory + let curline= line(".") +" call Decho("refresh the directory") + call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./')) + exe curline + +" call Dret("LocalBrowseRm") +endfun + +" --------------------------------------------------------------------- +" LocalBrowseRename: rename a remote file or directory {{{2 +fun! s:LocalBrowseRename(path) range +" call Dfunc("LocalBrowseRename(path<".a:path.">)") + + " preparation for removing multiple files/directories + let ctr= a:firstline + + " attempt to rename files/directories + while ctr <= a:lastline + exe "keepjumps ".ctr + + " sanity checks + if line(".") < w:netrw_bannercnt + let ctr= ctr + 1 + continue + endif + let curword= s:NetGetWord() + if curword == "./" || curword == "../" + let ctr= ctr + 1 + continue + endif + + norm! 0 + let oldname= a:path."/".curword +" call Decho("oldname<".oldname.">") + + call inputsave() + let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) + call inputrestore() + + let ret= rename(oldname,newname) +" call Decho("renaming <".oldname."> to <".newname.">") + + let ctr= ctr + 1 + endwhile + + " refresh the directory + let curline= line(".") +" call Decho("refresh the directory listing") + call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./')) + exe "keepjumps ".curline +" call Dret("LocalBrowseRename") +endfun + +" --------------------------------------------------------------------- +" LocalPreview: {{{2 +fun! s:LocalPreview(path) range +" call Dfunc("LocalPreview(path<".a:path.">)") + if has("quickfix") + if !isdirectory(a:path) + exe "pedit ".a:path + elseif !exists("g:netrw_quiet") + echohl WarningMsg | echo "***netrw*** sorry, cannot preview a directory such as <".a:path.">" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + elseif !exists("g:netrw_quiet") + echohl WarningMsg | echo "***netrw*** sorry, to preview your vim needs the quickfix feature compiled in" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif +" call Dret("LocalPreview") +endfun + +" --------------------------------------------------------------------- +" LocalRefresh: {{{2 +fun! s:LocalRefresh(dirname) +" call Dfunc("LocalRefresh(dirname<".a:dirname.">)") + set ma + %d + call s:LocalBrowse(a:dirname) + redraw! +" call Dret("LocalRefresh") +endfun + +" --------------------------------------------------------------------- +" Explore: launch the local browser in the directory of the current file {{{2 +" dosplit==0: the window will be split iff the current file has +" been modified +" dosplit==1: the window will be split before running the local +" browser +fun! netrw#Explore(indx,dosplit,style,...) +" call Dfunc("Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.")") + + " if dosplit or file has been modified + if a:dosplit || &modified + call SaveWinVars() + + if a:style == 0 " Explore, Sexplore + exe g:netrw_winsize."wincmd s" +" call Decho("style=0: Explore or Sexplore") + + elseif a:style == 1 "Explore!, Sexplore! + exe g:netrw_winsize."wincmd v" +" call Decho("style=1: Explore! or Sexplore!") + + elseif a:style == 2 " Hexplore + exe "bel ".g:netrw_winsize."wincmd s" +" call Decho("style=2: Hexplore") + + elseif a:style == 3 " Hexplore! + exe "abo ".g:netrw_winsize."wincmd s" +" call Decho("style=3: Hexplore!") + + elseif a:style == 4 " Vexplore + exe "lefta ".g:netrw_winsize."wincmd v" +" call Decho("style=4: Vexplore") + + elseif a:style == 5 " Vexplore! + exe "rightb ".g:netrw_winsize."wincmd v" +" call Decho("style=5: Vexplore!") + endif + call s:CopyWinVars() + endif + norm! 0 + + if a:1 == "" && a:indx >= 0 + " Explore Hexplore Vexplore Sexplore + let newdir= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') + if newdir =~ '^scp:' || newdir =~ '^ftp:' +" call Decho("calling NetBrowse(newdir<".newdir.">)") + call s:NetBrowse(newdir) + else +" call Decho("calling LocalBrowse(newdir<".newdir.">)") + call s:LocalBrowse(newdir) + endif + + elseif a:1 =~ '\*\*/' || a:indx < 0 + " Nexplore Pexplore -or- Explore **/... + + if has("path_extra") && v:version >= 700 + if !exists("w:netrw_explore_indx") + let w:netrw_explore_indx= 0 + endif + let indx = a:indx + if indx == -1 + let indx= w:netrw_explore_indx + 1 + elseif indx == -2 + let indx= w:netrw_explore_indx - 1 + else + let w:netrw_explore_indx = 0 + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + let w:netrw_explore_list = split(expand(b:netrw_curdir."/".a:1),'\n') + let w:netrw_explore_listlen = len(w:netrw_explore_list) + if w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/' + echohl WarningMsg | echo "***netrw*** no files matched" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("Explore") + return + endif + endif + + " NetrwStatusLine support + let w:netrw_explore_indx= indx + if !exists("s:netrw_explore_stl") + let s:netrw_explore_stl= &stl + endif + set stl=%f\ %h%m%r%=%{NetrwStatusLine()} +" call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) + + " sanity check + if indx >= w:netrw_explore_listlen || indx < 0 + let indx= (indx < 0)? 0 : ( w:netrw_explore_listlen - 1 ) + echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("Explore") + return + endif + + exe "let dirfile= w:netrw_explore_list[".indx."]" +" call Decho("dirfile<".dirfile."> indx=".indx) + let newdir= substitute(dirfile,'/[^/]*$','','e') +" call Decho("newdir<".newdir.">") +" call Decho("calling LocalBrowse(newdir<".newdir.">)") + call s:LocalBrowse(newdir) + call search(substitute(dirfile,"^.*/","",""),"W") + let w:netrw_explore_mtchcnt = indx + 1 + let w:netrw_explore_bufnr = bufnr(".") + let w:netrw_explore_line = line(".") +" call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) + + else + if v:version < 700 + echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for Exploring with **!" | echohl None + elseif !exists("g:netrw_quiet") + echohl WarningMsg | echo "***netrw*** your vim needs the +path_extra feature for Exploring with **!" | echohl None | echohl None + endif + call inputsave()|call input("Press to continue")|call inputrestore() + endif + + else + let newdir= a:1 +" call Decho("calling LocalBrowse(newdir<".newdir.">)") + call s:LocalBrowse(newdir) + endif + +" call Dret("Explore") +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{2 +fun! NetrwStatusLine() +" 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") + 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 + +" --------------------------------------------------------------------- +" NetGetcwd: get the current directory. {{{2 +" Change backslashes to forward slashes, if any. +" If doesc is true, escape certain troublesome characters +fun! s:NetGetcwd(doesc) +" call Dfunc("NetGetcwd(doesc=".a:doesc.")") + let curdir= substitute(getcwd(),'\\','/','ge') + if curdir !~ '[\/]$' + let curdir= curdir.'/' + endif + if a:doesc + let curdir= escape(curdir,s:netrw_cd_escape) + endif +" call Dret("NetGetcwd <".curdir.">") + return curdir +endfun + +" --------------------------------------------------------------------- +" NetMethod: determine method of transfer {{{1 +" method == 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http (wget) +" 6: cadaver +" 7: rsync +" 8: fetch +" 9: sftp +fun! s:NetMethod(choice) " globals: method machine id passwd fname +" call Dfunc("NetMethod(a:choice<".a:choice.">)") + + " initialization + let b:netrw_method = 0 + let g:netrw_machine = "" + let b:netrw_fname = "" + let g:netrw_port = "" + + " Patterns: + " mipf : a:machine a:id password filename Use ftp + " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd + " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd + " rcpurm : rcp://[user@]host/filename Use rcp + " rcphf : [user@]host:filename Use rcp + " scpurm : scp://[user@]host[[#:]port]/filename Use scp + " httpurm : http://[user@]host/filename Use wget + " davurm : [s]dav://host[:port]/path Use cadaver + " rsyncurm : rsync://host[:port]/path Use rsync + " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) + " sftpurm : sftp://[user@]host/filename Use scp + let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' + let mf = '^\(\S\+\)\s\+\(\S\+\)$' + let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' + let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' + let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' + let scpurm = '^scp://\([^/]\{-}\)\([#:]\d\+\)\=/\(.*\)$' + let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$' + let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' + let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' + let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' + let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' + +" call Decho("determine method:") + " Determine Method + " rcp://user@hostname/...path-to-file + if match(a:choice,rcpurm) == 0 +" call Decho("rcp://...") + let b:netrw_method = 1 + let userid = substitute(a:choice,rcpurm,'\1',"") + let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") + let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"") + if userid != "" + let g:netrw_uid= userid + endif + + " scp://user@hostname/...path-to-file + elseif match(a:choice,scpurm) == 0 +" call Decho("scp://...") + let b:netrw_method = 4 + let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") + let g:netrw_port = substitute(a:choice,scpurm,'\2',"") + let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") + + " http://user@hostname/...path-to-file + elseif match(a:choice,httpurm) == 0 +" call Decho("http://...") + let b:netrw_method = 5 + let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") + let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") + + " dav://hostname[:port]/..path-to-file.. + elseif match(a:choice,davurm) == 0 +" call Decho("dav://...") + let b:netrw_method= 6 + if a:choice =~ '^s' + let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") + else + let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") + endif + let b:netrw_fname = substitute(a:choice,davurm,'\3',"") + + " rsync://user@hostname/...path-to-file + elseif match(a:choice,rsyncurm) == 0 +" call Decho("rsync://...") + let b:netrw_method = 7 + let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") + let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") + + " ftp://[user@]hostname[[:#]port]/...path-to-file + elseif match(a:choice,ftpurm) == 0 +" call Decho("ftp://...") + let userid = substitute(a:choice,ftpurm,'\2',"") + let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") + let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") + let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") + if userid != "" + let g:netrw_uid= userid + endif + if exists("g:netrw_uid") && exists("g:netrw_passwd") + let b:netrw_method = 3 + else + if filereadable(expand("$HOME/.netrc")) && !exists("g:netrw_ignorenetrc") + let b:netrw_method= 2 + else + if !exists("g:netrw_uid") || g:netrw_uid == "" + call NetUserPass() + elseif !exists("g:netrw_passwd") || g:netrw_passwd == "" + call NetUserPass(g:netrw_uid) + " else just use current g:netrw_uid and g:netrw_passwd + endif + let b:netrw_method= 3 + endif + endif + + elseif match(a:choice,fetchurm) == 0 +" call Decho("fetch://...") + let b:netrw_method = 8 + let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") + let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") + let b:netrw_option = substitute(a:choice,fetchurm,'\4',"") + let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"") + + " Issue an ftp : "machine id password [path/]filename" + elseif match(a:choice,mipf) == 0 +" call Decho("(ftp) host id pass file") + let b:netrw_method = 3 + let g:netrw_machine = substitute(a:choice,mipf,'\1',"") + let g:netrw_uid = substitute(a:choice,mipf,'\2',"") + let g:netrw_passwd = substitute(a:choice,mipf,'\3',"") + let b:netrw_fname = substitute(a:choice,mipf,'\4',"") + + " Issue an ftp: "hostname [path/]filename" + elseif match(a:choice,mf) == 0 +" call Decho("(ftp) host file") + if exists("g:netrw_uid") && exists("g:netrw_passwd") + let b:netrw_method = 3 + let g:netrw_machine = substitute(a:choice,mf,'\1',"") + let b:netrw_fname = substitute(a:choice,mf,'\2',"") + + elseif filereadable(expand("$HOME/.netrc")) + let b:netrw_method = 2 + let g:netrw_machine = substitute(a:choice,mf,'\1',"") + let b:netrw_fname = substitute(a:choice,mf,'\2',"") + endif + + " sftp://user@hostname/...path-to-file + elseif match(a:choice,sftpurm) == 0 +" call Decho("sftp://...") + let b:netrw_method = 9 + let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") + let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") + + " Issue an rcp: hostname:filename" (this one should be last) + elseif match(a:choice,rcphf) == 0 +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") + let b:netrw_method = 1 + let userid = substitute(a:choice,rcphf,'\2',"") + let g:netrw_machine= substitute(a:choice,rcphf,'\3',"") + let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") + if userid != "" + let g:netrw_uid= userid + endif + if has("win32") || has("win95") || has("win64") || has("win16") + " don't let PCs try <.netrc> + let b:netrw_method = 3 + endif + + else + if !exists("g:netrw_quiet") + echohl Error | echo "***netrw*** cannot determine method" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + let b:netrw_method = -1 + endif + + " remove any leading [:#] from port number + if g:netrw_port != "" + let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','') + endif + +" call Decho("a:choice <".a:choice.">") +" call Decho("b:netrw_method <".b:netrw_method.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_port <".g:netrw_port.">") +" if exists("g:netrw_uid") "Decho +" call Decho("g:netrw_uid <".g:netrw_uid.">") +" endif "Decho +" if exists("g:netrw_passwd") "Decho +" call Decho("g:netrw_passwd <".g:netrw_passwd.">") +" endif "Decho +" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Dret("NetMethod") +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 + +" ------------------------------------------------------------------------ +" NetOptionSave: save options and set to "standard" form {{{1 +fun!s:NetOptionSave() +" call Dfunc("NetOptionSave()") + + " Get Temporary Filename + let s:aikeep = &ai + let s:cinkeep = &cin + let s:cinokeep = &cino + let s:comkeep = &com + let s:cpokeep = &cpo + let s:dirkeep = getcwd() + let s:gdkeep = &gd + let s:twkeep = &tw + setlocal cino = + setlocal com = + setlocal cpo -=aA + setlocal nocin noai + setlocal tw =0 + if has("win32") && !has("win95") + let s:swfkeep= &swf + setlocal noswf +" call Decho("setting s:swfkeep to <".&swf.">") + endif + +" call Dret("NetOptionSave") +endfun + +" ------------------------------------------------------------------------ +" NetOptionRestore: restore options {{{1 +fun! s:NetOptionRestore() +" call Dfunc("NetOptionRestore()") + + let &ai = s:aikeep + let &cin = s:cinkeep + let &cino = s:cinokeep + let &com = s:comkeep + let &cpo = s:cpokeep + exe "lcd ".s:dirkeep + let &gd = s:gdkeep + let &tw = s:twkeep + if exists("s:swfkeep") + if &directory == "" + " user hasn't specified a swapfile directory; + " netrw will temporarily make the swapfile + " directory the current local one. + let &directory = getcwd() + silent! let &swf = s:swfkeep + set directory= + else + let &swf= s:swfkeep + endif + unlet s:swfkeep + endif + unlet s:aikeep + unlet s:cinkeep + unlet s:cinokeep + unlet s:comkeep + unlet s:cpokeep + unlet s:gdkeep + unlet s:twkeep + unlet s:dirkeep + +" call Dret("NetOptionRestore") +endfun + +" ------------------------------------------------------------------------ +" NetReadFixup: this sort of function is typically written by the user {{{1 +" to handle extra junk that their system's ftp dumps +" into the transfer. This function is provided as an +" example and as a fix for a Windows 95 problem: in my +" experience, win95's ftp always dumped four blank lines +" at the end of the transfer. +if has("win95") && g:netrw_win95ftp + fun! NetReadFixup(method, line1, line2) +" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") + if method == 3 " ftp (no <.netrc>) + let fourblanklines= line2 - 3 + silent fourblanklines.",".line2."g/^\s*/d" + endif +" call Dret("NetReadFixup") + endfun +endif + +" --------------------------------------------------------------------- +" NetSort: Piet Delport's BISort2() function, modified to take a range {{{1 +if v:version < 700 + fun! s:NetSort() range +" " call Dfunc("NetSort()") + + let i = a:firstline + 1 + while i <= a:lastline + " find insertion point via binary search + let i_val = getline(i) + let lo = a:firstline + let hi = i + while lo < hi + let mid = (lo + hi) / 2 + let mid_val = getline(mid) + if g:netrw_sort_direction =~ '^n' + " normal sorting order + if i_val < mid_val + let hi = mid + else + let lo = mid + 1 + if i_val == mid_val | break | endif + endif + else + " reverse sorting order + if i_val > mid_val + let hi = mid + else + let lo = mid + 1 + if i_val == mid_val | break | endif + endif + endif + endwhile + " do insert + if lo < i + exe 'keepjumps '.i.'d_' + keepjumps call append(lo - 1, i_val) + endif + let i = i + 1 + endwhile + +" " call Dret("NetSort") + endfun +endif + +" --------------------------------------------------------------------- +" SetSort: sets up the sort based on the g:netrw_sort_sequence {{{1 +" What this function does is to compute a priority for the patterns +" in the g:netrw_sort_sequence. It applies a substitute to any +" "files" that satisfy each pattern, putting the priority / in +" front. An "*" pattern handles the default priority. +fun! s:SetSort() +" call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt) + if g:netrw_longlist + let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge') + else + let seqlist = g:netrw_sort_sequence + endif + " sanity check -- insure that * appears somewhere + if seqlist == "" + let seqlist= '*' + elseif seqlist !~ '\*' + let seqlist= seqlist.',*' + endif + let priority = 1 + while seqlist != "" + if seqlist =~ ',' + let seq = substitute(seqlist,',.*$','','e') + let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e') + else + let seq = seqlist + let seqlist = "" + endif + let eseq= escape(seq,'/') + if priority < 10 + let spriority= "00".priority.'\/' + elseif priority < 100 + let spriority= "0".priority.'\/' + else + let spriority= priority.'\/' + endif +" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") + + " sanity check + if w:netrw_bannercnt > line("$") + " apparently no files were left after a Hiding pattern was used +" call Dret("SetSort : no files left after hiding") + return + endif + if seq == '*' + exe 'keepjumps silent '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/' + else + exe 'keepjumps silent '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/' + endif + let priority = priority + 1 + endwhile + + exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e' + +" call Dret("SetSort") +endfun + +" --------------------------------------------------------------------- +" SaveWinVars: (used by Explore()) {{{1 +fun! s:SaveWinVars() +" call Dfunc("SaveWinVars()") + if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif + if exists("w:netrw_method") |let s:method = w:netrw_method |endif + if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif + if exists("w:netrw_explore_indx") |let s:explore_indx = w:netrw_explore_indx |endif + if exists("w:netrw_explore_listlen")|let s:explore_listlen = w:netrw_explore_listlen|endif + if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif + if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif + if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif + if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif +" call Dret("SaveWinVars") +endfun + +" --------------------------------------------------------------------- +" CopyWinVars: (used by Explore()) {{{1 +fun! s:CopyWinVars() +" call Dfunc("CopyWinVars()") + if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif + if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif + if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif + if exists("s:explore_indx") |let w:netrw_explore_indx = s:explore_indx |unlet s:explore_indx |endif + if exists("s:explore_listlen")|let w:netrw_explore_listlen = s:explore_listlen|unlet s:explore_listlen|endif + if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif + if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif + if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif + if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif +" call Dret("CopyWinVars") +endfun + +" --------------------------------------------------------------------- +" BufWinVars: (used by NetBrowse() and LocalBrowse()) {{{1 +" To allow separate windows to have their own activities, such as +" Explore **/pattern, several variables have been made window-oriented. +" However, when the user splits a browser window (ex: ctrl-w s), these +" variables are not inherited by the new window. BufWinVars() and +" UseBufWinVars() get around that. +fun! s:BufWinVars() +" call Dfunc("BufWinVars()") + if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif + if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif + if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif + if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif + if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen = w:netrw_explore_listlen|endif + if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = w:netrw_explore_mtchcnt|endif + if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif + if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif + if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif +" call Dret("BufWinVars") +endfun + +" --------------------------------------------------------------------- +" UseBufWinVars: (used by NetBrowse() and LocalBrowse() {{{1 +" Matching function to BufferWinVars() +fun! s:UseBufWinVars() +" call Dfunc("UseBufWinVars()") + if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif + if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif + if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif + if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif + if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif + if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif + if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif + if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif + if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif +" call Dret("UseBufWinVars") +endfun + +" ------------------------------------------------------------------------ +" Settings Restoration: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo + +" ------------------------------------------------------------------------ +" Modelines: {{{1 +" vim:ts=8 fdm=marker diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f98bd9372..61a22df73 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4683,7 +4683,21 @@ instead of "s:" when the mapping is expanded outside of the script. {name} can also be a Dictionary entry that is a Funcref: > :function dict.init -< *E124* *E125* +< + *:function-verbose* +When 'verbose' is non-zero, listing a function will also display where it was +last defined. Example: > + + :verbose function SetFileTypeSH + function SetFileTypeSH(name) + Last set from /usr/share/vim/vim-7.0/filetype.vim +< +When the function was defined by hand there is no "Last set" message. When +the function was defined while executing a function, user command or +autocommand, the script in which it was defined is reported. +{not available when compiled without the +eval feature} + + *E124* *E125* :fu[nction][!] {name}([arguments]) [range] [abort] [dict] Define a new function by the name {name}. The name must be made of alphanumeric characters and '_', and diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index de29f0fbc..a135a481a 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.0aa. Last change: 2005 Jul 21 +*map.txt* For Vim version 7.0aa. Last change: 2005 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -868,6 +868,20 @@ scripts. :com[mand] {cmd} List the user-defined commands that start with {cmd} + *:command-verbose* +When 'verbose' is non-zero, listing a command will also display where it was +last defined. Example: > + + :verbose command TOhtml + Name Args Range Complete Definition + TOhtml 0 % :call Convert2HTML(, ) + Last set from /usr/share/vim/vim-7.0/plugin/tohtml.vim +< +When the command was defined by hand there is no "Last set" message. When the +command was defined while executing a function, user command or autocommand, +the script in which it was defined is reported. +{not available when compiled without the +eval feature} + *E174* *E182* :com[mand][!] [{attr}...] {cmd} {rep} Define a user command. The name of the command is @@ -1069,8 +1083,7 @@ To allow commands to pass their arguments on to a user-defined function, there is a special form ("function args"). This splits the command arguments at spaces and Tabs, quotes each argument individually, and the sequence is replaced by the comma-separated list of quoted arguments. -See the Mycmd example below. When there is no argument, also has no -argument. +See the Mycmd example below. If no arguments are given is removed. Examples > diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 4cc59c3e9..00718833f 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.0. Last change: Aug 11, 2005 +*pi_netrw.txt* For Vim version 7.0. Last change: Aug 15, 2005 VIM REFERENCE MANUAL by Charles E. Campbell, Jr. @@ -11,6 +11,13 @@ 0. Contents *netrw-contents* 1. Netrw Reference......................................|netrw-ref| + CONTROLLING EXTERNAL APPLICTIONS...................|netrw-externapp| + READING............................................|netrw-read| + WRITING............................................|netrw-write| + DIRECTORY LISTING..................................|netrw-dirlist| + CHANGING THE USERID AND PASSWORD...................|netrw-chgup| + VARIABLES..........................................|netrw-variables| + PATHS..............................................|netrw-path| 2. Network-Oriented File Transfer.......................|netrw-xfer| NETRC..............................................|netrw-netrc| PASSWORD...........................................|netrw-passwd| @@ -53,8 +60,10 @@ 10. History..............................................|netrw-history| 11. Credits..............................................|netrw-credits| -The functionality mentioned here is done via using |standard-plugin| -techniques. This plugin is only available if +The Netrw plugin is generally sourced automatically as it is a +|standard-plugin|. That said, to make use of netrw, one must +have plugins available which can be done with the following +two lines in your <.vimrc>: set nocp " 'compatible' is not set filetype plugin on " plugins are enabled @@ -69,62 +78,51 @@ in your <.vimrc> file: > ============================================================================== 1. Netrw Reference *netrw-ref* - OPTIONS - let g:netrw_ftp =0 use ftp (default) (uid password) - =1 use alternate ftp method (user uid password) - If you're having trouble with ftp, try changing the value - of this variable in your <.vimrc> to change methods - - let g:netrw_ignorenetrc= 1 - If you have a <.netrc> file but it doesn't work and you - want it ignored, then set this variable as shown. Its mere - existence is enough to cause <.netrc> to be ignored. - - Controlling External Applications *netrw-externapp* - - Protocol Variable Default Value - -------- ---------------- ------------- - dav: *g:netrw_dav_cmd* = "cadaver" - fetch: *g:netrw_fetch_cmd* = "fetch -o" - ftp: *g:netrw_ftp_cmd* = "ftp" - http: *g:netrw_http_cmd* = "fetch -o" if fetch is available - http: g:netrw_http_cmd = "wget -q -O" If wget is available - rcp: *g:netrw_rcp_cmd* = "rcp" - rsync: *g:netrw_rsync_cmd* = "rsync -a" - scp: *g:netrw_scp_cmd* = "scp -q" - sftp: *g:netrw_sftp_cmd* = "sftp" - - READING *netrw-read* *netrw-nread* +CONTROLLING EXTERNAL APPLICTIONS *netrw-externapp* + + Protocol Variable Default Value + -------- ---------------- ------------- + dav: *g:netrw_dav_cmd* = "cadaver" + fetch: *g:netrw_fetch_cmd* = "fetch -o" + ftp: *g:netrw_ftp_cmd* = "ftp" + http: *g:netrw_http_cmd* = "fetch -o" if fetch is available + http: g:netrw_http_cmd = "wget -q -O" If wget is available + rcp: *g:netrw_rcp_cmd* = "rcp" + rsync: *g:netrw_rsync_cmd* = "rsync -a" + scp: *g:netrw_scp_cmd* = "scp -q" + sftp: *g:netrw_sftp_cmd* = "sftp" + +READING *netrw-read* *netrw-nread* :Nread ? give help :Nread "machine:path" uses rcp - :Nread "machine path" uses ftp with <.netrc> + :Nread "machine path" uses ftp w/ <.netrc> :Nread "machine id password path" uses ftp :Nread "dav://machine[:port]/path" uses cadaver :Nread "fetch://[user@]machine/path" uses fetch - :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp autodetects <.netrc> + :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> :Nread "http://[user@]machine/path" uses http uses wget :Nread "rcp://[user@]machine/path" uses rcp :Nread "rsync://[user@]machine[:port]/path" uses rsync :Nread "scp://[user@]machine[[:#]port]/path" uses scp :Nread "sftp://[user@]machine/path" uses sftp - WRITING *netrw-write* *netrw-nwrite* +WRITING *netrw-write* *netrw-nwrite* :Nwrite ? give help :Nwrite "machine:path" uses rcp - :Nwrite "machine path" uses ftp with <.netrc> + :Nwrite "machine path" uses ftp w/ <.netrc> :Nwrite "machine id password path" uses ftp :Nwrite "dav://machine[:port]/path" uses cadaver - :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp autodetects <.netrc> + :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> :Nwrite "rcp://[user@]machine/path" uses rcp :Nwrite "rsync://[user@]machine[:port]/path" uses rsync :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp :Nwrite "sftp://[user@]machine/path" uses sftp http: not supported! - DIRECTORY LISTING +DIRECTORY LISTING *netrw-dirlist* :Nread [protocol]://[user]@hostname/path/ - USER AND PASSWORD CHANGING + CHANGING USERID AND PASSWORD *netrw-chgup* Attempts to use ftp will prompt you for a user-id and a password. These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses of ftp will re-use those. If you need to use a different user id @@ -135,59 +133,61 @@ in your <.vimrc> file: > :call NetUserPass("uid") -- prompts for password :call NetUserPass("uid","password") -- sets global uid and password - VARIABLES *netrw-variables* - *b:netrw_lastfile* - last file Network-read/written retained on - a per-buffer basis (supports plain :Nw ) - *s:netrw_line* - during :Nw/NetWrite, holds current line number - *s:netrw_col* - during :Nw/NetWrite, holds current column number - s:netrw_line and s:netrw_col are used to - restore the cursor position on writes - *g:netrw_ftp* - if it doesn't exist, use default ftp - =0 use default ftp (uid password) - =1 use alternate ftp method (user uid password) - *g:netrw_ftpmode* - ="binary" (default) - ="ascii" - *g:netrw_uid* - (ftp) user-id, retained on a per-session basis - *g:netrw_passwd* - (ftp) password, retained on a per-session basis - *g:netrw_win95ftp* - =1 if using Win95, will remove four trailing blank - lines that o/s's ftp "provides" on transfers - =0 force normal ftp behavior (no trailing line - removal) - *g:netrw_cygwin* - =1 assume scp under windows is from cygwin - Also permits network browsing to use - ls with time and size sorting - (default if windows) - =0 assume Windows' scp accepts windows-style paths - Network browsing uses dir instead of ls - This option is ignored if you're using unix - *g:netrw_use_nt_rcp* - =0 don't use the rcp of WinNT, Win2000 and WinXP - =1 use WinNT's rcp in binary mode (default) - - PATHS *netrw-path* - - Paths to files are generally user-directory relative for most protocols. - It is possible that some protocol will make paths relative to some - associated directory, however. - - example: vim scp://user@host/somefile - example: vim scp://user@host/subdir1/subdir2/somefile - - where "somefile" is the "user"'s home directory. If you wish to get a - file using root-relative paths, use the full path: - - example: vim scp://user@host//somefile - example: vim scp://user@host//subdir1/subdir2/somefile +VARIABLES *netrw-variables* + *b:netrw_lastfile* last file Network-read/written retained on a per-buffer + basis (supports plain :Nw ) + *s:netrw_line* during :Nw/NetWrite, holds current line number + *s:netrw_col* during :Nw/NetWrite, holds current column number + s:netrw_line and s:netrw_col are used to + restore the cursor position on writes + + *g:netrw_ftp* if it doesn't exist, use default ftp + =0 use default ftp (uid password) + =1 use alternate ftp method (user uid password) + If you're having trouble with ftp, try changing the + value of this variable to see if the alternate ftp + method works for your setup. + + *g:netrw_ftpmode* ="binary" (default) + ="ascii" + + *g:netrw_ignorenetrc* =0 (default) + =1 If you have a <.netrc> file but it doesn't work and + you want it ignored, then set this variable as shown. + + *g:netrw_uid* (ftp) user-id, retained on a per-session basis + *g:netrw_passwd* (ftp) password, retained on a per-session basis + + *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank + lines that o/s's ftp "provides" on transfers + =0 force normal ftp behavior (no trailing line removal) + + *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also + permits network browsing to use ls with time and + size sorting (default if windows) + =0 assume Windows' scp accepts windows-style paths + Network browsing uses dir instead of ls + This option is ignored if you're using unix + + *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP + =1 use WinNT's rcp in binary mode (default) + +PATHS *netrw-path* + +Paths to files are generally user-directory relative for most protocols. +It is possible that some protocol will make paths relative to some +associated directory, however. +> + example: vim scp://user@host/somefile + example: vim scp://user@host/subdir1/subdir2/somefile +< +where "somefile" is the "user"'s home directory. If you wish to get a +file using root-relative paths, use the full path: +> + example: vim scp://user@host//somefile + example: vim scp://user@host//subdir1/subdir2/somefile +< ============================================================================== 2. Network-Oriented File Transfer *netrw-xfer* @@ -391,6 +391,9 @@ additional commands available. effectively remove the user-id and password by using "" strings. +:NetrwSettings This command is desribed in |netrw-settings| -- used to + display netrw settings and change netrw behavior + ============================================================================== 6. Variables and Options *netrw-options* *netrw-var* @@ -596,6 +599,7 @@ MAPS *netrw-maps* :Vexplore[!] [dir] Vertical Split & Explore.................|netrw-explore| :Pexplore[!] [dir] Vertical Split & Explore.................|netrw-explore| :Nexplore[!] [dir] Vertical Split & Explore.................|netrw-explore| + :NetrwSettings.............................................|netrw-settings| QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* > @@ -627,107 +631,102 @@ QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* NETRW BROWSER VARIABLES *netrw-browse-var* > - --- ----------- - Var Explanation - --- ----------- -< *g:netrw_alto* change from above splitting to - below splitting by setting this - variable (see |netrw-o|) - default: =0 - - *g:netrw_altv* change from left splitting to - right splitting by setting this - variable (see |netrw-v|) - default: =0 - - *g:netrw_ftp_browse_reject* ftp can produce a number of errors - and warnings that can show up as - "directories" and "files" in the - listing. This pattern is used to - remove such embedded messages. By - default its value is: - '^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$' - - *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted - lines/messages/banners/and whatnot - that one doesn't want masquerading - as "directories" and "files". Use - this pattern to remove such embedded - messages. By default its value is: + --- ----------- + Var Explanation + --- ----------- +< *g:netrw_alto* change from above splitting to below splitting + by setting this variable (see |netrw-o|) + default: =0 + + *g:netrw_altv* change from left splitting to right splitting + by setting this variable (see |netrw-v|) + default: =0 + + *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings + that can show up as "directories" and "files" + in the listing. This pattern is used to + remove such embedded messages. By default its + value is: + '^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$' + + *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines, + messages, banners, and whatnot that one doesn't + want masquerading as "directories" and "files". + Use this pattern to remove such embedded + messages. By default its value is: '^total\s\+\d\+$' - *g:netrw_keepdir* =1 (default) keep current directory - immune from the browsing directory. - =0 keep the current directory the - same as the browsing directory. - The browsing directory is contained in - b:netrw_curdir + *g:netrw_keepdir* =1 (default) keep current directory immune from + the browsing directory. + =0 keep the current directory the same as the + browsing directory. + The current browsing directory is contained in + b:netrw_curdir - *g:netrw_list_cmd* command for listing remote directories - default: (if ssh is executable) - "ssh HOSTNAME ls -FLa" + *g:netrw_list_cmd* command for listing remote directories + default: (if ssh is executable) + "ssh HOSTNAME ls -FLa" - *g:netrw_longlist* if =1, then long listing will be default + *g:netrw_longlist* if =1, then long listing will be default - *g:netrw_ftp_list_cmd* options for passing along to ftp for - directory listing. Defaults: - unix or g:netrw_cygwin set: : "ls -lF" - otherwise "dir" + *g:netrw_ftp_list_cmd* options for passing along to ftp for directory + listing. Defaults: + unix or g:netrw_cygwin set: : "ls -lF" + otherwise "dir" - *g:netrw_list_hide* comma separated list of patterns for - hiding files - default: "" + *g:netrw_list_hide* comma separated pattern list for hiding files + default: "" - *g:netrw_local_mkdir* command for making a local directory - default: "ssh HOSTNAME mkdir" + *g:netrw_local_mkdir* command for making a local directory + default: "ssh HOSTNAME mkdir" - *g:netrw_local_rmdir* remove directory command (rmdir) - default: "rmdir" + *g:netrw_local_rmdir* remove directory command (rmdir) + default: "rmdir" - *g:netrw_maxfilenamelen* =32 by default, selected so as to make - long listings fit on 80 column displays. - If your screen is wider, and you have - file/directory names longer than 32 bytes, - you may set this option to keep listings - columnar. + *g:netrw_maxfilenamelen* =32 by default, selected so as to make long + listings fit on 80 column displays. + If your screen is wider, and you have file + or directory names longer than 32 bytes, + you may set this option to keep listings + columnar. - *g:netrw_mkdir_cmd* command for making a remote directory - default: "ssh HOSTNAME mkdir" + *g:netrw_mkdir_cmd* command for making a remote directory + default: "ssh HOSTNAME mkdir" - *g:netrw_rm_cmd* command for removing files - default: "ssh HOSTNAME rm" + *g:netrw_rm_cmd* command for removing files + default: "ssh HOSTNAME rm" - *g:netrw_rmdir_cmd* command for removing directories - default: "ssh HOSTNAME rmdir" + *g:netrw_rmdir_cmd* command for removing directories + default: "ssh HOSTNAME rmdir" - *g:netrw_rmf_cmd* command for removing softlinks - default: "ssh HOSTNAME rm -f" + *g:netrw_rmf_cmd* command for removing softlinks + default: "ssh HOSTNAME rm -f" - *g:netrw_hide* if true, the hiding list is used - default: =0 + *g:netrw_hide* if true, the hiding list is used + default: =0 - *g:netrw_sort_by* sort by "name", "time", or "size" - default: "name" + *g:netrw_sort_by* sort by "name", "time", or "size" + default: "name" - *g:netrw_sort_direction* sorting direction: "normal" or "reverse" - default: "normal" + *g:netrw_sort_direction* sorting direction: "normal" or "reverse" + default: "normal" - *g:netrw_sort_sequence* when sorting by name, first sort by the - comma-separated pattern sequence - default: '[\/]$,*,\.bak$,\.o$,\.h$, - \.info$,\.swp$,\.obj$' + *g:netrw_sort_sequence* when sorting by name, first sort by the + comma-separated pattern sequence + default: '[\/]$,*,\.bak$,\.o$,\.h$, + \.info$,\.swp$,\.obj$' - *g:netrw_timefmt* specify format string to strftime() (%c) - default: "%c" + *g:netrw_timefmt* specify format string to strftime() (%c) + default: "%c" - *g:netrw_winsize* specify initial size of new o/v windows - default: "" + *g:netrw_winsize* specify initial size of new o/v windows + default: "" INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro* @@ -1011,12 +1010,20 @@ in your <.vimrc>. CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler* One may "enter" a file with a special handler, thereby firing up a browser or -other application, for example, on a file by hitting the "x" key. Presumably -one could write handlers that would start OpenOffice programs (oowriter), etc, -based on the file's extension coupled with the user's hitting the "x" key atop -the file. +other application, for example, on a file by hitting the "x" key. The special +handler varies: + + * for Windows 32 or 64, the url and FileProtocolHandler dlls are used. + * for KDE (with kfmclient): kfmclient is used. + * for Gnome (with gnome-open): gnome-open is used. + * otherwise the NetrwFileHandler plugin is used. -The Netrw executor applies a user-defined function to a file, based on its +The file's suffix is used by these various approaches to determine an +appropriate application to use to "handle" these files. Such things +as OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript +(*.ps, *.eps) can be handled. + +The NetrwFileHandler applies a user-defined function to a file, based on its extension. Of course, the handler function must exist for it to be called! > Ex. mypgm.html x -> @@ -1025,6 +1032,11 @@ extension. Of course, the handler function must exist for it to be called! See the for an example of how to handle an html file with mozilla. +One may write custom NetrwFileHandlers; please look at the +plugin/NetrwFileHandlers.vim script for examples. If its likely to be +generally useful, please feel free to forward a copy to me for future +inclusion in the distribution. + MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir* @@ -1078,6 +1090,16 @@ It gives a tip for setting up password-less use of ssh and scp, and discusses the associated security issues. +NETRW SETTINGS *netrw-settings* + +With the NetrwSettings.vim plugin, > + :NetrwSettings +will bring up a window with the many variables that netrw uses for its +settings. You may change any of their values; when you save the file, +the settings therein will be used. One may also press "?" on any of +the lines for help on what each of the variables do. + + ============================================================================== 8. Problems and Fixes *netrw-problems* @@ -1195,6 +1217,13 @@ which is loaded automatically at startup (assuming :set nocp). ============================================================================== 10. History *netrw-history* + v63: * netrw now takes advantage of autoload (and requires 7.0) + * Bugfix - using r (to reverse sort) working again + v62: * Bugfix - spaces allowed again in directory names with + g:netrw_keepdir=0. In fact, I've tested netrw (again) + with most ANSI punctuation marks for directory names. + * Bugfix - NetrwSettings gave errors when g:netrw_silent + had not be set. v61: * document upgrade -- netrw variable-based settings all should have tags. Supports NetrwSettings command. * several important variables are window-oriented. Netrw has diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 05252916a..929c1060a 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.0aa. Last change: 2005 Aug 15 +*spell.txt* For Vim version 7.0aa. Last change: 2005 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -195,6 +195,7 @@ regions. You can change that by manually editing the 'spellfile'. See 'spellfile' are only used when all entries in "spelllang" specify the same region (not counting files specified by their .spl name). + *spell-german* Specific exception: For German these special regions are used: de all German words accepted de_de old and new spelling @@ -203,6 +204,16 @@ Specific exception: For German these special regions are used: de_at Austria de_ch Switzerland + *spell-yiddish* +Yiddish requires using "utf-8" encoding, because of the special characters +used. If you are using latin1 Vim will use transliterated (romanized) Yiddish +instead. If you want to use transliterated Yiddish with utf-8 use "yi-tr". +In a table: + 'encoding' 'spelllang' + utf-8 yi Yiddish + latin1 yi transliterated Yiddish + utf-8 yi-tr transliterated Yiddish + SPELL FILES *spell-load* @@ -901,9 +912,11 @@ Sometimes it is necessary to change a word when concatenating it to another, by removing a few letters, inserting something or both. It can also be useful to restrict concatenation to words that match a pattern. For this purpose CMP items can be used. They look like this: - CMP {flag} {strip} {add} {cond} {cond2} + CMP {flag} {flags} {strip} {add} {cond} {cond2} {flag} the flag, as used in COMPOUNDFLAGS for the lead word + {flags} accepted flags for the following word ('.' to accept + all) {strip} text to remove from the end of the lead word (zero for no stripping) {add} text to insert between the words (zero for no @@ -911,9 +924,9 @@ items can be used. They look like this: {cond} condition to match at the end of the lead word {cond2} condition to match at the start of the following word -This is exactly the same as what is used for SFX and PFX items, except there -is an extra condition. Example: - CMP f 0 - . . ~ +This is the same as what is used for SFX and PFX items, with the extra {flags} +and {cond2} fields. Example: + CMP f mrt 0 - . . ~ When used with the food and dish word list above, this means that a dash is inserted after each food item. Thus you get "onion-soup" and @@ -924,7 +937,7 @@ when a CMP item matches. When there are no CMP items for a compound flag, then all words will be concatenated, as if there was an item: - CMP {flag} 0 0 . . + CMP {flag} . 0 0 . . REPLACEMENTS *spell-affix-REP* diff --git a/runtime/doc/tags b/runtime/doc/tags index 18f60888b..118e324f3 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1827,6 +1827,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :command map.txt /*:command* :command-completion map.txt /*:command-completion* :command-completion-custom map.txt /*:command-completion-custom* +:command-verbose map.txt /*:command-verbose* :comment eval.txt /*:comment* :comp quickfix.txt /*:comp* :compiler quickfix.txt /*:compiler* @@ -1982,6 +1983,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :for eval.txt /*:for* :fu eval.txt /*:fu* :function eval.txt /*:function* +:function-verbose eval.txt /*:function-verbose* :g repeat.txt /*:g* :global repeat.txt /*:global* :go motion.txt /*:go* @@ -5006,6 +5008,7 @@ g:netrw_ftp_list_cmd pi_netrw.txt /*g:netrw_ftp_list_cmd* g:netrw_ftpmode pi_netrw.txt /*g:netrw_ftpmode* g:netrw_hide pi_netrw.txt /*g:netrw_hide* g:netrw_http_cmd pi_netrw.txt /*g:netrw_http_cmd* +g:netrw_ignorenetrc pi_netrw.txt /*g:netrw_ignorenetrc* g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir* g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* @@ -5208,6 +5211,7 @@ hebrew hebrew.txt /*hebrew* hebrew.txt hebrew.txt /*hebrew.txt* help various.txt /*help* help-context help.txt /*help-context* +help-tags tags 1 help-translated various.txt /*help-translated* help-xterm-window various.txt /*help-xterm-window* help.txt help.txt /*help.txt* @@ -5790,6 +5794,7 @@ netrw-browse-intro pi_netrw.txt /*netrw-browse-intro* netrw-browse-var pi_netrw.txt /*netrw-browse-var* netrw-c pi_netrw.txt /*netrw-c* netrw-cadaver pi_netrw.txt /*netrw-cadaver* +netrw-chgup pi_netrw.txt /*netrw-chgup* netrw-contents pi_netrw.txt /*netrw-contents* netrw-cr pi_netrw.txt /*netrw-cr* netrw-credits pi_netrw.txt /*netrw-credits* @@ -5799,6 +5804,7 @@ netrw-d pi_netrw.txt /*netrw-d* netrw-debug pi_netrw.txt /*netrw-debug* netrw-delete pi_netrw.txt /*netrw-delete* netrw-dir pi_netrw.txt /*netrw-dir* +netrw-dirlist pi_netrw.txt /*netrw-dirlist* netrw-downdir pi_netrw.txt /*netrw-downdir* netrw-edithide pi_netrw.txt /*netrw-edithide* netrw-ex pi_netrw.txt /*netrw-ex* @@ -5846,6 +5852,7 @@ netrw-ref pi_netrw.txt /*netrw-ref* netrw-rename pi_netrw.txt /*netrw-rename* netrw-reverse pi_netrw.txt /*netrw-reverse* netrw-s pi_netrw.txt /*netrw-s* +netrw-settings pi_netrw.txt /*netrw-settings* netrw-sexplore pi_netrw.txt /*netrw-sexplore* netrw-sort pi_netrw.txt /*netrw-sort* netrw-sortsequence pi_netrw.txt /*netrw-sortsequence* @@ -6375,6 +6382,7 @@ spec_chglog_release_info pi_spec.txt /*spec_chglog_release_info* special-buffers windows.txt /*special-buffers* speed-up tips.txt /*speed-up* spell spell.txt /*spell* +spell-CMP spell.txt /*spell-CMP* spell-COMPOUNDFLAG spell.txt /*spell-COMPOUNDFLAG* spell-COMPOUNDFLAGS spell.txt /*spell-COMPOUNDFLAGS* spell-COMPOUNDMIN spell.txt /*spell-COMPOUNDMIN* @@ -6398,7 +6406,9 @@ spell-affix-compound spell.txt /*spell-affix-compound* spell-affix-mbyte spell.txt /*spell-affix-mbyte* spell-affix-vim spell.txt /*spell-affix-vim* spell-dic-format spell.txt /*spell-dic-format* +spell-double-scoring spell.txt /*spell-double-scoring* spell-file-format spell.txt /*spell-file-format* +spell-german spell.txt /*spell-german* spell-load spell.txt /*spell-load* spell-midword spell.txt /*spell-midword* spell-mkspell spell.txt /*spell-mkspell* @@ -6406,6 +6416,7 @@ spell-quickstart spell.txt /*spell-quickstart* spell-remarks spell.txt /*spell-remarks* spell-syntax spell.txt /*spell-syntax* spell-wordlist-format spell.txt /*spell-wordlist-format* +spell-yiddish spell.txt /*spell-yiddish* spell.txt spell.txt /*spell.txt* spellbadword() eval.txt /*spellbadword()* spellsuggest() eval.txt /*spellsuggest()* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 1f82ecc1a..24349231d 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2005 Aug 15 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -31,9 +31,11 @@ be worked on, but only if you sponsor Vim development. See |sponsor|. -------------------- Known bugs and current work ----------------------- Spelling: -- suggestions for compound words. -- Implement multiple flags for compound words. Await comments from other - spell checking authors. +- Prefer SpellBad over SpellCap highlighting. +- Add limit for number of suggestions to 'spellsuggest'? +- CTRL-X s in Insert mode: move cursor back to after badly spelled word? +- Implement multiple flags for compound words and CMP item. + Await comments from other spell checking authors. Mac unicode patch (Da Woon Jung): - selecting proportional font breaks display diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index a1c537fd6..dce51bd8d 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 15 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -561,8 +561,8 @@ For xterm most combinations of modifiers with function keys are recognized. When 'verbose' is set the output of ":highlight" will show where a highlight item was last set. -When 'verbose' is set the output of ":map" will show where a key map was -last defined. (Yegappan Lakshmanan) +When 'verbose' is set the output of ":map", ":command" and ":function" +commands will show where it was last defined. (Yegappan Lakshmanan) ============================================================================== IMPROVEMENTS *improvements-7* @@ -1292,4 +1292,9 @@ Searching for a pattern backwards, starting on the NUL at the end of the line and 'encoding' is "utf-8" would match the pattern just before it incorrectly. Affected searchpair('/\*', '', '\*/'). +For the Find/Replace dialog it was possible that not finding the text resulted +in an error message while redrawing, which cleared the syntax highlighting +while it was being used, resulting in a crash. Now don't clear syntax +highlighting, disable it with b_syn_error. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 560c479d2..96c06e4d8 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2005 Aug 15 +" Last Change: 2005 Aug 16 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1833,7 +1833,7 @@ au BufNewFile,BufRead *.y call s:FTy() fun! s:FTy() let n = 1 while n < 10 && n < line("$") - if getline(n) =~ '^\s*\(#\|class\>\)' + if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include' setf racc return endif diff --git a/runtime/menu.vim b/runtime/menu.vim index 52607235c..f4ed1b528 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar -" Last Change: 2005 Jul 30 +" Last Change: 2005 Aug 16 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -198,10 +198,10 @@ an 20.405 &Edit.-SEP2- if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif") an 20.410 &Edit.&Find\.\.\. :promptfind vunmenu &Edit.&Find\.\.\. - vnoremenu &Edit.&Find\.\.\. y:promptfind " + vnoremenu &Edit.&Find\.\.\. y:call FixFText():promptfind " an 20.420 &Edit.Find\ and\ Rep&lace\.\.\. :promptrepl vunmenu &Edit.Find\ and\ Rep&lace\.\.\. - vnoremenu &Edit.Find\ and\ Rep&lace\.\.\. y:promptrepl " + vnoremenu &Edit.Find\ and\ Rep&lace\.\.\. y:call FixFText():promptrepl " else an 20.410 &Edit.&Find/ / an 20.420 &Edit.Find\ and\ Rep&lace:%s :%s/ @@ -212,6 +212,11 @@ endif an 20.425 &Edit.-SEP3- an 20.430 &Edit.Settings\ &Window :options +fun! s:FixFText() + " Fix text in nameless register to be used with :promptfind. + let @" = substitute(@", "[\r\n]", '\\n', 'g') +endfun + " Edit/Global Settings an 20.440.100 &Edit.&Global\ Settings.Toggle\ Pattern\ &Highlight:set\ hls! :set hls! hls? an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignore-case:set\ ic! :set ic! ic? diff --git a/runtime/plugin/NetrwFileHandlers.vim b/runtime/plugin/NetrwFileHandlers.vim index 9b9cd2060..2aa1d9b83 100644 --- a/runtime/plugin/NetrwFileHandlers.vim +++ b/runtime/plugin/NetrwFileHandlers.vim @@ -1,25 +1,28 @@ " NetrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") " Author: Charles E. Campbell, Jr. -" Date: Aug 08, 2005 -" Version: 5a NOT RELEASED -" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. +" Date: Aug 15, 2005 +" Version: 6 +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, -" netrw.vim is provided *as is* and comes with no +" NetrwFileHandlers.vim is provided *as is* and comes with no " warranty of any kind, either expressed or implied. In no " event will the copyright holder be liable for any damages " resulting from the use of this software. +" +" Rom 6:23 (WEB) For the wages of sin is death, but the free gift of God {{{1 +" is eternal life in Christ Jesus our Lord. " --------------------------------------------------------------------- " Load Once: {{{1 -if exists("g:loaded_netrwfilehandlers") || &cp +if exists("g:loaded_NetrwFileHandlers") || &cp finish endif let s:keepcpo= &cpo set cpo&vim -let g:loaded_netrwfilehandlers= "v5a" +let g:loaded_NetrwFileHandlers= "v6" " --------------------------------------------------------------------- " NetrwFileHandler_html: handles html when the user hits "x" when the {{{1 @@ -173,21 +176,6 @@ fun! NetrwFileHandler_pdf(pdf) return 1 endfun -" --------------------------------------------------------------------- -" NetrwFileHandler_sxw: visualize sxw files {{{1 -fun! NetrwFileHandler_sxw(sxw) -" " call Dfunc("NetrwFileHandler_sxw(sxw<".a:sxw.">)") - if executable("gs") - exe 'silent! !gs "'.a:sxw.'"' - else -" " call Dret("NetrwFileHandler_sxw 0") - return 0 - endif - -" " call Dret("NetrwFileHandler_sxw 1") - return 1 -endfun - " --------------------------------------------------------------------- " NetrwFileHandler_doc: visualize doc files {{{1 fun! NetrwFileHandler_doc(doc) diff --git a/runtime/plugin/NetrwPlugin.vim b/runtime/plugin/NetrwPlugin.vim new file mode 100644 index 000000000..b1f5abd78 --- /dev/null +++ b/runtime/plugin/NetrwPlugin.vim @@ -0,0 +1,156 @@ +" netrw.vim: Handles file transfer and remote directory listing across a network +" PLUGIN PORTION +" Last Change: Aug 16, 2005 +" Maintainer: Charles E Campbell, Jr +" Version: 63 +" License: Vim License (see vim's :help license) +" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrw.vim is 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 +if exists("g:loaded_netrw") || &cp + finish +endif +if v:version < 600 + echoerr "***netrw*** doesn't support Vim version ".v:version + finish +endif +let g:loaded_netrw = "v63" +if v:version < 700 + let loaded_explorer = 1 +endif +let s:keepcpo= &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 + +" Local Browsing: {{{2 +augroup FileExplorer + au! + au BufEnter * call s:LocalBrowse(expand("")) +augroup END + +" Network Browsing Reading Writing: {{{2 +augroup Network + au! + if has("win32") || has("win95") || has("win64") || has("win16") + au BufReadCmd file://* exe "silent doau BufReadPre ".expand("")|exe 'e '.substitute(expand(""),"file:/*","","")|exe "silent doau BufReadPost ".expand("") + else + au BufReadCmd file:///* exe "silent doau BufReadPre ".expand("")|exe 'e /'.substitute(expand(""),"file:/*","","")|exe "silent doau BufReadPost ".expand("") + au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".expand("")|exe 'e /'.substitute(expand(""),"file:/*","","")|exe "silent doau BufReadPost ".expand("") + endif + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("")|exe "Nread 0r ".expand("")|exe "silent doau BufReadPost ".expand("") + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("")|exe "Nread " .expand("")|exe "silent doau FileReadPost ".expand("") + au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("")|exe "Nwrite " .expand("")|exe "silent doau BufWritePost ".expand("") + au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("")|exe "'[,']Nwrite " .expand("")|exe "silent doau FileWritePost ".expand("") +augroup END + +" Commands: :Nread, :Nwrite, :NetUserPass {{{2 +com! -nargs=* Nread call netrw#NetSavePosn()call netrw#NetRead()call netrw#NetRestorePosn() +com! -range=% -nargs=* Nwrite call netrw#NetSavePosn(),call netrw#NetWrite()call netrw#NetRestorePosn() +com! -nargs=* NetUserPass call NetUserPass() + +" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2 +com! -nargs=? -bar -bang -count=0 Explore call netrw#Explore(,0,0+0,) +com! -nargs=? -bar -bang -count=0 Sexplore call netrw#Explore(,1,0+0,) +com! -nargs=? -bar -bang -count=0 Hexplore call netrw#Explore(,1,2+0,) +com! -nargs=? -bar -bang -count=0 Vexplore call netrw#Explore(,1,4+0,) +com! -nargs=? -bar -bang Nexplore call netrw#Explore(-1,0,0,) +com! -nargs=? -bar -bang Pexplore call netrw#Explore(-2,0,0,) + +" Commands: NetrwSettings {{{2 +com! -nargs=0 NetrwSettings :call NetrwSettings#NetrwSettings() + +" --------------------------------------------------------------------- +" 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. + if isdirectory(a:dirname) + call netrw#DirBrowse(a:dirname) + endif + " not a directory, ignore it +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{1 +fun! NetrwStatusLine() +" 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") + 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 + +" ------------------------------------------------------------------------ +" NetReadFixup: this sort of function is typically written by the user {{{1 +" to handle extra junk that their system's ftp dumps +" into the transfer. This function is provided as an +" example and as a fix for a Windows 95 problem: in my +" experience, win95's ftp always dumped four blank lines +" at the end of the transfer. +if has("win95") && g:netrw_win95ftp + fun! NetReadFixup(method, line1, line2) +" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") + if method == 3 " ftp (no <.netrc>) + let fourblanklines= line2 - 3 + silent fourblanklines.",".line2."g/^\s*/d" + endif +" call Dret("NetReadFixup") + endfun +endif + +let &cpo= s:keepcpo +unlet s:keepcpo +" ------------------------------------------------------------------------ +" Modelines: {{{1 +" vim:ts=8 fdm=marker diff --git a/runtime/plugin/NetrwSettings.vim b/runtime/plugin/NetrwSettings.vim new file mode 100644 index 000000000..eecdcd234 --- /dev/null +++ b/runtime/plugin/NetrwSettings.vim @@ -0,0 +1,157 @@ +" NetrwSettings.vim: makes netrw settings simpler +" Last Change: Aug 16, 2005 +" Maintainer: Charles E Campbell, Jr +" Version: 3 +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" NetrwSettings.vim is 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. +" +" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1 +" synagogues, preaching the gospel of the kingdom, and healing +" every disease and every sickness among the people. +" Load Once: {{{1 +if exists("g:loaded_NetrwSettings") || &cp + finish +endif +let g:loaded_NetrwSettings = "v3" + +" --------------------------------------------------------------------- +" NetrwSettings: {{{1 +fun! NetrwSettings#NetrwSettings() + " this call is here largely just to insure that netrw has been loaded + call netrw#NetSavePosn() + + above wincmd s + enew + setlocal noswapfile bh=wipe + set ft=vim + file Netrw\ Settings + + " these variables have the following default effects when they don't + " exist (ie. have not been set by the user in his/her .vimrc) + if !exists("g:netrw_longlist") + let g:netrw_longlist= 0 + let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" + endif + if !exists("g:netrw_silent") + let g:netrw_silent= 0 + endif + if !exists("g:netrw_use_nt_rcp") + let g:netrw_use_nt_rcp= 0 + endif + if !exists("g:netrw_ftp") + let g:netrw_ftp= 0 + endif + if !exists("g:netrw_ignorenetrc") + let g:netrw_ignorenetrc= 0 + endif + + put ='+ ---------------------------------------------' + put ='+ NetrwSettings: (by Charles E. Campbell, Jr.)' + put ='+ Press ? with cursor atop any line for help ' + put ='+ ---------------------------------------------' + let s:netrw_settings_stop= line(".") + + put ='' + put ='+ Netrw Protocol Commands' + put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd + put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd + put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd + put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd + put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd + put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd + put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd + put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd + let s:netrw_protocol_stop= line(".") + put = '' + + put ='+Netrw Transfer Control' + put = 'let g:netrw_cygwin = '.g:netrw_cygwin + put = 'let g:netrw_ftp = '.g:netrw_ftp + put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode + put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc + put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp + put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp + let s:netrw_xfer_stop= line(".") + + put = '' + put ='+ Netrw Browser Control' + put = 'let g:netrw_alto = '.g:netrw_alto + put = 'let g:netrw_altv = '.g:netrw_altv + put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax + put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject + put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd + put = 'let g:netrw_hide = '.g:netrw_hide + put = 'let g:netrw_keepdir = '.g:netrw_keepdir + put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd + put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd + put = 'let g:netrw_list_hide = '.g:netrw_list_hide + put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir + put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir + put = 'let g:netrw_longlist = '.g:netrw_longlist + put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen + put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd + put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd + put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd + put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd + put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd + put = 'let g:netrw_silent = '.g:netrw_silent + put = 'let g:netrw_sort_by = '.g:netrw_sort_by + put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction + put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence + put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject + put = 'let g:netrw_timefmt = '.g:netrw_timefmt + put = 'let g:netrw_winsize = '.g:netrw_winsize + + put ='' + put ='+ For help, place cursor on line and press ?' + + 1d + silent %s/^+/"/e + res 99 + silent %s/= \([^0-9].*\)$/= '\1'/e + silent %s/= $/= ''/e + 1 + + set nomod + + map ? :call NetrwSettingHelp() + let tmpfile= tempname() + exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod' +endfun + +" --------------------------------------------------------------------- +" NetrwSettingHelp: {{{2 +fun! NetrwSettingHelp() +" call Dfunc("NetrwSettingHelp()") + let curline = getline(".") + if curline =~ '=' + let varhelp = substitute(curline,'^\s*let ','','e') + let varhelp = substitute(varhelp,'\s*=.*$','','e') +" call Decho("trying help ".varhelp) + try + exe "he ".varhelp + catch /^Vim\%((\a\+)\)\=:E149/ + echo "***sorry*** no help available for <".varhelp.">" + endtry + elseif line(".") < s:netrw_settings_stop + he netrw-settings + elseif line(".") < s:netrw_protocol_stop + he netrw-externapp + elseif line(".") < s:netrw_xfer_stop + he netrw-variables + else + he netrw-browse-var + endif +" call Dret("NetrwSettingHelp") +endfun + +" --------------------------------------------------------------------- +" Modelines: {{{1 +" vim:ts=8 fdm=marker diff --git a/runtime/plugin/netrw.vim b/runtime/plugin/netrw.vim deleted file mode 100644 index 85d7df743..000000000 --- a/runtime/plugin/netrw.vim +++ /dev/null @@ -1,3378 +0,0 @@ -" netrw.vim: Handles file transfer and remote directory listing across a network -" Last Change: Aug 12, 2005 -" Maintainer: Charles E Campbell, Jr -" Version: 61 -" License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. -" 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 is provided *as is* and comes with no -" warranty of any kind, either expressed or implied. 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 -" (James 1:22 RSV) -" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim - -" --------------------------------------------------------------------- -" Load Once: {{{1 -if exists("g:loaded_netrw") || &cp - finish -endif -let g:loaded_netrw = "v61" -if v:version < 700 - let loaded_explorer = 1 -endif -let s:keepcpo= &cpo -set cpo&vim - -" --------------------------------------------------------------------- -" Default values for global netrw variables {{{1 -if !exists("g:netrw_ftpmode") - let g:netrw_ftpmode= "binary" -endif -if !exists("g:netrw_win95ftp") - let g:netrw_win95ftp= 1 -endif -if !exists("g:netrw_cygwin") - if has("win32") || has("win95") || has("win64") || has("win16") - if &shell == "bash" - let g:netrw_cygwin= 1 - else - let g:netrw_cygwin= 0 - endif - else - let g:netrw_cygwin= 0 - endif -endif -if !exists("g:netrw_list_cmd") - if executable("ssh") - " provide a default listing command - let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" - else -" call Decho("ssh is not executable, can't do remote directory exploring with ssh") - let g:netrw_list_cmd= "" - endif -endif -if !exists("g:netrw_ftp_list_cmd") - if has("unix") || exists("g:netrw_cygwin") - let g:netrw_ftp_list_cmd= "ls -lF" - else - let g:netrw_ftp_list_cmd= "dir" - endif -endif -if !exists("g:netrw_rm_cmd") - let g:netrw_rm_cmd = "ssh HOSTNAME rm" -endif -if !exists("g:netrw_rmf_cmd") - let g:netrw_rmf_cmd = "ssh HOSTNAME rm -f" -endif -if !exists("g:netrw_rmdir_cmd") - let g:netrw_rmdir_cmd = "ssh HOSTNAME rmdir" -endif -if !exists("g:netrw_rename_cmd") - let g:netrw_rename_cmd= "ssh HOSTNAME mv" -endif -if exists("g:netrw_silent") && g:netrw_silent != 0 - let g:netrw_silentxfer= "silent " -else - let g:netrw_silentxfer= "" -endif -if !exists("g:netrw_winsize") - let g:netrw_winsize= "" -endif -if !exists("g:netrw_list_hide") - let g:netrw_list_hide= "" -endif -if !exists("g:netrw_sort_by") - " alternatives: date size - let g:netrw_sort_by= "name" -endif -if !exists("g:netrw_sort_sequence") - let g:netrw_sort_sequence= '[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$' -endif -if !exists("g:netrw_sort_direction") - " alternative: reverse (z y x ...) - let g:netrw_sort_direction= "normal" -endif -if !exists("g:netrw_longlist") || g:netrw_longlist == 0 - let g:netrw_longlist= 0 - let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" -else - let g:netrw_longlist= 1 - let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa -l" -endif -if !exists("g:netrw_list_cmd") -endif -if !exists("g:netrw_timefmt") - let g:netrw_timefmt= "%c" -endif -if !exists("g:netrw_local_rmdir") - let g:netrw_local_rmdir= "rmdir" -endif -if !exists("g:netrw_local_mkdir") - let g:netrw_local_mkdir= "mkdir" -endif -if !exists("g:netrw_mkdir_cmd") - let g:netrw_mkdir_cmd= "ssh HOSTNAME mkdir" -endif -if !exists("g:netrw_hide") - let g:netrw_hide= 1 -endif -if !exists("g:netrw_ftp_browse_reject") - let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$' -endif -if !exists("g:netrw_ssh_browse_reject") - let g:netrw_ssh_browse_reject='^total\s\+\d\+$' -endif -if !exists("g:netrw_keepdir") - let g:netrw_keepdir= 1 -endif -if !exists("s:netrw_cd_escape") - if has("win32") || has("win95") || has("win64") || has("win16") - let s:netrw_cd_escape="#% " - else - let s:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\" - endif -endif -if !exists("s:netrw_glob_escape") - if has("win32") || has("win95") || has("win64") || has("win16") - let s:netrw_glob_escape= "" - else - let s:netrw_glob_escape= '[]*?`{~$' - endif -endif -if !exists("g:netrw_alto") - let g:netrw_alto= 0 -endif -if !exists("g:netrw_altv") - let g:netrw_altv= 0 -endif -if !exists("g:netrw_maxfilenamelen") - let g:netrw_maxfilenamelen= 32 -endif -if !exists("g:netrw_dirhistmax") - let g:netrw_dirhistmax= 10 -endif -if !exists("g:NETRW_DIRHIST_CNT") - let g:NETRW_DIRHIST_CNT= 0 -endif - -" 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 - -" --------------------------------------------------------------------- -" Default values for global protocol variables {{{1 -if !exists("g:netrw_rcp_cmd") - let g:netrw_rcp_cmd = "rcp" -endif -if !exists("g:netrw_ftp_cmd") - let g:netrw_ftp_cmd = "ftp" -endif -if !exists("g:netrw_scp_cmd") - let g:netrw_scp_cmd = "scp -q" -endif -if !exists("g:netrw_sftp_cmd") - let g:netrw_sftp_cmd = "sftp" -endif -if !exists("g:netrw_http_cmd") - if executable("wget") - let g:netrw_http_cmd = "wget -q -O" - elseif executable("fetch") - let g:netrw_http_cmd = "fetch -o" - else - let g:netrw_http_cmd = "" - endif -endif -if !exists("g:netrw_dav_cmd") - let g:netrw_dav_cmd = "cadaver" -endif -if !exists("g:netrw_rsync_cmd") - let g:netrw_rsync_cmd = "rsync" -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 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 - -" --------------------------------------------------------------------- -" Transparency Support: {{{1 - " File Explorer: {{{2 -if version >= 600 - augroup FileExplorer - au! - au BufEnter * call LocalBrowse(expand("")) - augroup END - " Network Handler: {{{2 - augroup Network - au! - if has("win32") || has("win95") || has("win64") || has("win16") - au BufReadCmd file://* exe "silent doau BufReadPre ".expand("")|exe 'e '.substitute(expand(""),"file:/*","","")|exe "silent doau BufReadPost ".expand("") - else - au BufReadCmd file:///* exe "silent doau BufReadPre ".expand("")|exe 'e /'.substitute(expand(""),"file:/*","","")|exe "silent doau BufReadPost ".expand("") - au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".expand("")|exe 'e /'.substitute(expand(""),"file:/*","","")|exe "silent doau BufReadPost ".expand("") - endif - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("")|exe "Nread 0r ".expand("")|exe "silent doau BufReadPost ".expand("") - au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("")|exe "Nread " .expand("")|exe "silent doau FileReadPost ".expand("") - au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("")|exe "Nwrite " .expand("")|exe "silent doau BufWritePost ".expand("") - au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("")|exe "'[,']Nwrite " .expand("")|exe "silent doau FileWritePost ".expand("") - augroup END -endif - -" ------------------------------------------------------------------------ -" Commands: :Nread, :Nwrite, :NetUserPass {{{1 -com! -nargs=* Nread call s:NetSavePosn()call s:NetRead()call s:NetRestorePosn() -com! -range=% -nargs=* Nwrite call s:NetSavePosn(),call s:NetWrite()call s:NetRestorePosn() -com! -nargs=* NetUserPass call NetUserPass() - -" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{1 -com! -nargs=? -bar -bang -count=0 Explore call s:Explore(,0,0+0,) -com! -nargs=? -bar -bang -count=0 Sexplore call s:Explore(,1,0+0,) -com! -nargs=? -bar -bang -count=0 Hexplore call s:Explore(,1,2+0,) -com! -nargs=? -bar -bang -count=0 Vexplore call s:Explore(,1,4+0,) -com! -nargs=? -bar -bang Nexplore call s:Explore(-1,0,0,) -com! -nargs=? -bar -bang Pexplore call s:Explore(-2,0,0,) - -" ------------------------------------------------------------------------ -" NetSavePosn: saves position of cursor on screen {{{1 -fun! s:NetSavePosn() -" call Dfunc("NetSavePosn()") - " Save current line and column - let w:netrw_winnr= winnr() - let w:netrw_line = line(".") - let w:netrw_col = virtcol(".") - - " Save top-of-screen line - norm! H0 - let w:netrw_hline= line(".") - - call s:NetRestorePosn() -" call Dret("NetSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) -endfun - -" ------------------------------------------------------------------------ -" NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{1 -fun! NetRestorePosn() -" call Dfunc("NetRestorePosn() winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline) - let eikeep= &ei - set ei=all - - " restore window -" call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w") - exe "silent! ".w:netrw_winnr."wincmd w" -" if v:shell_error == 0 -" " as suggested by Bram M: redraw on no error -" " allows protocol error messages to remain visible -" redraw! -" endif - - " restore top-of-screen line -" call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z") - exe "norm! ".w:netrw_hline."G0z\" - - " restore position -" call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|") - exe "norm! ".w:netrw_line."G0".w:netrw_col."\" - - let &ei= eikeep -" call Dret("NetRestorePosn") -endfun - -" ------------------------------------------------------------------------ -" NetRead: responsible for reading a file over the net {{{1 -fun! s:NetRead(...) -" call Dfunc("NetRead(a:1<".a:1.">)") - - " save options - call s:NetOptionSave() - - " Special Exception: if a file is named "0r", then - " "0r" will be used to read the - " following files instead of "r" - if a:0 == 0 - let readcmd= "r" - let ichoice= 0 - elseif a:1 == "0r" - let readcmd = "0r" - let ichoice = 2 - else - let readcmd = "r" - let ichoice = 1 - endif - - " get name of a temporary file and set up shell-quoting character - let tmpfile= tempname() - -" call Decho("ichoice=".ichoice." readcmd<".readcmd.">") - 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 . ">") - let choice = b:netrw_lastfile - let ichoice= ichoice + 1 - - else - exe "let choice= a:" . ichoice -" call Decho("no lastfile: choice<" . choice . ">") - - 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 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' - break - - elseif match(choice,"^\"") != -1 - " Reconstruct Choice if choice starts with '"' -" call Decho("reconstructing choice") - 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") - echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("NetRead") - 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 . ">") - let ichoice= ichoice + 1 - - " fix up windows urls - if has("win32") || has("win95") || has("win64") || has("win16") - let choice = substitute(choice,'\\','/','ge') -" call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile) - - exe 'lcd ' . fnamemodify(tmpfile,':h') - let tmpfile = fnamemodify(tmpfile,':t') - endif - - " Determine method of read (ftp, rcp, etc) - call s:NetMethod(choice) - - " Check if NetBrowse() should be handling this request -" call Decho("checking if netlist: choice<".choice."> netrw_list_cmd<".g:netrw_list_cmd.">") - if choice =~ "^.*[\/]$" - keepjumps call s:NetBrowse(choice) -" call Dret("NetRead") - return - endif - - " ============ - " Perform Read - " ============ - - "......................................... - " rcp: NetRead Method #1 - if b:netrw_method == 1 " read with rcp -" call Decho("read via rcp (method #1)") - " ER: noting done with g:netrw_uid yet? - " ER: on Win2K" rcp machine[.user]:file tmpfile - " ER: if machine contains '.' adding .user is required (use $USERNAME) - " ER: 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 Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " ftp + <.netrc>: NetRead Method #2 - elseif b:netrw_method == 2 " read with ftp + <.netrc> -" call Decho("read via ftp+.netrc (method #2)") - let netrw_fname= b:netrw_fname - new - setlocal ff=unix - exe "put ='".g:netrw_ftpmode."'" - exe "put ='"."get ".netrw_fname." ".tmpfile."'" - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port - else -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' - let debugkeep= &debug - set debug=msg - echohl Error | echo "***netrw*** ".getline(1) | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - let &debug= debugkeep - endif - bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " ftp + machine,id,passwd,filename: NetRead Method #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)") - let netrw_fname= b:netrw_fname - new - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - put ='open '.g:netrw_machine.' '.g:netrw_port - else - put ='open '.g:netrw_machine - endif - - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - put =g:netrw_uid - put =g:netrw_passwd - else - put ='user '.g:netrw_uid.' '.g:netrw_passwd - endif - - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - put =g:netrw_ftpmode - endif - put ='get '.netrw_fname.' '.tmpfile - - " 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 -" call Decho('performing ftp -i -n') - norm! 1Gdd -" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** ".getline(1) | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - endif - bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " scp: NetRead Method #4 - elseif b:netrw_method == 4 " read with scp -" call Decho("read via scp (method #4)") - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " -P ".g:netrw_port - else - let useport= "" - endif - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') -" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) - exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile - else -" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile - endif - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - elseif b:netrw_method == 5 " read with http (wget) -" call Decho("read via http (method #5)") - if g:netrw_http_cmd == "" - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - exit - endif - - if match(b:netrw_fname,"#") == -1 - " simple wget -" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&') - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - - else - " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) - let netrw_html= substitute(b:netrw_fname,"#.*$","","") - let netrw_tag = substitute(b:netrw_fname,"^.*#","","") -" call Decho("netrw_html<".netrw_html.">") -" call Decho("netrw_tag <".netrw_tag.">") -" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) - exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) -" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') - exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" - endif - let b:netrw_lastfile = choice - - "......................................... - " cadaver: NetRead Method #6 - elseif b:netrw_method == 6 " read with cadaver -" call Decho("read via cadaver (method #6)") - - " Construct execution string (four lines) which will be passed through filter - let netrw_fname= b:netrw_fname - new - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - put ='open '.g:netrw_machine.' '.g:netrw_port - else - put ='open '.g:netrw_machine - endif - put ='user '.g:netrw_uid.' '.g:netrw_passwd - - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - put ='get '.netrw_fname.' '.cygtmpfile - else - put ='get '.netrw_fname.' '.tmpfile - endif - - " perform cadaver operation: - norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe g:netrw_silentxfer."%!".g:netrw_dav_cmd - bd! - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " rsync: NetRead Method #7 - elseif b:netrw_method == 7 " read with rsync -" call Decho("read via rsync (method #7)") - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') -" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) - exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile - else -" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile - endif - let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " fetch: NetRead Method #8 - " fetch://[user@]host[:http]/path - elseif b:netrw_method == 8 " read with fetch - if g:netrw_fetch_cmd == "" - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** fetch command not available" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - exit - endif - if exists("g:netrw_option") && g:netrw_option == ":http" - let netrw_option= "http" - else - let netrw_option= "ftp" - endif -" call Decho("read via fetch for ".netrw_option) - - if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != "" -" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&') - else -" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&') - endif - - let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - " sftp: NetRead Method #9 - elseif b:netrw_method == 9 " read with sftp -" call Decho("read via sftp (method #4)") - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') -" call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) -" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile) - exe "!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile - else -" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile - endif - let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method) - let b:netrw_lastfile = choice - - "......................................... - else " Complain - echo "***warning*** unable to comply with your request<" . choice . ">" - endif - endwhile - - " cleanup -" call Decho("cleanup") - if exists("b:netrw_method") - unlet b:netrw_method - unlet b:netrw_fname - endif - call s:NetOptionRestore() - -" call Dret("NetRead") -endfun - -" ------------------------------------------------------------------------ -" NetGetFile: Function to read file "fname" with command "readcmd". {{{1 -fun! s:NetGetFile(readcmd, fname, method) -" call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)") - - if exists("*NetReadFixup") - " for the use of NetReadFixup (not otherwise used internally) - let line2= line("$") - endif - - " transform paths from / to \ for Windows (except for cygwin) - if &term == "win32" - if g:netrw_cygwin - let fname= a:fname -" call Decho("(win32 && cygwin) fname<".fname.">") - else - let fname= substitute(a:fname,'/','\\\\','ge') -" call Decho("(win32 && !cygwin) fname<".fname.">") - endif - else - let fname= a:fname -" call Decho("(copied) fname<".fname.">") - endif - - if a:readcmd[0] == '0' - " get file into buffer - - " record remote filename - let rfile= bufname(".") -" call Decho("remotefile<".rfile.">") -" call Dredir("ls!","starting buffer list") - - " rename the current buffer to the temp file (ie. fname) - if v:version < 700 - exe "file ".fname - else - keepalt exe "file ".fname - endif -" call Dredir("ls!","after renaming current buffer to <".fname.">") - - " edit temporary file - e -" call Dredir("ls!","after editing temporary file") - - " rename buffer back to remote filename - if v:version < 700 - exe "file ".rfile - else - keepalt exe "file ".rfile - endif -" call Dredir("ls!","renaming buffer back to remote filename<".rfile.">") - let line1 = 1 - let line2 = line("$") - - elseif filereadable(fname) - " read file after current line - let curline = line(".") - let lastline= line("$") -" call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname."> line#".curline) - exe a:readcmd." ".v:cmdarg." ".fname - let line1 = curline + 1 - let line2 = line("$") - lastline + 1 - let s:netrw_line = s:netrw_line + 1 - let s:netrw_col = 1 - else - " not readable -" call Dret("NetGetFile : fname<".fname."> not readable") - return - endif - - " User-provided (ie. optional) fix-it-up command - if exists("*NetReadFixup") -" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") - call NetReadFixup(a:method, line1, line2) -" else " Decho -" call Decho("NetReadFixup() not called, doesn't exist") - endif - - " update the Buffers menu - if has("gui") && has("gui_running") - silent! emenu Buffers.Refresh\ menu - endif - -" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> fname<".a:fname."> readable=".filereadable(a:fname)) - - " insure that we have the right filetype and that its being displayed - filetype detect - redraw! -" call Dret("NetGetFile") -endfun - -" ------------------------------------------------------------------------ -" NetWrite: responsible for writing a file over the net {{{1 -fun! s:NetWrite(...) range -" call Dfunc("NetWrite(a:0=".a:0.")") - - " option handling - let mod= 0 - call s:NetOptionSave() - - " Get Temporary Filename - let tmpfile= tempname() - - if a:0 == 0 - let ichoice = 0 - else - let ichoice = 1 - endif - - " write (selected portion of) file to temporary - silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile - - 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 . ">") - let choice = b:netrw_lastfile - let ichoice= ichoice + 1 - else - exe "let choice= a:" . ichoice - - " Reconstruct Choice if choice starts with '"' - if match(choice,"?") == 0 - echomsg 'NetWrite Usage:"' - echomsg ':Nwrite machine:path uses rcp' - echomsg ':Nwrite "machine path" uses ftp with <.netrc>' - echomsg ':Nwrite "machine id password path" uses ftp' - echomsg ':Nwrite dav://[user@]machine/path uses cadaver' - echomsg ':Nwrite fetch://[user@]machine/path uses fetch' - echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)' - echomsg ':Nwrite rcp://machine/path uses rcp' - echomsg ':Nwrite rsync://[user@]machine/path uses rsync' - echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp' - echomsg ':Nwrite sftp://[user@]machine/path uses sftp' - break - - elseif match(choice,"^\"") != -1 - 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 choice > a:0 - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("NetWrite") - 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 . ">") - let ichoice= ichoice + 1 - - " fix up windows urls - if has("win32") || has("win95") || has("win64") || has("win16") - let choice= substitute(choice,'\\','/','ge') - "ER: see NetRead() - exe 'lcd ' . fnamemodify(tmpfile,':h') - let tmpfile = fnamemodify(tmpfile,':t') - endif - - " Determine method of read (ftp, rcp, etc) - call s:NetMethod(choice) - - " ============= - " Perform Write - " ============= - - "......................................... - " rcp: NetWrite Method #1 - if b:netrw_method == 1 " write with rcp -" Decho "write via rcp (method #1)" - 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 - 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 Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&') - let b:netrw_lastfile = choice - - "......................................... - " ftp + <.netrc>: NetWrite Method #2 - elseif b:netrw_method == 2 " write with ftp + <.netrc> - let netrw_fname = b:netrw_fname - new - setlocal ff=unix - exe "put ='".g:netrw_ftpmode."'" -" call Decho(" NetWrite: put ='".g:netrw_ftpmode."'") - exe "put ='"."put ".tmpfile." ".netrw_fname."'" -" call Decho("put ='"."put ".tmpfile." ".netrw_fname."'") - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port - else -" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine) - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine - endif - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** ".getline(1) | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - let mod=1 - endif - bd! - let b:netrw_lastfile = choice - - "......................................... - " ftp + machine, id, passwd, filename: NetWrite Method #3 - elseif b:netrw_method == 3 " write with ftp + machine, id, passwd, and fname - let netrw_fname= b:netrw_fname - new - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - put ='open '.g:netrw_machine.' '.g:netrw_port - else - put ='open '.g:netrw_machine - endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - put =g:netrw_uid - put =g:netrw_passwd - else - put ='user '.g:netrw_uid.' '.g:netrw_passwd - endif - put ='put '.tmpfile.' '.netrw_fname - " save choice/id/password for future use - let b:netrw_lastfile = choice - - " 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 -" call Decho('performing ftp -i -n') - norm! 1Gdd -" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n") - exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" - " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - if getline(1) !~ "^$" - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** ".getline(1) | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - let mod=1 - endif - bd! - - "......................................... - " scp: NetWrite Method #4 - elseif b:netrw_method == 4 " write with scp - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " -P ".g:netrw_port - else - let useport= "" - endif - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') -" call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') - else -" call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') - endif - let b:netrw_lastfile = choice - - "......................................... - " http: NetWrite Method #5 - elseif b:netrw_method == 5 - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** currently does not support writing using http:" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - - "......................................... - " dav: NetWrite Method #6 - elseif b:netrw_method == 6 " write with cadaver -" call Decho("write via cadaver (method #6)") - - " Construct execution string (four lines) which will be passed through filter - let netrw_fname= b:netrw_fname - new - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - put ='open '.g:netrw_machine.' '.g:netrw_port - else - put ='open '.g:netrw_machine - endif - put ='user '.g:netrw_uid.' '.g:netrw_passwd - - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') - put ='put '.cygtmpfile.' '.netrw_fname - else - put ='put '.tmpfile.' '.netrw_fname - endif - - " perform cadaver operation: - norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe g:netrw_silentxfer."%!".g:netrw_dav_cmd - bd! - let b:netrw_lastfile = choice - - "......................................... - " rsync: NetWrite Method #7 - elseif b:netrw_method == 7 " write with rsync - if g:netrw_cygwin == 1 - let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e') -" call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') - else -" call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')) - exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&') - endif - let b:netrw_lastfile = choice - - "......................................... - " scp: NetWrite Method #9 - elseif b:netrw_method == 9 " write with sftp - let netrw_fname= b:netrw_fname - 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 - new - setlocal ff=unix - put ='put '.tmpfile.' '.netrw_fname - norm! 1Gdd -" call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine) - exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine - bd! - let b:netrw_lastfile= choice - - "......................................... - else " Complain - echo "***warning*** unable to comply with your request<" . choice . ">" - endif - endwhile - - " cleanup -" call Decho("cleanup") - let result=delete(tmpfile) - call s:NetOptionRestore() - - if a:firstline == 1 && a:lastline == line("$") - let &mod= mod " usually equivalent to set nomod - endif - -" call Dret("NetWrite") -endfun - -" =========================================== -" Remote Directory Browsing Support: {{{1 -" =========================================== - -" NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2 -" of the contents of a remote directory. It is assumed that the -" g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted -" with the requested remote hostname first. -fun! NetBrowse(dirname) -" call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".g:netrw_longlist) - - if exists("s:netrw_skipbrowse") - unlet s:netrw_skipbrowse -" call Dret("NetBrowse") - return - endif - - " sanity check - if exists("b:netrw_method") && b:netrw_method =~ '[235]' -" call Decho("b:netrw_method=".b:netrw_method) - if !executable("ftp") - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ftp" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("NetBrowse") - return - endif - elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ssh" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - -" call Dret("NetBrowse") - return - endif - - " use buffer-oriented WinVars if buffer ones exist but window ones don't - call s:UseBufWinVars() - - " make this buffer modifiable - setlocal ma nonu nowrap - - " analyze a:dirname and g:netrw_list_cmd - let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' - let dirname = substitute(a:dirname,'\\','/','ge') -" call Decho("dirpat<".dirpat.">") - if dirname !~ dirpat - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("NetBrowse : badly formatted dirname<".dirname.">") - return - endif - - let method = substitute(dirname,dirpat,'\1','') - let user = substitute(dirname,dirpat,'\2','') - let machine = substitute(dirname,dirpat,'\3','') - let path = substitute(dirname,dirpat,'\4','') - let fname = substitute(dirname,'^.*/\ze.','','') -" call Decho("set up method <".method .">") -" call Decho("set up user <".user .">") -" call Decho("set up machine<".machine.">") -" call Decho("set up path <".path .">") -" call Decho("set up fname <".fname .">") - - if method == "ftp" || method == "http" - let method = "ftp" - let listcmd = g:netrw_ftp_list_cmd - else - let listcmd = substitute(g:netrw_list_cmd,'\',user.machine,'') - endif - - if exists("b:netrw_method") -" call Decho("setting w:netrw_method<".b:netrw_method.">") - let w:netrw_method= b:netrw_method - endif - - " optionally sort by time (-t) or by size (-S) - if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]" - echohl WarningMsg | echo "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - else - if g:netrw_sort_by =~ "^t" - let listcmd= listcmd."t" - elseif g:netrw_sort_by =~ "^s" - let listcmd= listcmd."S" - endif - " optionally sort in reverse - if g:netrw_sort_direction =~ "^r" && listcmd == "dir" - let listcmd= listcmd."r" - endif - endif - -" call Decho("set up listcmd<".listcmd.">") - if fname =~ '@$' && fname !~ '^"' -" call Decho("attempt transfer of symlink as file") - call s:NetBrowse(substitute(dirname,'@$','','e')) - redraw! -" call Dret("NetBrowse : symlink") - return - - elseif fname !~ '[\/]$' && fname !~ '^"' - " looks like a regular file, attempt transfer -" call Decho("attempt transfer as regular file<".dirname.">") - - " remove any filetype indicator from end of dirname, except for the - " "this is a directory" indicator (/). There shouldn't be one of those, - " anyway. - let path= substitute(path,'[*=@|]$','','e') -" call Decho("new path<".path.">") - - " remote-read the requested file into current buffer - enew! -" call Decho("exe file .method."://".user.machine."/".escape(path,s:netrw_cd_escape)) - exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape) - exe "silent doau BufReadPre ".fname - silent call s:NetRead(method."://".user.machine."/".path) - exe "silent doau BufReadPost ".fname - keepjumps 1d - - " save certain window-oriented variables into buffer-oriented variables - call s:BufWinVars() - - setlocal nonu nomod noma - -" call Dret("NetBrowse : file<".fname.">") - return - endif - - " --------------------------------------------------------------------- - " Perform Directory Listing: -" call Decho("Perform directory listing...") - " set up new buffer and map - let bufname = method.'://'.user.machine.'/'.path - let bufnamenr = bufnr(bufname.'$') -" call Decho("bufname<".bufname."> bufnamenr=".bufnamenr) - if bufnamenr != -1 - " buffer already exists, switch to it! -" call Decho("buffer already exists, switching to it") - exe "b ".bufnamenr - if line("$") >= 5 -" call Dret("NetBrowse") - return - endif - else -" call Decho("generate a new buffer") - enew! - endif - - " rename file to reflect where its from - setlocal bt=nofile bh=wipe nobl noswf - exe "setlocal ts=".g:netrw_maxfilenamelen -" call Decho("exe file ".escape(bufname,s:netrw_cd_escape)) - exe 'file '.escape(bufname,s:netrw_cd_escape) -" call Decho("renaming file to bufname<".bufname.">") - setlocal bh=hide nobl nonu - - " save current directory on directory history list - call NetBookmarkDir(3,expand("%")) - - " set up buffer-local mappings -" call Decho("set up buffer-local mappings") - nnoremap :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) - nnoremap :call NetRefresh(NetBrowseChgDir(expand("%"),'./')) - nnoremap - :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'../')) - nnoremap a :let g:netrw_hide=(g:netrw_hide+1)%3exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) - nnoremap b :call NetBookmarkDir(0,expand("%")) - nnoremap B :call NetBookmarkDir(1,expand("%")) - nnoremap :call NetHideEdit(0) - nnoremap i :call NetLongList(0) - nnoremap o :call NetSplit(0) - nnoremap q :call NetBookmarkDir(2,expand("%")) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./')) - nnoremap s :call NetSaveWordPosn()let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),'./'))call NetRestoreWordPosn() - nnoremap S :call NetSortSequence(0) - nnoremap u :call NetBookmarkDir(4,expand("%")) - nnoremap U :call NetBookmarkDir(5,expand("%")) - nnoremap v :call NetSplit(1) - nnoremap x :exe "norm! 0"call NetBrowseX(NetBrowseChgDir(expand("%"),NetGetWord()),1) - nnoremap <2-leftmouse> :exe "norm! 0"call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) - exe 'nnoremap :exe "norm! 0"call NetBrowseRm("'.user.machine.'","'.path.'")' - exe 'vnoremap :call NetBrowseRm("'.user.machine.'","'.path.'")' - exe 'nnoremap d :call NetMakeDir("'.user.machine.'")' - exe 'nnoremap D :exe "norm! 0"call NetBrowseRm("'.user.machine.'","'.path.'")' - exe 'vnoremap D :call NetBrowseRm("'.user.machine.'","'.path.'")' - exe 'nnoremap R :exe "norm! 0"call NetBrowseRename("'.user.machine.'","'.path.'")' - exe 'vnoremap R :call NetBrowseRename("'.user.machine.'","'.path.'")' - nnoremap ? :he netrw-browse-cmds - setlocal ma nonu nowrap - - " Set up the banner -" call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method.">") - keepjumps put ='\" ===========================================================================' - keepjumps put ='\" Netrw Remote Directory Listing' - keepjumps put ='\" '.bufname - let w:netrw_bannercnt = 7 - let sortby = g:netrw_sort_by - if g:netrw_sort_direction =~ "^r" - let sortby = sortby." reversed" - endif - - if g:netrw_sort_by =~ "^n" - " sorted by name - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - keepjumps put ='\" Sorted by '.sortby - keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence - else - " sorted by size or date - keepjumps put ='\" Sorted by '.sortby - endif - if g:netrw_list_hide != "" && g:netrw_hide - if g:netrw_hide == 1 - keepjumps put ='\" Hiding: '.g:netrw_list_hide - else - keepjumps put ='\" Showing: '.g:netrw_list_hide - endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - endif - keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec' - keepjumps put ='\" ===========================================================================' - - " remote read the requested directory listing - " Use ftp if that was the file-transfer method selected, otherwise use ssh - " Note that not all ftp servers honor the options for ls - if method == "ftp" - " use ftp to get remote file listing -" call Decho("use ftp to get remote file listing") - call NetBrowseFtpCmd(path,listcmd) - keepjumps 1d - - if !g:netrw_longlist - " shorten the listing -" call Decho("generate short listing") - exe "keepjumps ".w:netrw_bannercnt - - " cleanup - if g:netrw_ftp_browse_reject != "" - exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d" - endif - - " if there's no ../ listed, then put ./ and ../ in - let line1= line(".") - keepjumps 1 - silent keepjumps call search('^\.\.\/\%(\s\|$\)','W') - let line2= line(".") - if line2 == 0 - keepjumps put='../' - keepjumps put='./' - endif - exe "keepjumps ".line1 - keepjumps norm! 0 - - " more cleanup - exe 'keepjumps silent! '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' - exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' - exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' - endif - - else - " use ssh to get remote file listing -" call Decho("use ssh to get remote file listing") - let shq= &shq? &shq : ( &sxq? &sxq : "'") -" call Decho("exe silent r! ".listcmd." '".shq.escape(path,s:netrw_cd_escape).shq."'") - exe "silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq - keepjumps 1d - " cleanup - if g:netrw_ftp_browse_reject != "" - exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d" - endif - endif - - - " set up syntax highlighting - if has("syntax") - setlocal ft=netrwlist - if !exists("g:syntax_on") || !g:syntax_on - setlocal ft= - " Ugly workaround -- when syntax highlighting is off and laststatus==2, - " sometimes the laststatus highlight bleeds into the entire display. - " Only seems to happen with remote browsing. Weird. - redraw - endif - endif - - " manipulate the directory listing (hide, sort) - if line("$") >= w:netrw_bannercnt - if g:netrw_hide && g:netrw_list_hide != "" - call s:NetrwListHide() - endif - - if g:netrw_longlist - " do a long listing; these substitutions need to be done prior to sorting -" call Decho("manipulate long listing") - - if method == "ftp" - " cleanup - exe "keepjumps ".w:netrw_bannercnt - while getline(".") =~ g:netrw_ftp_browse_reject - keepjumps d - endwhile - " if there's no ../ listed, then put ./ and ../ in - let line1= line(".") - keepjumps 1 - silent keepjumps call search('^\.\.\/\%(\s\|$\)','W') - let line2= line(".") - if line2 == 0 - exe 'keepjumps '.w:netrw_bannercnt."put='./'" - exe 'keepjumps '.w:netrw_bannercnt."put='../'" - endif - exe "keepjumps ".line1 - keepjumps norm! 0 - endif - - exe 'keepjumps silent '.w:netrw_bannercnt.',$s/ -> .*$//e' - exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' - exe w:netrw_bannercnt - endif - - if line("$") >= w:netrw_bannercnt - if g:netrw_sort_by =~ "^n" - call s:SetSort() - if v:version < 700 - exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()' - elseif g:netrw_sort_direction =~ 'n' - exe 'keepjumps silent '.w:netrw_bannercnt.',$sort' - else - exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!' - endif - exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e' - endif - if g:netrw_longlist - " shorten the list to keep its width <= 80 characters - exe "keepjumps silent ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e' - endif - endif - endif - exe "keepjumps ".w:netrw_bannercnt - - setlocal nomod noma nonu - -" call Dret("NetBrowse") - return -endfun - -" --------------------------------------------------------------------- -" NetBrowseChgDir: {{{2 -fun! NetBrowseChgDir(dirname,newdir) -" call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)") - - let dirname= a:dirname - let newdir = a:newdir - - if newdir !~ '[\/]$' - " handling a file - let dirname= dirname.newdir -" call Decho("handling a file: dirname<".dirname.">") - - elseif newdir == './' - " refresh the directory list -" call Decho("refresh directory listing") - setlocal ma nobl bh=hide - %d - - elseif newdir == '../' - " go up one directory - let trailer= substitute(a:dirname,'^\(\w\+://\%(\w\+@\)\=\w\+/\)\(.*\)$','\2','') - - if trailer =~ '^\%(\.\./\)*$' - " tack on a ../" - let dirname= dirname.'../' - - else - " strip off a directory name from dirname - let dirname= substitute(dirname,'^\(.*/\)[^/]\+/','\1','') - endif -" call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">") - - else - " go down one directory - let dirname= dirname.newdir -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") - endif - -" call Dret("NetBrowseChgDir <".dirname.">") - return dirname -endfun - -" --------------------------------------------------------------------- -" NetGetWord: it gets the directory named under the cursor -fun! NetGetWord() -" call Dfunc("NetGetWord() line#".line(".")) - call s:UseBufWinVars() - - if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt - let dirname= "./" - let curline= getline(".") - if curline =~ '"\s*Sorted by\s' - norm s - let s:netrw_skipbrowse= 1 - echo 'Pressing "s" also works' - elseif curline =~ '"\s*Sort sequence:' - let s:netrw_skipbrowse= 1 - echo 'Press "S" to edit sorting sequence' - elseif curline =~ '"\s*Quick Help:' - norm ? - let s:netrw_skipbrowse= 1 - echo 'Pressing "?" also works' - elseif curline =~ '"\s*\%(Hiding\|Showing\):' - norm a - let s:netrw_skipbrowse= 1 - echo 'Pressing "a" also works' - elseif line("$") > w:netrw_bannercnt - exe w:netrw_bannercnt - endif - else - let dirname= getline(".") - if dirname =~ '\t' - let dirname= substitute(dirname,'\t.*$','','e') - endif - endif -" call Dret("NetGetWord <".dirname.">") - return dirname -endfun - -" --------------------------------------------------------------------- -" NetBrowseRm: remove/delete a remote file or directory {{{2 -fun! NetBrowseRm(usrhost,path) range -" call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">)") -" call Decho("firstline=".a:firstline." lastline=".a:lastline) - - " preparation for removing multiple files/directories - let ctr= a:firstline - let all= 0 - - " remove multiple files and directories - while ctr <= a:lastline - exe ctr - - norm! 0 - let rmfile= s:NetGetWord() -" call Decho("rmfile<".rmfile.">") - - if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') - " attempt to remove file - if !all - echohl Statement - call inputsave() - let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - echohl NONE - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~ 'y\%[es]' || ok == "" - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - silent! keepjumps .,$d - call NetBrowseFtpCmd(a:path,"delete ".rmfile) - else - let netrw_rm_cmd= substitute(g:netrw_rm_cmd,'HOSTNAME',a:usrhost,'').' "'.escape(a:path.rmfile,s:netrw_cd_escape).'"' -" call Decho("attempt to remove file: system(".netrw_rm_cmd.")") - let ret= system(netrw_rm_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) - endif - elseif ok =~ 'q\%[uit]' - break - endif - - else - " attempt to remove directory - if !all - call inputsave() - let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~ 'y\%[es]' || ok == "" - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - call NetBrowseFtpCmd(a:path,"rmdir ".rmfile) - else - let rmfile = a:path.rmfile - let netrw_rmdir_cmd= substitute(g:netrw_rmdir_cmd,'HOSTNAME',a:usrhost,'').' '."'".'"'.rmfile.'"'."'" -" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") - let ret= system(netrw_rmdir_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) - - if v:shell_error != 0 - let netrw_rmf_cmd= substitute(g:netrw_rmf_cmd,'HOSTNAME',a:usrhost,'').' '.substitute(rmfile,'[\/]$','','e') -" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") - let ret= system(netrw_rmf_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) - - if v:shell_error != 0 && !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - endif - endif - - elseif ok =~ 'q\%[uit]' - break - endif - endif - - let ctr= ctr + 1 - endwhile - - " refresh the directory - let curline= line(".")-1 -" call Decho("refresh the directory") - call NetBrowse(NetBrowseChgDir(expand("%"),'./')) - exe curline - -" call Dret("NetBrowseRm") -endfun - -" --------------------------------------------------------------------- -" NetBrowseRename: rename a remote file or directory {{{2 -fun! NetBrowseRename(usrhost,path) range -" call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)") - - " preparation for removing multiple files/directories - let ctr = a:firstline - let rename_cmd = substitute(g:netrw_rename_cmd,'\',a:usrhost,'') - - " attempt to rename files/directories - while ctr <= a:lastline - exe "keepjumps ".ctr - - norm! 0 - let oldname= s:NetGetWord() -" call Decho("oldname<".oldname.">") - - call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) - call inputrestore() - - if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - call NetBrowseFtpCmd(a:path,"rename ".oldname." ".newname) - else - let oldname= a:path.oldname - let newname= a:path.newname -" call Decho("system(rename_cmd".' "'.escape(oldname," ").'" "'.escape(newname,s:netrw_cd_escape).'"') - let ret= system(rename_cmd.' "'.escape(oldname,s:netrw_cd_escape).'" "'.escape(newname,s:netrw_cd_escape).'"') - endif - - let ctr= ctr + 1 - endwhile - - " refresh the directory - let curline= line(".") - call NetBrowse(NetBrowseChgDir(expand("%"),'./')) - exe "keepjumps ".curline -" call Dret("NetBrowseRename") -endfun - -" --------------------------------------------------------------------- -" NetRefresh: {{{2 -fun! NetRefresh(dirname) -" call Dfunc("NetRefresh(dirname<".a:dirname.">)") - set ma - %d - call NetBrowse(dirname) - redraw! -" call Dret("NetRefresh") -endfun - -" --------------------------------------------------------------------- -" NetSplit: mode {{{2 -" =0 : net and o -" =1 : net and v -" =2 : local and o -" =3 : local and v -fun! s:NetSplit(mode) -" call Dfunc("NetSplit(mode=".a:mode.")") - - call s:SaveWinVars() - if a:mode == 0 - exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" - call s:CopyWinVars() - exe "norm! 0" - call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) - elseif a:mode ==1 - exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" - call s:CopyWinVars() - exe "norm! 0" - call NetBrowse(NetBrowseChgDir(expand("%"),NetGetWord())) - elseif a:mode ==2 - exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s" - call s:CopyWinVars() - exe "norm! 0" - call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) - else - exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v" - call s:CopyWinVars() - exe "norm! 0" - call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) - endif - -" call Dret("NetSplit") -endfun - -" --------------------------------------------------------------------- -" NetBrowseX: allows users to write custom functions to operate on {{{2 -" files given their extension. Passes 0=local, 1=remote -fun! NetBrowseX(fname,remote) -" call Dfunc("NetBrowseX(".a:fname." remote=".a:remote.")") - - " set up the filename - " (lower case the extension, make a local copy of a remote file) - let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') - if has("win32") || has("win95") || has("win64") || has("win16") - let exten= substitute(exten,'^.*$','\L&\E','') - endif - let fname= escape(a:fname,"%#") -" call Decho("fname<".fname."> after escape()") - - if a:remote == 1 - " create a local copy - let fname= tempname().".".exten -" call Decho("create a local copy of <".a:fname."> as <".fname.">") - exe "keepjumps silent bot 1new ".a:fname - set bh=delete - exe "w! ".fname - q - endif -" call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten)) - - " set up redirection - if &srr =~ "%s" - let redir= substitute(&srr,"%s","/dev/null"."") - else - let redir= &srr . "/dev/null" - endif -" call Decho("redir:".redir.":") - - " execute the file handler - if has("win32") || has("win64") -" call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"') - exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"' - let ret= v:shell_error - - elseif has("unix") && executable("kfmclient") -" call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir) - exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir - let ret= v:shell_error - - elseif has("unix") && executable("gnome-open") -" call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir) - exe "silent !gnome-open '".escape(fname,'%#')."'".redir - let ret= v:shell_error - - elseif exten != "" && exists("*NetrwFileHandler_".exten) -" call Decho("let ret= NetrwFileHandler_".exten.'("'.fname.'")') - exe "let ret= NetrwFileHandler_".exten.'("'.fname.'")' - endif - redraw! - - " cleanup: remove temporary file, - " delete current buffer if success with handler, - " return to prior buffer (directory listing) - if a:remote == 1 && fname != a:fname -" call Decho("deleting temporary file<".fname.">") - call delete(fname) - endif - - if a:remote == 1 - set bh=delete bt=nofile noswf - exe "norm! \" - redraw! - endif - -" call Dret("NetBrowseX") -endfun - -" --------------------------------------------------------------------- -" NetBrowseFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2 -" This function assumes that a long listing will be received. Size, time, -" and reverse sorts will be requested of the server but not otherwise -" enforced here. -fun! NetBrowseFtpCmd(path,cmd) -" call Dfunc("NetBrowseFtpCmd(path<".a:path."> cmd<".a:cmd.">) netrw_method=".w:netrw_method) - - " because WinXX ftp uses unix style input - " curline is one more than the bannercnt in order to account - " for the unwanted first blank line (doing a :put to an empty - " buffer yields a blank first line) - let ffkeep= &ff - setlocal ma ff=unix - let curline= w:netrw_bannercnt+1 - exe "silent! keepjumps ".curline.",$d" - - "......................................... - if w:netrw_method == 2 || w:netrw_method == 5 - " ftp + <.netrc>: Method #2 - if a:path != "" - put ='cd '.a:path - endif - exe "put ='".a:cmd."'" -" redraw!|call inputsave()|call input("Pausing...")|call inputrestore() - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) - exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port - else -" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine) - exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine - endif - - "......................................... - elseif w:netrw_method == 3 - " ftp + machine,id,passwd,filename: Method #3 - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - put ='open '.g:netrw_machine.' '.g:netrw_port - else - put ='open '.g:netrw_machine - endif - - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - put =g:netrw_uid - put =g:netrw_passwd - else - put ='user '.g:netrw_uid.' '.g:netrw_passwd - endif - - if a:path != "" - put ='cd '.a:path - endif - exe "put ='".a:cmd."'" - - " 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 -" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n") - exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n" - - "......................................... - else - echo "***warning*** unable to comply with your request<" . choice . ">" - endif - - " cleanup for Windows - if has("win32") || has("win95") || has("win64") || has("win16") - keepjumps silent!! %s/\r$//e - endif - if a:cmd == "dir" - " infer directory/link based on the file permission string - keepjumps silent! g/d\%([-r][-w][-x]\)\{3}/s@$@/@ - keepjumps silent! g/l\%([-r][-w][-x]\)\{3}/s/$/@/ - if !g:netrw_longlist - exe "keepjumps silent! ".curline.',$s/^\%(\S\+\s\+\)\{8}//e' - endif - endif - - " restore settings - let &ff= ffkeep -" call Dret("NetBrowseFtpCmd") -endfun - -" --------------------------------------------------------------------- -" NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 -" separated patterns given in g:netrw_list_hide -fun! NetrwListHide() -" call Dfunc("NetrwListHide() listhide<".g:netrw_list_hide.">") - - let listhide= g:netrw_list_hide - while listhide != "" - if listhide =~ ',' - let hide = substitute(listhide,',.*$','','e') - let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e') - else - let hide = listhide - let listhide= "" - endif - - " Prune the list by hiding any files which match -" call Decho("pruning <".hide."> listhide<".listhide.">") - if g:netrw_hide == 1 - exe 'keepjumps silent '.w:netrw_bannercnt.',$g~'.hide.'~d' - elseif g:netrw_hide == 2 - exe 'keepjumps silent '.w:netrw_bannercnt.',$v~'.hide.'~d' - endif - endwhile - -" call Dret("NetrwListHide") -endfun - -" --------------------------------------------------------------------- -" NetHideEdit: allows user to edit the file/directory hiding list -fun! NetHideEdit(mode) -" call Dfunc("NetHideEdit(mode=".a:mode.")") - - call inputsave() - let newhide= input("Edit Hiding List: ",g:netrw_list_hide) - call inputrestore() - - " refresh the listing - let g:netrw_list_hide= newhide - if a:mode == 0 - silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) - else - silent call s:LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,"./")) - endif - -" call Dret("NetHideEdit") -endfun - -" --------------------------------------------------------------------- -" NetSortSequence: allows user to edit the sorting sequence -fun! NetSortSequence(mode) -" call Dfunc("NetSortSequence(mode=".a:mode.")") - - call inputsave() - let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) - call inputrestore() - - " refresh the listing - let g:netrw_sort_sequence= newsortseq - if a:mode == 0 - silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) - else - silent call s:LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,"./")) - endif - -" call Dret("NetSortSequence") -endfun - -" --------------------------------------------------------------------- -" NetLongList: {{{2 -fun! NetLongList(mode) -" call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".g:netrw_longlist) - call s:NetSavePosn() - - if g:netrw_longlist != 0 - " turn long listing off -" call Decho("turn long listing off") - let g:netrw_longlist = 0 - let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') - - else - " turn long listing on -" call Decho("turn long listing on") - let g:netrw_longlist = 1 - let g:netrw_list_cmd = g:netrw_list_cmd." -l" - endif - setlocal ma - - " clear buffer - this will cause NetBrowse/LocalBrowse to do a refresh - %d - - " refresh the listing - if a:mode == 0 - silent call NetBrowse(NetBrowseChgDir(expand("%"),"./")) - else - silent call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,"./")) - endif - - call s:NetRestorePosn() - -" call Dret("NetLongList : g:netrw_longlist=".g:netrw_longlist) -endfun - -" --------------------------------------------------------------------- -" NetSaveWordPosn: used by the "s" command in both remote and local {{{2 -" browsing. Along with NetRestoreWordPosn(), it keeps the cursor on -" the same word even though the sorting has changed its order of appearance. -fun! s:NetSaveWordPosn() -" call Dfunc("NetSaveWordPosn()") - let s:netrw_saveword= '^'.escape(getline("."),s:netrw_cd_escape).'$' -" call Dret("NetSaveWordPosn : saveword<".s:netrw_saveword.">") -endfun - -" --------------------------------------------------------------------- -" NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2 -fun! s:NetRestoreWordPosn() -" call Dfunc("NetRestoreWordPosn()") - silent! call search(s:netrw_saveword,'w') -" call Dret("NetRestoreWordPosn") -endfun - -" --------------------------------------------------------------------- -" NetMakeDir: this function makes a directory (both local and remote) {{{2 -fun! NetMakeDir(usrhost) -" call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)") - - " get name of new directory from user. A bare will skip. - " if its currently a directory, also request will be skipped, but with - " a message. - call inputsave() - let newdirname= input("Please give directory name: ") - call inputrestore() -" call Decho("newdirname<".newdirname.">") - - if newdirname == "" -" call Dret("NetMakeDir : user aborted with bare ") - return - endif - - if a:usrhost == "" - - " Local mkdir: - " sanity checks - let fullnewdir= b:netrw_curdir.'/'.newdirname -" call Decho("fullnewdir<".fullnewdir.">") - if isdirectory(fullnewdir) - if !exists("g:netrw_quiet") - echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("NetMakeDir : directory<".newdirname."> exists previously") - return - endif - if filereadable(fullnewdir) - if !exists("g:netrw_quiet") - echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("NetMakeDir : file<".newdirname."> exists previously") - return - endif - - " requested new local directory is neither a pre-existing file or - " directory, so make it! - if exists("*mkdir") - call mkdir(fullnewdir,"p") - else - let netrw_origdir= s:NetGetcwd(1) - exe 'cd '.b:netrw_curdir -" call Decho("netrw_origdir<".netrw_origdir."> b:netrw_curdir<".b:netrw_curdir.">") -" call Decho("exe silent! !".g:netrw_local_mkdir.' "'.newdirname.'"') - exe "silent! !".g:netrw_local_mkdir.' "'.newdirname.'"' - if !g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif - endif - - if v:shell_error == 0 - " refresh listing -" call Decho("refresh listing") - let linenum= line(".") - norm! H0 - let hline = line(".") - set ma|norm! 2D - call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./')) - exe "norm! ".hline."G0z\" - exe linenum - elseif !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - redraw! - - else - " Remote mkdir: - let mkdircmd = substitute(g:netrw_mkdir_cmd,'\',a:usrhost,'') - let newdirname= "'".'"'.substitute(expand("%"),'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname.'"'."'" -" call Decho("exe silent! !".mkdircmd." ".newdirname) - exe "silent! !".mkdircmd." ".newdirname - if v:shell_error == 0 - " refresh listing - let linenum= line(".") - norm! H0 - let hline = line(".") - call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) - exe "norm! ".hline."G0z\" - exe linenum - elseif !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - redraw! - endif - -" call Dret("NetMakeDir") -endfun - -" --------------------------------------------------------------------- -" NetBookmarkDir: {{{2 -" 0: (user: ) bookmark current directory -" 1: (user: ) change to the bookmarked directory -" 2: (user: ) list bookmarks -" 3: (LocalBrowse) record current directory history -" 4: (user: ) go up (previous) bookmark -" 5: (user: ) go down (next) bookmark -fun! NetBookmarkDir(chg,curdir) -" call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count) - if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt - " looks like a "b" was pressed while in the banner region - if line("$") > w:netrw_bannercnt - exe w:netrw_bannercnt - endif - echo "" -" call Dret("NetBookmarkDir - ignoring") - return - endif - - if a:chg == 0 - " bookmark the current directory - let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir - if !exists("g:NETRW_BOOKMARKMAX") - let g:NETRW_BOOKMARKMAX= v:count - elseif v:count > g:NETRW_BOOKMARKMAX - let g:NETRW_BOOKMARKMAX= v:count - endif - echo "bookmarked the current directory" - - elseif a:chg == 1 - " change to the bookmarked directory - if exists("g:NETRW_BOOKMARKDIR_{v:count}") - exe "e ".g:NETRW_BOOKMARKDIR_{v:count} - else - echomsg "Sorry, bookmark#".v:count." doesn't exist!" - endif - - elseif a:chg == 2 - " list user's bookmarks - if exists("g:NETRW_BOOKMARKMAX") -" call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]") - let cnt= 0 - while cnt <= g:NETRW_BOOKMARKMAX - if exists("g:NETRW_BOOKMARKDIR_{cnt}") -" call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}) - echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt} - endif - let cnt= cnt + 1 - endwhile - endif - - " list directory history - let cnt = g:NETRW_DIRHIST_CNT - let first = 1 - let histcnt = 0 - while ( first || cnt != g:NETRW_DIRHIST_CNT ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT) - let histcnt= histcnt + 1 - if exists("g:NETRW_DIRHIST_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}) - echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt} - endif - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax - if cnt < 0 - let cnt= cnt + g:netrw_dirhistmax - endif - endwhile - - elseif a:chg == 3 - " saves most recently visited directories (when they differ) - if !exists("g:NETRW_DIRHIST_0") || g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} != a:curdir - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax - let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e') -" call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") - endif - - elseif a:chg == 4 - " u: change to the previous directory stored on the history list - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax - if g:NETRW_DIRHIST_CNT < 0 - let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax - endif - if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") -" call Decho("changedir u#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") - exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} - else - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax - echo "Sorry, no predecessor directory exists yet" - endif - - elseif a:chg == 5 - " U: change to the subsequent directory stored on the history list - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax - if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") -" call Decho("changedir U#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") - exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} - else - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax - if g:NETRW_DIRHIST_CNT < 0 - let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax - endif - echo "Sorry, no successor directory exists yet" - endif - endif -" call Dret("NetBookmarkDir") -endfun - -" ========================================== -" Local Directory Browsing Support: {{{1 -" ========================================== - -" --------------------------------------------------------------------- -" LocalBrowse: supports local file/directory browsing {{{2 -fun! LocalBrowse(dirname) - -" let dirname= (a:dirname == "")? expand("%:p") : a:dirname - if !isdirectory(a:dirname) - " not a directory, ignore it - return - endif - - " unfortunate interaction -- when putting debugging calls - " above one can no longer enter the DBG buffer. -" call Dfunc("LocalBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by) -" call Dredir("ls!") - - if exists("s:netrw_skipbrowse") - unlet s:netrw_skipbrowse -" call Dret("NetBrowse") - return - endif - - if v:version < 603 - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** vim version<".v:version."> too old for browsing with netrw" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("LocalBrowse : vim version<".v:version."> too old") - return - endif - - " record autochdir setting and then insure its unset (tnx to David Fishburn) - if has("netbeans_intg") || has("sun_workshop") - let keep_autochdir= &autochdir - set noautochdir - endif - - " use buffer-oriented WinVars if buffer ones exist but window ones don't - call s:UseBufWinVars() - - " find buffer number of buffer named precisely the same as a:dirname - let bufnum= bufnr(a:dirname) -" call Decho("findbuf: bufnum=".bufnum) - if bufnum > 0 && bufname(bufnum) != a:dirname - let ibuf= 1 - let buflast= bufnr("$") - while bufname(ibuf) !~ '^'.a:dirname.'\=$' && ibuf <= buflast -" call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".a:dirname.">") - let ibuf= ibuf + 1 - endwhile - if ibuf > buflast - let bufnum= -1 - else - let bufnum= ibuf - endif -" call Decho("findbuf: bufnum=".bufnum." (final)") - endif - - " get cleared buffer - if bufnum < 0 - if v:version < 700 - enew! - else - keepalt enew! - endif -" call Decho("enew buffer") - else - if v:version < 700 - exe "b ".bufnum - else - exe "keepalt b ".bufnum - endif - if exists("s:last_sort_by") && g:netrw_sort_by == s:last_sort_by - if getline(2) =~ '^" Directory Listing ' - if !g:netrw_keepdir -" call Decho("change directory: cd ".b:netrw_curdir) - exe 'cd '.b:netrw_curdir - endif -" call Dret("LocalBrowse : reusing buffer#".bufnum."<".a:dirname.">") - return - endif - endif - endif - let s:last_sort_by= g:netrw_sort_by - - " get the new directory name - let b:netrw_curdir= substitute(a:dirname,'\\','/','ge') - if b:netrw_curdir =~ '[/\\]$' - let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') - endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") - - " make netrw's idea of the current directory vim's if the user wishes - if !g:netrw_keepdir -" call Decho("change directory: cd ".b:netrw_curdir) - try - exe 'cd '.b:netrw_curdir - catch /^Vim\%((\a\+)\)\=:E472/ - echohl Error | echo "***netrw*** unable to change directory to <".b:netrw_curdir."> (permissions?)" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - if exists("w:netrw_prvdir") - let b:netrw_curdir= w:netrw_prvdir - else -" call Dret("LocalBrowse : reusing buffer#".bufnum."<".a:dirname.">") - return - endif - endtry - endif - - " change the name of the buffer to reflect the b:netrw_curdir - exe 'silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape) - - " make this buffer modifiable and hidden - setlocal ma hidden nonu - if v:version < 700 - silent! %d - else - keepalt silent! %d - endif - - " --------------------------- - " Perform Directory Listing: - - " save current directory on directory history list - call NetBookmarkDir(3,b:netrw_curdir) - - " set up all the maps -" call Decho("Setting up local browser maps") - nnoremap :exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) - nnoremap :set ma%dcall LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,'./'))redraw! - nnoremap - :exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,'../')) - nnoremap a :let g:netrw_hide=(g:netrw_hide+1)%3exe "norm! 0"call LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,'./')) - nnoremap b :call NetBookmarkDir(0,b:netrw_curdir) - nnoremap B :call NetBookmarkDir(1,b:netrw_curdir) - nnoremap c :exe "cd ".b:netrw_curdir - nnoremap d :call NetMakeDir("") - nnoremap :call NetHideEdit(1) - nnoremap i :call NetLongList(1) - nnoremap o :call NetSplit(2) - nnoremap p :exe "norm! 0"call LocalPreview(LocalBrowseChgDir(b:netrw_curdir,NetGetWord(),1)) - nnoremap q :call NetBookmarkDir(2,b:netrw_curdir) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,'./')) - nnoremap s :call NetSaveWordPosn()let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'exe "norm! 0"call LocalBrowse(LocalBrowseChgDir(b:netrw_curdir,'./'))call NetRestoreWordPosn() - nnoremap S :call NetSortSequence(1) - nnoremap u :call NetBookmarkDir(4,expand("%")) - nnoremap U :call NetBookmarkDir(5,expand("%")) - nnoremap v :call NetSplit(3) - nnoremap x :exe "norm! 0"call NetBrowseX(LocalBrowseChgDir(b:netrw_curdir,NetGetWord(),0),0) - nnoremap <2-leftmouse> :exe "norm! 0"call LocalRefresh(LocalBrowseChgDir(b:netrw_curdir,NetGetWord())) - nnoremap :Pexplore - nnoremap :Nexplore - exe 'nnoremap :exe "norm! 0"call LocalBrowseRm("'.b:netrw_curdir.'")' - exe 'vnoremap :call LocalBrowseRm("'.b:netrw_curdir.'")' - exe 'nnoremap D :exe "norm! 0"call LocalBrowseRm("'.b:netrw_curdir.'")' - exe 'vnoremap D :call LocalBrowseRm("'.b:netrw_curdir.'")' - exe 'nnoremap R :exe "norm! 0"call LocalBrowseRename("'.b:netrw_curdir.'")' - exe 'vnoremap R :call LocalBrowseRename("'.b:netrw_curdir.'")' - exe 'nnoremap m :call NetMakeDir("")' - nnoremap ? :he netrw-dir - - " Set up the banner -" call Decho("set up banner") - keepjumps put ='\" ============================================================================' - keepjumps 1d - keepjumps put ='\" Directory Listing (netrw '.g:loaded_netrw.')' - keepjumps put ='\" '.b:netrw_curdir - let w:netrw_bannercnt= 3 - - let sortby= g:netrw_sort_by - if g:netrw_sort_direction =~ "^r" - let sortby= sortby." reversed" - endif - - " Sorted by... - if g:netrw_sort_by =~ "^n" -" call Decho("directories will be sorted by name") - " sorted by name - keepjumps put ='\" Sorted by '.sortby - keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence - let w:netrw_bannercnt= w:netrw_bannercnt + 2 - else -" call Decho("directories will be sorted by size or date") - " sorted by size or date - keepjumps put ='\" Sorted by '.sortby - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - endif - - " Hiding... -or- Showing... - if g:netrw_list_hide != "" && g:netrw_hide - if g:netrw_hide == 1 - keepjumps put ='\" Hiding: '.g:netrw_list_hide - else - keepjumps put ='\" Showing: '.g:netrw_list_hide - endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - endif - keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec' - keepjumps put ='\" ============================================================================' - let w:netrw_bannercnt= w:netrw_bannercnt + 2 - - " bannercnt should index the line just after the banner - let w:netrw_bannercnt= w:netrw_bannercnt + 1 -" call Decho("bannercnt=".w:netrw_bannercnt) - - " generate the requested directory listing - call LocalBrowseList() - - " set up syntax highlighting - if has("syntax") - setlocal ft=netrwlist - if !exists("g:syntax_on") || !g:syntax_on - setlocal ft= - endif - endif - - " manipulate the directory listing (hide, sort) - if line("$") >= w:netrw_bannercnt - if g:netrw_hide && g:netrw_list_hide != "" - call s:NetrwListHide() - endif - if line("$") >= w:netrw_bannercnt - - if g:netrw_sort_by =~ "^n" - call s:SetSort() - - if v:version < 700 - exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()' - elseif g:netrw_sort_direction =~ 'n' - exe 'keepjumps silent '.w:netrw_bannercnt.',$sort' - else - exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!' - endif - exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e' - - else - if v:version < 700 - exe 'keepjumps silent '.w:netrw_bannercnt.',$call s:NetSort()' - elseif g:netrw_sort_direction =~ 'n' - exe 'keepjumps silent '.w:netrw_bannercnt.',$sort' - else - exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!' - endif - exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{-}\///e' - endif - - endif - endif - if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt - exe w:netrw_bannercnt - endif - - " record previous current directory - let w:netrw_prvdir= b:netrw_curdir - - " save certain window-oriented variables into buffer-oriented variables - call s:BufWinVars() - - setlocal noma nomod nonu bh=hide nobl - if has("netbeans_intg") || has("sun_workshop") - let &autochdir= keep_autochdir - endif - -" call Dret("LocalBrowse : file<".expand("%:p")."> bufname<".bufname("%").">") -endfun - -" --------------------------------------------------------------------- -" LocalBrowseList: does the job of "ls" for local directories {{{2 -fun! LocalBrowseList() -" call Dfunc("LocalBrowseList() b:netrw_curdir<".b:netrw_curdir.">") - - " get the list of files contained in the current directory - let dirname = escape(b:netrw_curdir,s:netrw_glob_escape) - let dirnamelen = strlen(b:netrw_curdir) - let filelist = glob(dirname."/*") -" call Decho("glob(dirname<".dirname.">,*)=".filelist) - if filelist != "" - let filelist= filelist."\n" - endif - let filelist= filelist.glob(dirname."/.*") -" call Decho("glob(dirname<".dirname.">,.*)=".glob(dirname.".*")) - - " if the directory name includes a "$", and possibly other characters, - " the glob() doesn't include "." and ".." entries. - if filelist !~ '[\\/]\.[\\/]\=\(\n\|$\)' -" call Decho("forcibly tacking on .") - if filelist == "" - let filelist= dirname."." - else - let filelist= filelist."\n".b:netrw_curdir."." - endif -" call Decho("filelist<".filelist.">") - endif - if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' -" call Decho("forcibly tacking on ..") - let filelist= filelist."\n".b:netrw_curdir.".." -" call Decho("filelist<".filelist.">") - endif - let filelist= substitute(filelist,'\n\{2,}','\n','ge') - -" call Decho("dirname<".dirname.">") -" call Decho("dirnamelen<".dirnamelen.">") -" call Decho("filelist<".filelist.">") - - while filelist != "" - if filelist =~ '\n' - let filename = substitute(filelist,'\n.*$','','e') - let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') - else - let filename = filelist - let filelist = "" - endif - let pfile= filename - if isdirectory(filename) - let pfile= filename."/" - endif - if pfile =~ '//$' - let pfile= substitute(pfile,'//$','/','e') - endif - let pfile= strpart(pfile,dirnamelen) - let pfile= substitute(pfile,'^/','','e') -" call Decho(" ") -" call Decho("filename<".filename.">") -" call Decho("pfile <".pfile.">") - - if g:netrw_longlist - let sz = getfsize(filename) - if v:version <= 700 - let fsz = strpart(" ",1,15-strlen(sz)).sz - let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) - else - let pfile= printf('%-'.g:netrw_maxfilenamelen.'s%15d%s',pfile,sz,getftime(filename)) - endif -" call Decho("sz=".sz." fsz=".fsz) - endif - - if g:netrw_sort_by =~ "^t" - " sort by time (handles time up to 1 quintillion seconds, US) -" call Decho("getftime(".filename.")=".getftime(filename)) - let t = getftime(filename) - let ft = strpart("000000000000000000",1,18-strlen(t)).t -" call Decho("exe keepjumps put ='".ft.'/'.filename."'") - let ftpfile= ft.'/'.pfile - keepjumps put=ftpfile - - elseif g:netrw_sort_by =~ "^s" - " sort by size (handles file sizes up to 1 quintillion bytes, US) -" call Decho("getfsize(".filename.")=".getfsize(filename)) - let sz = getfsize(filename) - let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe keepjumps put ='".fsz.'/'.filename."'") - let fszpfile= fsz.'/'.pfile - keepjumps put =fszpfile - - else - " sort by name -" call Decho("exe keepjumps put ='".pfile."'") - keepjumps put=pfile - endif - endwhile - setlocal ts=32 - -" call Dret("LocalBrowseList") -endfun - -" --------------------------------------------------------------------- -" LocalBrowseChgDir: constructs a new directory based on the current {{{2 -" directory and a new directory name -fun! LocalBrowseChgDir(dirname,newdir,...) -" call Dfunc("LocalBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">) a:0=".a:0) - - let dirname= substitute(a:dirname,'\\','','ge') - let newdir = a:newdir - - if dirname !~ '[\/]$' - " apparently vim is "recognizing" that it is in the home directory and - " is removing the "/". Bad idea, so I have to put it back. - let dirname= dirname.'/' -" call Decho("adjusting dirname<".dirname.">") - endif - - if newdir !~ '[\/]$' - " handling a file - let dirname= dirname.newdir -" call Decho("handling a file: dirname<".dirname.">") - " this lets NetBrowseX avoid the edit - if a:0 < 1 -" call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">") -" call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">") - exe "e! ".escape(dirname,s:netrw_cd_escape) - endif - - elseif newdir == './' - " refresh the directory list -" call Decho("refresh directory listing") - - elseif newdir == '../' - " go up one directory - let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e') -" call Decho("go up one dir: dirname<".dirname.">") - - else - " go down one directory - let dirname= dirname.newdir -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") - endif - -" call Dret("LocalBrowseChgDir <".dirname.">") - return dirname -endfun - -" --------------------------------------------------------------------- -" LocalBrowseRm: {{{2 -fun! LocalBrowseRm(path) range -" call Dfunc("LocalBrowseRm(path<".a:path.">)") -" call Decho("firstline=".a:firstline." lastline=".a:lastline) - - " preparation for removing multiple files/directories - let ctr = a:firstline - let ret = 0 - let all= 0 - - " remove multiple files and directories - while ctr <= a:lastline - exe "keepjumps ".ctr - - " sanity checks - if line(".") < w:netrw_bannercnt - let ctr= ctr + 1 - continue - endif - let curword= s:NetGetWord() - if curword == "./" || curword == "../" - let ctr= ctr + 1 - continue - endif - - norm! 0 - let rmfile= a:path."/".curword -" call Decho("rmfile<".rmfile.">") - - if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') - " attempt to remove file - if !all - echohl Statement - call inputsave() - let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - echohl NONE - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' - let all= 1 - endif - endif - - if all || ok =~ 'y\%[es]' || ok == "" - let ret= delete(rmfile) -" call Decho("errcode=".v:shell_error." ret=".ret) - elseif ok =~ 'q\%[uit]' - break - endif - - else - " attempt to remove directory - if !all - echohl Statement - call inputsave() - let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") - call inputrestore() - let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') - if ok =~ 'a\%[ll]' - let all= 1 - endif - endif - let rmfile= substitute(rmfile,'[\/]$','','e') - - if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(".g:netrw_local_rmdir.' "'.rmfile.'")') - call system(g:netrw_local_rmdir.' "'.rmfile.'"') -" call Decho("v:shell_error=".v:shell_error) - - if v:shell_error != 0 -" call Decho("2nd attempt to remove directory<".rmfile.">") - let errcode= delete(rmfile) -" call Decho("errcode=".errcode) - - if errcode != 0 - if has("unix") -" call Decho("3rd attempt to remove directory<".rmfile.">") - call system("rm ".rmfile) - if v:shell_error != 0 && !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - elseif !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - endif - endif - - elseif ok =~ 'q\%[uit]' - break - endif - endif - - let ctr= ctr + 1 - endwhile - - " refresh the directory - let curline= line(".") -" call Decho("refresh the directory") - call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./')) - exe curline - -" call Dret("LocalBrowseRm") -endfun - -" --------------------------------------------------------------------- -" LocalBrowseRename: rename a remote file or directory {{{2 -fun! LocalBrowseRename(path) range -" call Dfunc("LocalBrowseRename(path<".a:path.">)") - - " preparation for removing multiple files/directories - let ctr= a:firstline - - " attempt to rename files/directories - while ctr <= a:lastline - exe "keepjumps ".ctr - - " sanity checks - if line(".") < w:netrw_bannercnt - let ctr= ctr + 1 - continue - endif - let curword= s:NetGetWord() - if curword == "./" || curword == "../" - let ctr= ctr + 1 - continue - endif - - norm! 0 - let oldname= a:path."/".curword -" call Decho("oldname<".oldname.">") - - call inputsave() - let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) - call inputrestore() - - let ret= rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">") - - let ctr= ctr + 1 - endwhile - - " refresh the directory - let curline= line(".") -" call Decho("refresh the directory listing") - call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./')) - exe "keepjumps ".curline -" call Dret("LocalBrowseRename") -endfun - -" --------------------------------------------------------------------- -" LocalPreview: {{{2 -fun! LocalPreview(path) range -" call Dfunc("LocalPreview(path<".a:path.">)") - if has("quickfix") - if !isdirectory(a:path) - exe "pedit ".a:path - elseif !exists("g:netrw_quiet") - echohl WarningMsg | echo "***netrw*** sorry, cannot preview a directory such as <".a:path.">" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - elseif !exists("g:netrw_quiet") - echohl WarningMsg | echo "***netrw*** sorry, to preview your vim needs the quickfix feature compiled in" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif -" call Dret("LocalPreview") -endfun - -" --------------------------------------------------------------------- -" LocalRefresh: {{{2 -fun! LocalRefresh(dirname) -" call Dfunc("LocalRefresh(dirname<".a:dirname.">)") - set ma - %d - call LocalBrowse(a:dirname) - redraw! -" call Dret("LocalRefresh") -endfun - -" --------------------------------------------------------------------- -" Explore: launch the local browser in the directory of the current file {{{2 -" dosplit==0: the window will be split iff the current file has -" been modified -" dosplit==1: the window will be split before running the local -" browser -fun! s:Explore(indx,dosplit,style,...) -" call Dfunc("Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.")") - - " if dosplit or file has been modified - if a:dosplit || &modified - call SaveWinVars() - - if a:style == 0 " Explore, Sexplore - exe g:netrw_winsize."wincmd s" -" call Decho("style=0: Explore or Sexplore") - - elseif a:style == 1 "Explore!, Sexplore! - exe g:netrw_winsize."wincmd v" -" call Decho("style=1: Explore! or Sexplore!") - - elseif a:style == 2 " Hexplore - exe "bel ".g:netrw_winsize."wincmd s" -" call Decho("style=2: Hexplore") - - elseif a:style == 3 " Hexplore! - exe "abo ".g:netrw_winsize."wincmd s" -" call Decho("style=3: Hexplore!") - - elseif a:style == 4 " Vexplore - exe "lefta ".g:netrw_winsize."wincmd v" -" call Decho("style=4: Vexplore") - - elseif a:style == 5 " Vexplore! - exe "rightb ".g:netrw_winsize."wincmd v" -" call Decho("style=5: Vexplore!") - endif - call s:CopyWinVars() - endif - norm! 0 - - if a:1 == "" && a:indx >= 0 - " Explore Hexplore Vexplore Sexplore - let newdir= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') - if newdir =~ '^scp:' || newdir =~ '^ftp:' -" call Decho("calling NetBrowse(newdir<".newdir.">)") - call s:NetBrowse(newdir) - else -" call Decho("calling LocalBrowse(newdir<".newdir.">)") - call s:LocalBrowse(newdir) - endif - - elseif a:1 =~ '\*\*/' || a:indx < 0 - " Nexplore Pexplore -or- Explore **/... - - if has("path_extra") && v:version >= 700 - if !exists("w:netrw_explore_indx") - let w:netrw_explore_indx= 0 - endif - let indx = a:indx - if indx == -1 - let indx= w:netrw_explore_indx + 1 - elseif indx == -2 - let indx= w:netrw_explore_indx - 1 - else - let w:netrw_explore_indx = 0 - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() - endif - let w:netrw_explore_list = split(expand(b:netrw_curdir."/".a:1),'\n') - let w:netrw_explore_listlen = len(w:netrw_explore_list) - if w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/' - echohl WarningMsg | echo "***netrw*** no files matched" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() -" call Dret("Explore") - return - endif - endif - - " NetrwStatusLine support - let w:netrw_explore_indx= indx - if !exists("s:netrw_explore_stl") - let s:netrw_explore_stl= &stl - endif - set stl=%f\ %h%m%r%=%{NetrwStatusLine()} -" call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) - - " sanity check - if indx >= w:netrw_explore_listlen || indx < 0 - let indx= (indx < 0)? 0 : ( w:netrw_explore_listlen - 1 ) - echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() -" call Dret("Explore") - return - endif - - exe "let dirfile= w:netrw_explore_list[".indx."]" -" call Decho("dirfile<".dirfile."> indx=".indx) - let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("newdir<".newdir.">") -" call Decho("calling LocalBrowse(newdir<".newdir.">)") - call s:LocalBrowse(newdir) - call search(substitute(dirfile,"^.*/","",""),"W") - let w:netrw_explore_mtchcnt = indx + 1 - let w:netrw_explore_bufnr = bufnr(".") - let w:netrw_explore_line = line(".") -" call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) - - else - if v:version < 700 - echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for Exploring with **!" | echohl None - elseif !exists("g:netrw_quiet") - echohl WarningMsg | echo "***netrw*** your vim needs the +path_extra feature for Exploring with **!" | echohl None | echohl None - endif - call inputsave()|call input("Press to continue")|call inputrestore() - endif - - else - let newdir= a:1 -" call Decho("calling LocalBrowse(newdir<".newdir.">)") - call s:LocalBrowse(newdir) - endif - -" call Dret("Explore") -endfun - -" --------------------------------------------------------------------- -" NetrwStatusLine: {{{2 -fun! NetrwStatusLine() -" 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") - 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 - -" --------------------------------------------------------------------- -" NetGetcwd: get the current directory. {{{2 -" Change backslashes to forward slashes, if any. -" If doesc is true, escape certain troublesome characters -fun! NetGetcwd(doesc) -" call Dfunc("NetGetcwd(doesc=".a:doesc.")") - let curdir= substitute(getcwd(),'\\','/','ge') - if curdir !~ '[\/]$' - let curdir= curdir.'/' - endif - if a:doesc - let curdir= escape(curdir,s:netrw_cd_escape) - endif -" call Dret("NetGetcwd <".curdir.">") - return curdir -endfun - -" --------------------------------------------------------------------- -" NetMethod: determine method of transfer {{{1 -" method == 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http (wget) -" 6: cadaver -" 7: rsync -" 8: fetch -" 9: sftp -fun! s:NetMethod(choice) " globals: method machine id passwd fname -" call Dfunc("NetMethod(a:choice<".a:choice.">)") - - " initialization - let b:netrw_method = 0 - let g:netrw_machine = "" - let b:netrw_fname = "" - let g:netrw_port = "" - - " Patterns: - " mipf : a:machine a:id password filename Use ftp - " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd - " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd - " rcpurm : rcp://[user@]host/filename Use rcp - " rcphf : [user@]host:filename Use rcp - " scpurm : scp://[user@]host[[#:]port]/filename Use scp - " httpurm : http://[user@]host/filename Use wget - " davurm : [s]dav://host[:port]/path Use cadaver - " rsyncurm : rsync://host[:port]/path Use rsync - " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) - " sftpurm : sftp://[user@]host/filename Use scp - let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' - let mf = '^\(\S\+\)\s\+\(\S\+\)$' - let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' - let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' - let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' - let scpurm = '^scp://\([^/]\{-}\)\([#:]\d\+\)\=/\(.*\)$' - let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$' - let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$' - let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' - let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' - let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' - -" call Decho("determine method:") - " Determine Method - " rcp://user@hostname/...path-to-file - if match(a:choice,rcpurm) == 0 -" call Decho("rcp://...") - let b:netrw_method = 1 - let userid = substitute(a:choice,rcpurm,'\1',"") - let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") - let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"") - if userid != "" - let g:netrw_uid= userid - endif - - " scp://user@hostname/...path-to-file - elseif match(a:choice,scpurm) == 0 -" call Decho("scp://...") - let b:netrw_method = 4 - let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") - let g:netrw_port = substitute(a:choice,scpurm,'\2',"") - let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") - - " http://user@hostname/...path-to-file - elseif match(a:choice,httpurm) == 0 -" call Decho("http://...") - let b:netrw_method = 5 - let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") - let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") - - " dav://hostname[:port]/..path-to-file.. - elseif match(a:choice,davurm) == 0 -" call Decho("dav://...") - let b:netrw_method= 6 - if a:choice =~ '^s' - let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") - else - let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"") - endif - let b:netrw_fname = substitute(a:choice,davurm,'\3',"") - - " rsync://user@hostname/...path-to-file - elseif match(a:choice,rsyncurm) == 0 -" call Decho("rsync://...") - let b:netrw_method = 7 - let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") - let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") - - " ftp://[user@]hostname[[:#]port]/...path-to-file - elseif match(a:choice,ftpurm) == 0 -" call Decho("ftp://...") - let userid = substitute(a:choice,ftpurm,'\2',"") - let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") - let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") - let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") - if userid != "" - let g:netrw_uid= userid - endif - if exists("g:netrw_uid") && exists("g:netrw_passwd") - let b:netrw_method = 3 - else - if filereadable(expand("$HOME/.netrc")) && !exists("g:netrw_ignorenetrc") - let b:netrw_method= 2 - else - if !exists("g:netrw_uid") || g:netrw_uid == "" - call NetUserPass() - elseif !exists("g:netrw_passwd") || g:netrw_passwd == "" - call NetUserPass(g:netrw_uid) - " else just use current g:netrw_uid and g:netrw_passwd - endif - let b:netrw_method= 3 - endif - endif - - elseif match(a:choice,fetchurm) == 0 -" call Decho("fetch://...") - let b:netrw_method = 8 - let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") - let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") - let b:netrw_option = substitute(a:choice,fetchurm,'\4',"") - let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"") - - " Issue an ftp : "machine id password [path/]filename" - elseif match(a:choice,mipf) == 0 -" call Decho("(ftp) host id pass file") - let b:netrw_method = 3 - let g:netrw_machine = substitute(a:choice,mipf,'\1',"") - let g:netrw_uid = substitute(a:choice,mipf,'\2',"") - let g:netrw_passwd = substitute(a:choice,mipf,'\3',"") - let b:netrw_fname = substitute(a:choice,mipf,'\4',"") - - " Issue an ftp: "hostname [path/]filename" - elseif match(a:choice,mf) == 0 -" call Decho("(ftp) host file") - if exists("g:netrw_uid") && exists("g:netrw_passwd") - let b:netrw_method = 3 - let g:netrw_machine = substitute(a:choice,mf,'\1',"") - let b:netrw_fname = substitute(a:choice,mf,'\2',"") - - elseif filereadable(expand("$HOME/.netrc")) - let b:netrw_method = 2 - let g:netrw_machine = substitute(a:choice,mf,'\1',"") - let b:netrw_fname = substitute(a:choice,mf,'\2',"") - endif - - " sftp://user@hostname/...path-to-file - elseif match(a:choice,sftpurm) == 0 -" call Decho("sftp://...") - let b:netrw_method = 9 - let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") - let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") - - " Issue an rcp: hostname:filename" (this one should be last) - elseif match(a:choice,rcphf) == 0 -" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") - let b:netrw_method = 1 - let userid = substitute(a:choice,rcphf,'\2',"") - let g:netrw_machine= substitute(a:choice,rcphf,'\3',"") - let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") -" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") -" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") -" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") -" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") - if userid != "" - let g:netrw_uid= userid - endif - if has("win32") || has("win95") || has("win64") || has("win16") - " don't let PCs try <.netrc> - let b:netrw_method = 3 - endif - - else - if !exists("g:netrw_quiet") - echohl Error | echo "***netrw*** cannot determine method" | echohl None - call inputsave()|call input("Press to continue")|call inputrestore() - endif - let b:netrw_method = -1 - endif - - " remove any leading [:#] from port number - if g:netrw_port != "" - let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','') - endif - -" call Decho("a:choice <".a:choice.">") -" call Decho("b:netrw_method <".b:netrw_method.">") -" call Decho("g:netrw_machine<".g:netrw_machine.">") -" call Decho("g:netrw_port <".g:netrw_port.">") -" if exists("g:netrw_uid") "Decho -" call Decho("g:netrw_uid <".g:netrw_uid.">") -" endif "Decho -" if exists("g:netrw_passwd") "Decho -" call Decho("g:netrw_passwd <".g:netrw_passwd.">") -" endif "Decho -" call Decho("b:netrw_fname <".b:netrw_fname.">") -" call Dret("NetMethod") -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 - -" ------------------------------------------------------------------------ -" NetOptionSave: save options and set to "standard" form {{{1 -fun!s:NetOptionSave() -" call Dfunc("NetOptionSave()") - - " Get Temporary Filename - let s:aikeep = &ai - let s:cinkeep = &cin - let s:cinokeep = &cino - let s:comkeep = &com - let s:cpokeep = &cpo - let s:dirkeep = getcwd() - let s:gdkeep = &gd - let s:twkeep = &tw - setlocal cino = - setlocal com = - setlocal cpo -=aA - setlocal nocin noai - setlocal tw =0 - if has("win32") && !has("win95") - let s:swfkeep= &swf - setlocal noswf -" call Decho("setting s:swfkeep to <".&swf.">") - endif - -" call Dret("NetOptionSave") -endfun - -" ------------------------------------------------------------------------ -" NetOptionRestore: restore options {{{1 -fun! s:NetOptionRestore() -" call Dfunc("NetOptionRestore()") - - let &ai = s:aikeep - let &cin = s:cinkeep - let &cino = s:cinokeep - let &com = s:comkeep - let &cpo = s:cpokeep - exe "lcd ".s:dirkeep - let &gd = s:gdkeep - let &tw = s:twkeep - if exists("s:swfkeep") - if &directory == "" - " user hasn't specified a swapfile directory; - " netrw will temporarily make the swapfile - " directory the current local one. - let &directory = getcwd() - silent! let &swf = s:swfkeep - set directory= - else - let &swf= s:swfkeep - endif - unlet s:swfkeep - endif - unlet s:aikeep - unlet s:cinkeep - unlet s:cinokeep - unlet s:comkeep - unlet s:cpokeep - unlet s:gdkeep - unlet s:twkeep - unlet s:dirkeep - -" call Dret("NetOptionRestore") -endfun - -" ------------------------------------------------------------------------ -" NetReadFixup: this sort of function is typically written by the user {{{1 -" to handle extra junk that their system's ftp dumps -" into the transfer. This function is provided as an -" example and as a fix for a Windows 95 problem: in my -" experience, win95's ftp always dumped four blank lines -" at the end of the transfer. -if has("win95") && g:netrw_win95ftp - fun! NetReadFixup(method, line1, line2) -" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") - if method == 3 " ftp (no <.netrc>) - let fourblanklines= line2 - 3 - silent fourblanklines.",".line2."g/^\s*/d" - endif -" call Dret("NetReadFixup") - endfun -endif - -" --------------------------------------------------------------------- -" NetSort: Piet Delport's BISort2() function, modified to take a range {{{1 -if v:version < 700 - fun! NetSort() range -" " call Dfunc("NetSort()") - - let i = a:firstline + 1 - while i <= a:lastline - " find insertion point via binary search - let i_val = getline(i) - let lo = a:firstline - let hi = i - while lo < hi - let mid = (lo + hi) / 2 - let mid_val = getline(mid) - if g:netrw_sort_direction =~ '^n' - " normal sorting order - if i_val < mid_val - let hi = mid - else - let lo = mid + 1 - if i_val == mid_val | break | endif - endif - else - " reverse sorting order - if i_val > mid_val - let hi = mid - else - let lo = mid + 1 - if i_val == mid_val | break | endif - endif - endif - endwhile - " do insert - if lo < i - exe 'keepjumps '.i.'d_' - keepjumps call append(lo - 1, i_val) - endif - let i = i + 1 - endwhile - -" " call Dret("NetSort") - endfun -endif - -" --------------------------------------------------------------------- -" SetSort: sets up the sort based on the g:netrw_sort_sequence {{{1 -" What this function does is to compute a priority for the patterns -" in the g:netrw_sort_sequence. It applies a substitute to any -" "files" that satisfy each pattern, putting the priority / in -" front. An "*" pattern handles the default priority. -fun! SetSort() -" call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt) - if g:netrw_longlist - let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge') - else - let seqlist = g:netrw_sort_sequence - endif - " sanity check -- insure that * appears somewhere - if seqlist == "" - let seqlist= '*' - elseif seqlist !~ '\*' - let seqlist= seqlist.',*' - endif - let priority = 1 - while seqlist != "" - if seqlist =~ ',' - let seq = substitute(seqlist,',.*$','','e') - let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e') - else - let seq = seqlist - let seqlist = "" - endif - let eseq= escape(seq,'/') - if priority < 10 - let spriority= "00".priority.'\/' - elseif priority < 100 - let spriority= "0".priority.'\/' - else - let spriority= priority.'\/' - endif -" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") - - " sanity check - if w:netrw_bannercnt > line("$") - " apparently no files were left after a Hiding pattern was used -" call Dret("SetSort : no files left after hiding") - return - endif - if seq == '*' - exe 'keepjumps silent '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/' - else - exe 'keepjumps silent '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/' - endif - let priority = priority + 1 - endwhile - - exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e' - -" call Dret("SetSort") -endfun - -" --------------------------------------------------------------------- -" SaveWinVars: (used by Explore()) {{{1 -fun! s:SaveWinVars() -" call Dfunc("SaveWinVars()") - if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif - if exists("w:netrw_method") |let s:method = w:netrw_method |endif - if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif - if exists("w:netrw_explore_indx") |let s:explore_indx = w:netrw_explore_indx |endif - if exists("w:netrw_explore_listlen")|let s:explore_listlen = w:netrw_explore_listlen|endif - if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif - if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif - if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif - if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif -" call Dret("SaveWinVars") -endfun - -" --------------------------------------------------------------------- -" CopyWinVars: (used by Explore()) {{{1 -fun! s:CopyWinVars() -" call Dfunc("CopyWinVars()") - if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif - if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif - if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif - if exists("s:explore_indx") |let w:netrw_explore_indx = s:explore_indx |unlet s:explore_indx |endif - if exists("s:explore_listlen")|let w:netrw_explore_listlen = s:explore_listlen|unlet s:explore_listlen|endif - if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif - if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif - if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif - if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif -" call Dret("CopyWinVars") -endfun - -" --------------------------------------------------------------------- -" BufWinVars: (used by NetBrowse() and LocalBrowse()) {{{1 -" To allow separate windows to have their own activities, such as -" Explore **/pattern, several variables have been made window-oriented. -" However, when the user splits a browser window (ex: ctrl-w s), these -" variables are not inherited by the new window. BufWinVars() and -" UseBufWinVars() get around that. -fun! s:BufWinVars() -" call Dfunc("BufWinVars()") - if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif - if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif - if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif - if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif - if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen = w:netrw_explore_listlen|endif - if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = w:netrw_explore_mtchcnt|endif - if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif - if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif - if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif -" call Dret("BufWinVars") -endfun - -" --------------------------------------------------------------------- -" UseBufWinVars: (used by NetBrowse() and LocalBrowse() {{{1 -" Matching function to BufferWinVars() -fun! s:UseBufWinVars() -" call Dfunc("UseBufWinVars()") - if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif - if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif - if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif - if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif - if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif - if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif - if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif - if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif - if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif -" call Dret("UseBufWinVars") -endfun - -let &cpo= s:keepcpo -unlet s:keepcpo -" ------------------------------------------------------------------------ -" Modelines: {{{1 -" vim:ts=8 fdm=marker diff --git a/runtime/spell/af/main.aap b/runtime/spell/af/main.aap index d393c5fe6..ec5382509 100644 --- a/runtime/spell/af/main.aap +++ b/runtime/spell/af/main.aap @@ -11,11 +11,11 @@ FILES = af_ZA.aff af_ZA.dic all: $SPELLDIR/af.latin1.spl $SPELLDIR/af.utf-8.spl ../README_af.txt -$SPELLDIR/af.latin1.spl : $VIM $FILES +$SPELLDIR/af.latin1.spl : $FILES :sys env LANG=af_ZA.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/af af_ZA" -c q -$SPELLDIR/af.utf-8.spl : $VIM $FILES +$SPELLDIR/af.utf-8.spl : $FILES :sys env LANG=af_ZA.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/af af_ZA" -c q diff --git a/runtime/spell/bg/main.aap b/runtime/spell/bg/main.aap index 7849526ed..5d984be51 100644 --- a/runtime/spell/bg/main.aap +++ b/runtime/spell/bg/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Czech Vim spell files. +# Aap recipe for Bulgarian Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -11,14 +11,15 @@ FILES = bg_BG.aff bg_BG.dic all: $SPELLDIR/bg.cp1251.spl $SPELLDIR/bg.utf-8.spl ../README_bg.txt -$SPELLDIR/bg.cp1251.spl : $VIM $FILES +$SPELLDIR/bg.cp1251.spl : $FILES :sys env LANG=bg_BG.CP1251 $VIM -u NONE -e -c "mkspell! $SPELLDIR/bg bg_BG" -c q -$SPELLDIR/bg.utf-8.spl : $VIM $FILES +$SPELLDIR/bg.utf-8.spl : $FILES :sys env LANG=bg_BG.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/bg bg_BG" -c q ../README_bg.txt: README_bg_BG.txt :copy $source $target + :sys $VIM $target -e -c "set ff=unix" -c wq # # Fetching the files from OpenOffice.org. diff --git a/runtime/spell/ca/main.aap b/runtime/spell/ca/main.aap index b2f7350b6..2182f2916 100644 --- a/runtime/spell/ca/main.aap +++ b/runtime/spell/ca/main.aap @@ -11,11 +11,11 @@ FILES = ca_ES.aff ca_ES.dic all: $SPELLDIR/ca.latin1.spl $SPELLDIR/ca.utf-8.spl ../README_ca.txt -$SPELLDIR/ca.latin1.spl : $VIM $FILES +$SPELLDIR/ca.latin1.spl : $FILES :sys env LANG=ca_ES.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ca ca_ES" -c q -$SPELLDIR/ca.utf-8.spl : $VIM $FILES +$SPELLDIR/ca.utf-8.spl : $FILES :sys env LANG=ca_ES.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ca ca_ES" -c q diff --git a/runtime/spell/cs/main.aap b/runtime/spell/cs/main.aap index 5ead6d0a3..53ae46fea 100644 --- a/runtime/spell/cs/main.aap +++ b/runtime/spell/cs/main.aap @@ -12,13 +12,13 @@ FILES = cs_CZ.aff cs_CZ.dic all: $SPELLDIR/cs.iso-8859-2.spl $SPELLDIR/cs.utf-8.spl \ $SPELLDIR/cs.cp1250.spl ../README_cs.txt -$SPELLDIR/cs.iso-8859-2.spl : $VIM $FILES +$SPELLDIR/cs.iso-8859-2.spl : $FILES :sys env LANG=cs_CZ.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/cs cs_CZ" -c q -$SPELLDIR/cs.utf-8.spl : $VIM $FILES +$SPELLDIR/cs.utf-8.spl : $FILES :sys env LANG=cs_CZ.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/cs cs_CZ" -c q -$SPELLDIR/cs.cp1250.spl : $VIM $FILES +$SPELLDIR/cs.cp1250.spl : $FILES :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/cs cs_CZ" -c q ../README_cs.txt: README_cs_CZ.txt diff --git a/runtime/spell/da/da_DK.diff b/runtime/spell/da/da_DK.diff new file mode 100644 index 000000000..afcb8d3bc --- /dev/null +++ b/runtime/spell/da/da_DK.diff @@ -0,0 +1,16 @@ +*** da_DK.orig.aff Sun Aug 14 20:04:31 2005 +--- da_DK.aff Mon Aug 15 14:03:06 2005 +*************** +*** 6,7 **** +--- 6,16 ---- + ++ FOL ++ LOW ++ UPP ++ ++ SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ޿ ++ SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep? ++ ++ MIDWORD '- ++ + # Foranstilling af u- diff --git a/runtime/spell/da/main.aap b/runtime/spell/da/main.aap index 53e371648..b84a80f93 100644 --- a/runtime/spell/da/main.aap +++ b/runtime/spell/da/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for French Vim spell files. +# Aap recipe for Danish Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -11,11 +11,11 @@ FILES = da_DK.aff da_DK.dic all: $SPELLDIR/da.latin1.spl $SPELLDIR/da.utf-8.spl ../README_da.txt -$SPELLDIR/da.latin1.spl : $VIM $FILES +$SPELLDIR/da.latin1.spl : $FILES :sys env LANG=da_DK.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/da da_DK" -c q -$SPELLDIR/da.utf-8.spl : $VIM $FILES +$SPELLDIR/da.utf-8.spl : $FILES :sys env LANG=da_DK.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/da da_DK" -c q diff --git a/runtime/spell/de/main.aap b/runtime/spell/de/main.aap index df608e1b7..718e78c6f 100644 --- a/runtime/spell/de/main.aap +++ b/runtime/spell/de/main.aap @@ -32,11 +32,11 @@ READMES = README_de_$*(REGIONS).txt all: $SPELLDIR/de.latin1.spl $SPELLDIR/de.utf-8.spl ../README_de.txt -$SPELLDIR/de.latin1.spl : $VIM $FILES +$SPELLDIR/de.latin1.spl : $FILES :sys env LANG=de_DE.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/de $DE_REGIONS" -c q -$SPELLDIR/de.utf-8.spl : $VIM $FILES +$SPELLDIR/de.utf-8.spl : $FILES :sys env LANG=de_DE.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/de $DE_REGIONS" -c q diff --git a/runtime/spell/el/main.aap b/runtime/spell/el/main.aap new file mode 100644 index 000000000..51fa0d36e --- /dev/null +++ b/runtime/spell/el/main.aap @@ -0,0 +1,78 @@ +# Aap recipe for Greek Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = el_GR.aff el_GR.dic + +all: $SPELLDIR/el.iso-8859-7.spl $SPELLDIR/el.utf-8.spl ../README_el.txt + +$SPELLDIR/el.iso-8859-7.spl : $FILES + :sys env LANG=el_GR.ISO8859-7 + $VIM -u NONE -e -c "mkspell! $SPELLDIR/el el_GR" -c q + +$SPELLDIR/el.utf-8.spl : $FILES + :sys env LANG=el_GR.UTF-8 + $VIM -u NONE -e -c "mkspell! $SPELLDIR/el el_GR" -c q + +../README_el.txt : README_el_GR.txt + :copy $source $target + +# +# Fetching the files from OpenOffice.org. +# +OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +:attr {fetch = $OODIR/%file%} el_GR.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +el_GR.aff el_GR.dic: {buildcheck=} + :assertpkg unzip patch + :fetch el_GR.zip + :sys $UNZIP el_GR.zip + :delete el_GR.zip + @if not os.path.exists('el_GR.orig.aff'): + :copy el_GR.aff el_GR.orig.aff + @if not os.path.exists('el_GR.orig.dic'): + :copy el_GR.dic el_GR.orig.dic + @if os.path.exists('el_GR.diff'): + :sys patch el_GR.diff + :sys {force} diff -a -C 1 el_GR.orig.dic el_GR.dic >>el_GR.diff + + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. + +check: + :assertpkg unzip diff + :fetch el_GR.zip + :mkdir tmp + :cd tmp + @try: + @import stat + :sys $UNZIP ../el_GR.zip + :sys {force} diff ../el_GR.orig.aff el_GR.aff >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy el_GR.aff ../el_GR.new.aff + :sys {force} diff ../el_GR.orig.dic el_GR.dic >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy el_GR.dic ../el_GR.new.dic + @finally: + :cd .. + :delete {r}{f}{q} tmp + :delete el_GR.zip + + +# vim: set sts=4 sw=4 : diff --git a/runtime/spell/en.ascii.spl b/runtime/spell/en.ascii.spl index c77ef9af7..9d2b068c4 100644 Binary files a/runtime/spell/en.ascii.spl and b/runtime/spell/en.ascii.spl differ diff --git a/runtime/spell/en.latin1.spl b/runtime/spell/en.latin1.spl index 851f7141f..95b536394 100644 Binary files a/runtime/spell/en.latin1.spl and b/runtime/spell/en.latin1.spl differ diff --git a/runtime/spell/en.utf-8.spl b/runtime/spell/en.utf-8.spl index d6b783644..8b2edc692 100644 Binary files a/runtime/spell/en.utf-8.spl and b/runtime/spell/en.utf-8.spl differ diff --git a/runtime/spell/en/en_AU.diff b/runtime/spell/en/en_AU.diff index c0ee62d6b..2d6e42c56 100644 --- a/runtime/spell/en/en_AU.diff +++ b/runtime/spell/en/en_AU.diff @@ -2352,7 +2352,7 @@ ! SFX 3 o ist's o ! SFX 3 0 ist's [^eoy] *** en_AU.orig.dic Fri Apr 15 13:20:36 2005 ---- en_AU.dic Sun Jul 3 17:11:07 2005 +--- en_AU.dic Tue Aug 16 17:03:44 2005 *************** *** 912,914 **** Alaska/M @@ -2603,25 +2603,26 @@ Vilnius/M ! vim/M vinaigrette/MS ---- 43742,43744 ---- +--- 43742,43745 ---- Vilnius/M ! Vim/M +! vim/? vinaigrette/MS *************** *** 45494,45496 **** yippee - y/K YMCA ---- 45487,45488 ---- +--- 45488,45489 ---- *************** *** 45586,45588 **** zap/SGRD - z/d Zealanders ---- 45578,45579 ---- +--- 45579,45580 ---- *************** *** 45655 **** ---- 45646,45653 ---- +--- 45647,45654 ---- zymurgy/S + nd + the the/! diff --git a/runtime/spell/en/en_CA.diff b/runtime/spell/en/en_CA.diff index 904e0c620..c6319ce86 100644 --- a/runtime/spell/en/en_CA.diff +++ b/runtime/spell/en/en_CA.diff @@ -165,7 +165,7 @@ ! SFX G 0 ing [^e] *** en_CA.orig.dic Sat Apr 16 14:40:06 2005 ---- en_CA.dic Sun Jul 3 17:09:40 2005 +--- en_CA.dic Tue Aug 16 17:03:55 2005 *************** *** 46,48 **** R/G @@ -405,6 +405,15 @@ + Moolenaar/M Bresenham/M *************** +*** 40455,40457 **** + proneness/MS +! transl + Conchita/M +--- 40454,40456 ---- + proneness/MS +! transl. + Conchita/M +*************** *** 50272,50273 **** --- 50271,50273 ---- Dutch/M @@ -415,19 +424,20 @@ hatchery/MS ! vim/SM compatriot/MS ---- 52565,52567 ---- +--- 52565,52568 ---- hatchery/MS ! Vim/SM +! vim/? compatriot/MS *************** *** 53490,53491 **** ---- 53490,53492 ---- +--- 53491,53493 ---- unsearchable + searchable felicitous/IY *************** *** 62341 **** ---- 62342,62349 ---- +--- 62343,62350 ---- data/M + et al. + the the/! diff --git a/runtime/spell/en/en_GB.diff b/runtime/spell/en/en_GB.diff index 6032c2558..714077d4b 100644 --- a/runtime/spell/en/en_GB.diff +++ b/runtime/spell/en/en_GB.diff @@ -2356,7 +2356,7 @@ ! SFX 3 o ist's o ! SFX 3 0 ist's [^eoy] *** en_GB.orig.dic Sun Jul 3 18:05:07 2005 ---- en_GB.dic Sun Jul 3 18:19:25 2005 +--- en_GB.dic Tue Aug 16 17:05:18 2005 *************** *** 630,632 **** Byrne/M @@ -2482,7 +2482,7 @@ vindaloo/S --- 30760,30763 ---- villein/SM -! vim/M? +! vim/? ! Vim/M vindaloo/S *************** diff --git a/runtime/spell/en/en_NZ.diff b/runtime/spell/en/en_NZ.diff index 4e28fff4e..3eee71851 100644 --- a/runtime/spell/en/en_NZ.diff +++ b/runtime/spell/en/en_NZ.diff @@ -2353,7 +2353,7 @@ ! SFX 3 o ist's o ! SFX 3 0 ist's [^eoy] *** en_NZ.orig.dic Fri Apr 15 13:20:36 2005 ---- en_NZ.dic Sun Jul 3 17:11:34 2005 +--- en_NZ.dic Tue Aug 16 17:05:28 2005 *************** *** 4,6 **** 2ZB @@ -2591,82 +2591,83 @@ Vilnius/M ! vim/M vinaigrette/MS ---- 44313,44315 ---- +--- 44313,44316 ---- Vilnius/M ! Vim/M +! vim/? vinaigrette/MS *************** *** 45906,45908 **** y'all - prey/M yacht/M5SmGD ---- 45885,45886 ---- +--- 45886,45887 ---- *************** *** 46198,46200 **** rata/M - kaka/M waka/M ---- 46176,46177 ---- +--- 46177,46178 ---- *************** *** 46216,46218 **** jandal/MS - Swanndri/M hoon/MS ---- 46193,46194 ---- +--- 46194,46195 ---- *************** *** 46242,46244 **** Invercargill/M - Te Alexandra/M ---- 46218,46219 ---- +--- 46219,46220 ---- *************** *** 46261,46263 **** Kawerau/M - Kerikeri/M Lyttelton/M ---- 46236,46237 ---- +--- 46237,46238 ---- *************** *** 46491,46493 **** Waianakarua - Hakatere Swin ---- 46465,46466 ---- +--- 46466,46467 ---- *************** *** 46690,46692 **** Omarama/M - Wairarapa/M Kilda/M ---- 46663,46664 ---- +--- 46664,46665 ---- *************** *** 46711,46713 **** Wellsford/M - Akaroa/M Avonhead/M ---- 46683,46684 ---- +--- 46684,46685 ---- *************** *** 46838,46840 **** Ballantyne's - DB Monteith's ---- 46809,46810 ---- +--- 46810,46811 ---- *************** *** 46920,46922 **** Egmont/M - Waitaki/M katipo/M ---- 46890,46891 ---- +--- 46891,46892 ---- *************** *** 46956,46958 **** Sunnyside/M - Wairau/M Waikoropupu ---- 46925,46926 ---- +--- 46926,46927 ---- *************** *** 47141,47142 **** Burkina ! Faso/M \ No newline at end of file ---- 47109,47117 ---- +--- 47110,47118 ---- Burkina ! Faso/M ! nd diff --git a/runtime/spell/en/en_US.diff b/runtime/spell/en/en_US.diff index 99ddf0a18..17051dcf8 100644 --- a/runtime/spell/en/en_US.diff +++ b/runtime/spell/en/en_US.diff @@ -172,7 +172,7 @@ + REP ie y REP i ee *** en_US.orig.dic Fri Apr 15 13:20:36 2005 ---- en_US.dic Sun Jul 3 16:59:28 2005 +--- en_US.dic Tue Aug 16 17:03:31 2005 *************** *** 5944,5946 **** bk @@ -467,6 +467,15 @@ ! sings sybarite/MS *************** +*** 56906,56908 **** + transit/SGVMD +! transl + translatability/M +--- 56905,56907 ---- + transit/SGVMD +! transl. + translatability/M +*************** *** 57728,57730 **** TX ! t/XTJBG @@ -501,16 +510,17 @@ vi/MDR ! vim/MS vinaigrette/MS ---- 59537,59539 ---- +--- 59537,59540 ---- vi/MDR ! Vim/MS +! vim/? vinaigrette/MS *************** *** 61534,61536 **** WWW ! w/XTJGV WY ---- 61533,61536 ---- +--- 61534,61537 ---- WWW ! wens ! wings @@ -520,19 +530,19 @@ yew/SM - y/F Yggdrasil/M ---- 61750,61751 ---- +--- 61751,61752 ---- *************** *** 62058,62060 **** Zsigmondy/M ! z/TGJ Zubenelgenubi/M ---- 62057,62059 ---- +--- 62058,62060 ---- Zsigmondy/M ! zings Zubenelgenubi/M *************** *** 62077 **** ---- 62076,62083 ---- +--- 62077,62084 ---- zymurgy/S + nd + the the/! diff --git a/runtime/spell/en/main.aap b/runtime/spell/en/main.aap index 37a9ed10e..9e4b98ea7 100644 --- a/runtime/spell/en/main.aap +++ b/runtime/spell/en/main.aap @@ -16,17 +16,17 @@ FILES = en_US.aff en_US.dic all: $SPELLDIR/en.latin1.spl $SPELLDIR/en.utf-8.spl \ $SPELLDIR/en.ascii.spl ../README_en.txt -$SPELLDIR/en.latin1.spl : $VIM $FILES +$SPELLDIR/en.latin1.spl : $FILES :sys env LANG=en_US.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/en en_US en_AU en_CA en_GB en_NZ" -c q -$SPELLDIR/en.utf-8.spl : $VIM $FILES +$SPELLDIR/en.utf-8.spl : $FILES :sys env LANG=en_US.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/en en_US en_AU en_CA en_GB en_NZ" -c q -$SPELLDIR/en.ascii.spl : $VIM $FILES +$SPELLDIR/en.ascii.spl : $FILES :sys $VIM -u NONE -e -c "mkspell! -ascii $SPELLDIR/en en_US en_AU en_CA en_GB en_NZ" -c q diff --git a/runtime/spell/eo/eo_l3.diff b/runtime/spell/eo/eo_l3.diff new file mode 100644 index 000000000..e69de29bb diff --git a/runtime/spell/eo/main.aap b/runtime/spell/eo/main.aap new file mode 100644 index 000000000..19b7555ab --- /dev/null +++ b/runtime/spell/eo/main.aap @@ -0,0 +1,80 @@ +# Aap recipe for Esperanto Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = eo_l3.aff eo_l3.dic + +all: $SPELLDIR/eo.iso-8859-3.spl $SPELLDIR/eo.utf-8.spl ../README_eo.txt + +$SPELLDIR/eo.iso-8859-3.spl : $FILES + :sys $VIM -u NONE -e -c "set enc=iso-8859-3" + -c "mkspell! $SPELLDIR/eo eo_l3" -c q + +$SPELLDIR/eo.utf-8.spl : $FILES + :sys $VIM -u NONE -e -c "set enc=utf-8" + -c "mkspell! $SPELLDIR/eo eo_l3" -c q + +../README_eo.txt : README_eo_l3.txt + :copy $source $target + # fix missing newline + :sys $VIM $target -e -c "set ff=unix" -c wq + +# +# Fetching the files from OpenOffice.org. +# +OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +:attr {fetch = $OODIR/%file%} eo.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +eo_l3.aff eo_l3.dic: {buildcheck=} + :assertpkg unzip patch + :fetch eo.zip + :sys $UNZIP eo.zip + :delete eo.zip + @if not os.path.exists('eo_l3.orig.aff'): + :copy eo_l3.aff eo_l3.orig.aff + @if not os.path.exists('eo_l3.orig.dic'): + :copy eo_l3.dic eo_l3.orig.dic + @if os.path.exists('eo_l3.diff'): + :sys patch eo_l3.diff + :sys {force} diff -a -C 1 eo_l3.orig.dic eo_l3.dic >>eo_l3.diff + + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. + +check: + :assertpkg unzip diff + :fetch eo.zip + :mkdir tmp + :cd tmp + @try: + @import stat + :sys $UNZIP ../eo.zip + :sys {force} diff ../eo_l3.orig.aff eo_l3.aff >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy eo_l3.aff ../eo_l3.new.aff + :sys {force} diff ../eo_l3.orig.dic eo_l3.dic >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy eo_l3.dic ../eo_l3.new.dic + @finally: + :cd .. + :delete {r}{f}{q} tmp + :delete eo.zip + + +# vim: set sts=4 sw=4 : diff --git a/runtime/spell/fo/fo_FO.diff b/runtime/spell/fo/fo_FO.diff new file mode 100644 index 000000000..212befe8d --- /dev/null +++ b/runtime/spell/fo/fo_FO.diff @@ -0,0 +1,14 @@ +*** fo_FO.orig.aff Tue Aug 16 17:39:22 2005 +--- fo_FO.aff Tue Aug 16 17:41:00 2005 +*************** +*** 6 **** +--- 6,14 ---- + ++ FOL ++ LOW ++ UPP ++ ++ SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ޿ ++ SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep? ++ ++ MIDWORD '- diff --git a/runtime/spell/fo/main.aap b/runtime/spell/fo/main.aap new file mode 100644 index 000000000..948d4a472 --- /dev/null +++ b/runtime/spell/fo/main.aap @@ -0,0 +1,78 @@ +# Aap recipe for Faroese Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = fo_FO.aff fo_FO.dic + +all: $SPELLDIR/fo.latin1.spl $SPELLDIR/fo.utf-8.spl ../README_fo.txt + +$SPELLDIR/fo.latin1.spl : $FILES + :sys env LANG=fo_FO.ISO8859-1 + $VIM -u NONE -e -c "mkspell! $SPELLDIR/fo fo_FO" -c q + +$SPELLDIR/fo.utf-8.spl : $FILES + :sys env LANG=fo_FO.UTF-8 + $VIM -u NONE -e -c "mkspell! $SPELLDIR/fo fo_FO" -c q + +../README_fo.txt : README_fo_FO.txt Copyright + :cat $source >! $target + +# +# Fetching the files from OpenOffice.org. +# +OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +:attr {fetch = $OODIR/%file%} fo_FO.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +fo_FO.aff fo_FO.dic: {buildcheck=} + :assertpkg unzip patch + :fetch fo_FO.zip + :sys $UNZIP fo_FO.zip + :delete fo_FO.zip + @if not os.path.exists('fo_FO.orig.aff'): + :copy fo_FO.aff fo_FO.orig.aff + @if not os.path.exists('fo_FO.orig.dic'): + :copy fo_FO.dic fo_FO.orig.dic + @if os.path.exists('fo_FO.diff'): + :sys patch fo_FO.diff + :sys {force} diff -a -C 1 fo_FO.orig.dic fo_FO.dic >>fo_FO.diff + + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. + +check: + :assertpkg unzip diff + :fetch fo_FO.zip + :mkdir tmp + :cd tmp + @try: + @import stat + :sys $UNZIP ../fo_FO.zip + :sys {force} diff ../fo_FO.orig.aff fo_FO.aff >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy fo_FO.aff ../fo_FO.new.aff + :sys {force} diff ../fo_FO.orig.dic fo_FO.dic >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy fo_FO.dic ../fo_FO.new.dic + @finally: + :cd .. + :delete {r}{f}{q} tmp + :delete fo_FO.zip + + +# vim: set sts=4 sw=4 : diff --git a/runtime/spell/fr/main.aap b/runtime/spell/fr/main.aap index 9e51039a4..e7424326d 100644 --- a/runtime/spell/fr/main.aap +++ b/runtime/spell/fr/main.aap @@ -11,11 +11,11 @@ FILES = fr_FR.aff fr_FR.dic all: $SPELLDIR/fr.latin1.spl $SPELLDIR/fr.utf-8.spl ../README_fr.txt -$SPELLDIR/fr.latin1.spl : $VIM $FILES +$SPELLDIR/fr.latin1.spl : $FILES :sys env LANG=fr_FR.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q -$SPELLDIR/fr.utf-8.spl : $VIM $FILES +$SPELLDIR/fr.utf-8.spl : $FILES :sys env LANG=fr_FR.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/fr fr_FR" -c q diff --git a/runtime/spell/gl/gl_ES.diff b/runtime/spell/gl/gl_ES.diff new file mode 100644 index 000000000..1ddcf7852 --- /dev/null +++ b/runtime/spell/gl/gl_ES.diff @@ -0,0 +1,15 @@ +*** gl_ES.orig.aff Tue Aug 16 17:55:38 2005 +--- gl_ES.aff Tue Aug 16 17:57:03 2005 +*************** +*** 2,3 **** +--- 2,11 ---- + TRY esianrtolcdugmphbfv ++ ++ FOL ++ LOW ++ UPP ++ ++ SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ޿ ++ SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep? ++ + # COMPOUNDMIN 3 diff --git a/runtime/spell/gl/main.aap b/runtime/spell/gl/main.aap new file mode 100644 index 000000000..2fc012aa3 --- /dev/null +++ b/runtime/spell/gl/main.aap @@ -0,0 +1,78 @@ +# Aap recipe for Galician (Spain) Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = gl_ES.aff gl_ES.dic + +all: $SPELLDIR/gl.latin1.spl $SPELLDIR/gl.utf-8.spl ../README_gl.txt + +$SPELLDIR/gl.latin1.spl : $FILES + :sys env LANG=gl_ES.ISO8859-1 + $VIM -u NONE -e -c "mkspell! $SPELLDIR/gl gl_ES" -c q + +$SPELLDIR/gl.utf-8.spl : $FILES + :sys env LANG=gl_ES.UTF-8 + $VIM -u NONE -e -c "mkspell! $SPELLDIR/gl gl_ES" -c q + +../README_gl.txt : README_gl_ES.txt + :copy $source $target + +# +# Fetching the files from OpenOffice.org. +# +OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +:attr {fetch = $OODIR/%file%} gl_ES.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +gl_ES.aff gl_ES.dic: {buildcheck=} + :assertpkg unzip patch + :fetch gl_ES.zip + :sys $UNZIP gl_ES.zip + :delete gl_ES.zip + @if not os.path.exists('gl_ES.orig.aff'): + :copy gl_ES.aff gl_ES.orig.aff + @if not os.path.exists('gl_ES.orig.dic'): + :copy gl_ES.dic gl_ES.orig.dic + @if os.path.exists('gl_ES.diff'): + :sys patch gl_ES.diff + :sys {force} diff -a -C 1 gl_ES.orig.dic gl_ES.dic >>gl_ES.diff + + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. + +check: + :assertpkg unzip diff + :fetch gl_ES.zip + :mkdir tmp + :cd tmp + @try: + @import stat + :sys $UNZIP ../gl_ES.zip + :sys {force} diff ../gl_ES.orig.aff gl_ES.aff >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy gl_ES.aff ../gl_ES.new.aff + :sys {force} diff ../gl_ES.orig.dic gl_ES.dic >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy gl_ES.dic ../gl_ES.new.dic + @finally: + :cd .. + :delete {r}{f}{q} tmp + :delete gl_ES.zip + + +# vim: set sts=4 sw=4 : diff --git a/runtime/spell/he/main.aap b/runtime/spell/he/main.aap index 4db930b9f..715851745 100644 --- a/runtime/spell/he/main.aap +++ b/runtime/spell/he/main.aap @@ -11,11 +11,11 @@ FILES = he_IL.aff he_IL.dic all: $SPELLDIR/he.utf-8.spl $SPELLDIR/he.iso-8859-8.spl ../README_he.txt -$SPELLDIR/he.utf-8.spl : $VIM $FILES +$SPELLDIR/he.utf-8.spl : $FILES :sys env LANG=he_IL.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/he he_IL" -c q -$SPELLDIR/he.iso-8859-8.spl : $VIM $FILES +$SPELLDIR/he.iso-8859-8.spl : $FILES :sys $VIM -u NONE -e -c "set enc=iso-8859-8" -c "mkspell! $SPELLDIR/he he_IL" -c q diff --git a/runtime/spell/hr/main.aap b/runtime/spell/hr/main.aap index f272b873e..699d61fe7 100644 --- a/runtime/spell/hr/main.aap +++ b/runtime/spell/hr/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Polish Vim spell files. +# Aap recipe for Croatian Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -12,13 +12,13 @@ FILES = hr_HR.aff hr_HR.dic all: $SPELLDIR/hr.iso-8859-2.spl $SPELLDIR/pl.utf-8.spl \ $SPELLDIR/hr.cp1250.spl ../README_pl.txt -$SPELLDIR/hr.iso-8859-2.spl : $VIM $FILES +$SPELLDIR/hr.iso-8859-2.spl : $FILES :sys env LANG=hr_HR.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/hr hr_HR" -c q -$SPELLDIR/hr.utf-8.spl : $VIM $FILES +$SPELLDIR/hr.utf-8.spl : $FILES :sys env LANG=hr_HR.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/hr hr_HR" -c q -$SPELLDIR/hr.cp1250.spl : $VIM $FILES +$SPELLDIR/hr.cp1250.spl : $FILES :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/hr hr_HR" -c q ../README_hr.txt: README_hr_HR.txt diff --git a/runtime/spell/hu/hu_HU.diff b/runtime/spell/hu/hu_HU.diff new file mode 100644 index 000000000..de22c794f --- /dev/null +++ b/runtime/spell/hu/hu_HU.diff @@ -0,0 +1,128 @@ +*** hu_HU.orig.aff Tue Aug 16 18:21:10 2005 +--- hu_HU.aff Tue Aug 16 19:42:34 2005 +*************** +*** 57,62 **** + +! NAME Magyar Ispell helyesrsi sztr +! LANG hu_HU +! HOME http://magyarispell.sourceforge.net +! VERSION Magyar 0.99.4.2 + SET ISO8859-2 +--- 57,62 ---- + +! #NAME Magyar Ispell helyesrsi sztr +! #LANG hu_HU +! #HOME http://magyarispell.sourceforge.net +! #VERSION Magyar 0.99.4.2 + SET ISO8859-2 +*************** +*** 65,77 **** + COMPOUNDFLAG Y +! COMPOUNDWORD 2 y +! COMPOUNDSYLLABLE 6 aeiou +! SYLLABLENUM klmc +! COMPOUNDFIRST v +! COMPOUNDLAST x +! FORBIDDENWORD w +! ONLYROOT u +! ACCENT aeiooouuu +! CHECKNUM +! WORDCHARS -.%0123456789 +! HU_KOTOHANGZO Z + +--- 65,80 ---- + COMPOUNDFLAG Y +! #COMPOUNDWORD 2 y +! #COMPOUNDSYLLABLE 6 aeiou +! #SYLLABLENUM klmc +! #COMPOUNDFIRST v +! #COMPOUNDLAST x +! #FORBIDDENWORD w +! BAD w +! #ONLYROOT u +! #ACCENT aeiooouuu +! #CHECKNUM +! #WORDCHARS -.%0123456789 +! #HU_KOTOHANGZO Z +! +! PFXPOSTPONE + +*************** +*** 173,241 **** + +- # character conversion table +- # (HTML latin-1 entities -> latin-2) +- # not implemented yet +- +- CHR HTML 35 +- CHR HTML ¤ +- CHR HTML ° +- CHR HTML ´ +- CHR HTML ¸ +- CHR HTML Á +- CHR HTML Â +- CHR HTML Ä +- CHR HTML Ç +- CHR HTML É +- CHR HTML Ë +- CHR HTML Í +- CHR HTML Î +- CHR HTML Ó +- CHR HTML Ô +- CHR HTML Ö +- CHR HTML × +- CHR HTML Ú +- CHR HTML Ü +- CHR HTML Ý +- CHR HTML ß +- CHR HTML á +- CHR HTML â +- CHR HTML ä +- CHR HTML ç +- CHR HTML é +- CHR HTML ë +- CHR HTML í +- CHR HTML î +- CHR HTML ó +- CHR HTML ô +- CHR HTML ö +- CHR HTML ÷ +- CHR HTML ú +- CHR HTML ü +- CHR HTML ý +- +- # character conversion table +- # (Prszky-code -> latin-2) +- # not implemented yet +- +- CHR 123 20 +- CHR 123 a1 +- CHR 123 e1 +- CHR 123 e2 +- CHR 123 i1 +- CHR 123 o1 +- CHR 123 o2 +- CHR 123 o3 +- CHR 123 u1 +- CHR 123 u2 +- CHR 123 u3 +- CHR 123 A1 +- CHR 123 E1 +- CHR 123 E2 +- CHR 123 I1 +- CHR 123 O1 +- CHR 123 O2 +- CHR 123 O3 +- CHR 123 U1 +- CHR 123 U2 +- CHR 123 U3 +- + SFX z Y 6 +--- 176,177 ---- +*************** +*** 17678,17681 **** + PFX D 0 leg . +- +- 1 +- +--- 17614 ---- diff --git a/runtime/spell/hu/main.aap b/runtime/spell/hu/main.aap new file mode 100644 index 000000000..3890b1eaf --- /dev/null +++ b/runtime/spell/hu/main.aap @@ -0,0 +1,81 @@ +# Aap recipe for Hungarian Vim spell files. + +# Use a freshly compiled Vim if it exists. +@if os.path.exists('../../../src/vim'): + VIM = ../../../src/vim +@else: + :progsearch VIM vim + +SPELLDIR = .. +FILES = hu_HU.aff hu_HU.dic + +all: $SPELLDIR/hu.iso-8859-2.spl $SPELLDIR/hu.utf-8.spl \ + $SPELLDIR/hu.cp1250.spl ../README_hu.txt + +$SPELLDIR/hu.iso-8859-2.spl : $FILES + :sys env LANG=hu_HU.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/hu hu_HU" -c q + +$SPELLDIR/hu.utf-8.spl : $FILES + :sys env LANG=hu_HU.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/hu hu_HU" -c q + +$SPELLDIR/hu.cp1250.spl : $FILES + :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/hu hu_HU" -c q + +../README_hu.txt: README_hu_HU.txt + :copy $source $target + +# +# Fetching the files from OpenOffice.org. +# +OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +:attr {fetch = $OODIR/%file%} hu_HU.zip + +# The files don't depend on the .zip file so that we can delete it. +# Only download the zip file if the targets don't exist. +# This is a bit tricky, since the file name includes the date. +hu_HU.aff hu_HU.dic: {buildcheck=} + :assertpkg unzip patch + :fetch hu_HU.zip + :sys $UNZIP hu_HU.zip + :delete hu_HU.zip + @if not os.path.exists('hu_HU.orig.aff'): + :copy hu_HU.aff hu_HU.orig.aff + @if not os.path.exists('hu_HU.orig.dic'): + :copy hu_HU.dic hu_HU.orig.dic + @if os.path.exists('hu_HU.diff'): + :sys patch hu_HU.diff + :sys {force} diff -a -C 1 hu_HU.orig.dic hu_HU.dic >>hu_HU.diff + + +# Check for updated OpenOffice spell files. When there are changes the +# ".new.aff" and ".new.dic" files are left behind for manual inspection. + +check: + :assertpkg unzip diff + :fetch hu_HU.zip + :mkdir tmp + :cd tmp + @try: + @import stat + :sys $UNZIP ../hu_HU.zip + :sys {force} diff ../hu_HU.orig.aff hu_HU.aff >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy hu_HU.aff ../hu_HU.new.aff + :sys {force} diff ../hu_HU.orig.dic hu_HU.dic >d + @if os.stat('d')[stat.ST_SIZE] > 0: + :copy hu_HU.dic ../hu_HU.new.dic + @finally: + :cd .. + :delete {r}{f}{q} tmp + :delete hu_HU.zip + + +# vim: set sts=4 sw=4 : diff --git a/runtime/spell/it/main.aap b/runtime/spell/it/main.aap index ef541c45b..eaced6802 100644 --- a/runtime/spell/it/main.aap +++ b/runtime/spell/it/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for French Vim spell files. +# Aap recipe for Italian Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -11,11 +11,11 @@ FILES = it_IT.aff it_IT.dic all: $SPELLDIR/it.latin1.spl $SPELLDIR/it.utf-8.spl ../README_it.txt -$SPELLDIR/it.latin1.spl : $VIM $FILES +$SPELLDIR/it.latin1.spl : $FILES :sys env LANG=it_IT.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/it it_IT" -c q -$SPELLDIR/it.utf-8.spl : $VIM $FILES +$SPELLDIR/it.utf-8.spl : $FILES :sys env LANG=it_IT.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/it it_IT" -c q diff --git a/runtime/spell/main.aap b/runtime/spell/main.aap index 68864b89e..1e37c1cc3 100644 --- a/runtime/spell/main.aap +++ b/runtime/spell/main.aap @@ -1,10 +1,22 @@ -# "aap": generate all the .spl files -# "aap diff" create all the diff files +# Toplevel Aap recipe for Vim spell files +# +# Usage: +# aap generate all the .spl files +# aap diff create all the diff files -LANG = af bg ca cs da de en fr he hr it nl ny pl sk yi +LANG = af bg ca cs da de el en eo fr fo gl he hr it nl ny pl sk yi + +# TODO: +# Finnish doesn't work, the dictionary fi_FI.zip file contains hyphenation... diff: $*LANG/diff :print done @for l in string.split(_no.LANG): :child $l/main.aap + +# The existing .spl files need to be generated when the spell file format +# changes. Depending on the Vim executable does that, but results in doing it +# much too often. Generate a dummy .spl file and check if it changed. +:child check/main.aap +*.spl: check/check.latin1.spl diff --git a/runtime/spell/nl/main.aap b/runtime/spell/nl/main.aap index 02ae49d57..e23111337 100644 --- a/runtime/spell/nl/main.aap +++ b/runtime/spell/nl/main.aap @@ -11,11 +11,11 @@ FILES = nl_NL.aff nl_NL.dic all: $SPELLDIR/nl.latin1.spl $SPELLDIR/nl.utf-8.spl ../README_nl.txt -$SPELLDIR/nl.latin1.spl : $VIM $FILES +$SPELLDIR/nl.latin1.spl : $FILES :sys env LANG=nl_NL.ISO8859-1 $VIM -u NONE -e -c "mkspell! $SPELLDIR/nl nl_NL" -c q -$SPELLDIR/nl.utf-8.spl : $VIM $FILES +$SPELLDIR/nl.utf-8.spl : $FILES :sys env LANG=nl_NL.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/nl nl_NL" -c q diff --git a/runtime/spell/ny/main.aap b/runtime/spell/ny/main.aap index e7fcbf7b7..b73b50c6b 100644 --- a/runtime/spell/ny/main.aap +++ b/runtime/spell/ny/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Dutch Vim spell files. +# Aap recipe for Chichewa Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -12,15 +12,15 @@ FILES = ny_MW.aff ny_MW.dic all: $SPELLDIR/ny.iso-8859-14.spl $SPELLDIR/ny.utf-8.spl \ $SPELLDIR/ny.ascii.spl ../README_ny.txt -$SPELLDIR/ny.iso-8859-14.spl : $VIM $FILES +$SPELLDIR/ny.iso-8859-14.spl : $FILES :sys $VIM -u NONE -e -c "set enc=iso-8859-14" -c "mkspell! $SPELLDIR/ny ny_MW" -c q -$SPELLDIR/ny.utf-8.spl : $VIM $FILES +$SPELLDIR/ny.utf-8.spl : $FILES :sys $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/ny ny_MW" -c q -$SPELLDIR/ny.ascii.spl : $VIM $FILES +$SPELLDIR/ny.ascii.spl : $FILES :sys $VIM -u NONE -e -c "mkspell! -ascii $SPELLDIR/ny ny_MW" -c q ../README_ny.txt : README_ny_MW.txt diff --git a/runtime/spell/pl/main.aap b/runtime/spell/pl/main.aap index e33acf802..eb21c5e48 100644 --- a/runtime/spell/pl/main.aap +++ b/runtime/spell/pl/main.aap @@ -12,13 +12,13 @@ FILES = pl_PL.aff pl_PL.dic all: $SPELLDIR/pl.iso-8859-2.spl $SPELLDIR/pl.utf-8.spl \ $SPELLDIR/pl.cp1250.spl ../README_pl.txt -$SPELLDIR/pl.iso-8859-2.spl : $VIM $FILES +$SPELLDIR/pl.iso-8859-2.spl : $FILES :sys env LANG=pl_PL.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/pl pl_PL" -c q -$SPELLDIR/pl.utf-8.spl : $VIM $FILES +$SPELLDIR/pl.utf-8.spl : $FILES :sys env LANG=pl_PL.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/pl pl_PL" -c q -$SPELLDIR/pl.cp1250.spl : $VIM $FILES +$SPELLDIR/pl.cp1250.spl : $FILES :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/pl pl_PL" -c q ../README_pl.txt: README_pl_PL.txt diff --git a/runtime/spell/sk/main.aap b/runtime/spell/sk/main.aap index b18d195c1..db973553b 100644 --- a/runtime/spell/sk/main.aap +++ b/runtime/spell/sk/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Czech Vim spell files. +# Aap recipe for Slovak Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -12,13 +12,13 @@ FILES = sk_SK.aff sk_SK.dic all: $SPELLDIR/sk.iso-8859-2.spl $SPELLDIR/sk.utf-8.spl \ $SPELLDIR/sk.cp1250.spl ../README_sk.txt -$SPELLDIR/sk.iso-8859-2.spl : $VIM $FILES +$SPELLDIR/sk.iso-8859-2.spl : $FILES :sys env LANG=sk_SK.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/sk sk_SK" -c q -$SPELLDIR/sk.utf-8.spl : $VIM $FILES +$SPELLDIR/sk.utf-8.spl : $FILES :sys env LANG=sk_SK.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/sk sk_SK" -c q -$SPELLDIR/sk.cp1250.spl : $VIM $FILES +$SPELLDIR/sk.cp1250.spl : $FILES :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/sk sk_SK" -c q ../README_sk.txt: README_sk_SK.txt diff --git a/runtime/spell/yi/!yi.diff b/runtime/spell/yi/!yi.diff index 00ec10474..484dc69f7 100644 --- a/runtime/spell/yi/!yi.diff +++ b/runtime/spell/yi/!yi.diff @@ -1,7 +1,8 @@ -*** wordlist.utf8.txt Thu Aug 11 17:55:15 2005 ---- yi.dic Thu Aug 11 17:56:28 2005 +*** wordlist.utf8.txt Thu Aug 11 19:49:22 2005 +--- yi.dic Thu Aug 11 19:49:23 2005 *************** -*** 1 **** ---- 1,2 ---- -+ 99999 +*** 1,2 **** +--- 1,3 ---- ++ 999999 גרונטעלעמענט + דזשאָבענדיקס diff --git a/runtime/spell/yi/!yi_tr.diff b/runtime/spell/yi/!yi_tr.diff new file mode 100644 index 000000000..5d8183f7d --- /dev/null +++ b/runtime/spell/yi/!yi_tr.diff @@ -0,0 +1,8 @@ +*** wordlist.txt Tue Aug 16 10:46:26 2005 +--- yi_tr.dic Tue Aug 16 10:46:42 2005 +*************** +*** 1,2 **** +--- 1,3 ---- ++ 84608 + gruntelement + dzhobendiks diff --git a/runtime/spell/yi/README.txt b/runtime/spell/yi/README.txt index db432935c..09af739c5 100644 --- a/runtime/spell/yi/README.txt +++ b/runtime/spell/yi/README.txt @@ -3,4 +3,7 @@ README file for the Yiddish spell file. The word list was provided by Raphael Finkel. It is the same one that is used by uspell. +There also is a romanized (transliterated) word list. This is used for +latin1. To use this list when 'encoding' is utf-8 use ":set spelllang=yi-tr". + Copyright Raphael Finkel. Included with permission in Vim. diff --git a/runtime/spell/yi/main.aap b/runtime/spell/yi/main.aap index 31d057e01..8a98ce050 100644 --- a/runtime/spell/yi/main.aap +++ b/runtime/spell/yi/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Hebrew Vim spell files. +# Aap recipe for Yiddish Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -6,16 +6,27 @@ @else: :progsearch VIM vim -SPELLDIR = .. -FILES = yi.dic yi.aff -WORDFILE = wordlist.utf8.txt +SPELLDIR = .. +FILES = yi.dic yi.aff +WORDFILE = wordlist.utf8.txt +FILES_TR = yi_tr.dic yi_tr.aff +WORDFILE_TR = wordlist.txt -all: $SPELLDIR/yi.utf-8.spl ../README_yi.txt +all: $SPELLDIR/yi.utf-8.spl $SPELLDIR/yi-tr.utf-8.spl \ + $SPELLDIR/yi.latin1.spl ../README_yi.txt -$SPELLDIR/yi.utf-8.spl : $VIM $FILES +$SPELLDIR/yi.utf-8.spl : $FILES :sys $VIM -u NONE -e -c "set enc=utf-8" -c "mkspell! $SPELLDIR/yi yi" -c q +$SPELLDIR/yi-tr.utf-8.spl : $FILES_TR + :sys $VIM -u NONE -e -c "set enc=utf-8" + -c "mkspell! $SPELLDIR/yi-tr yi_tr" -c q + +$SPELLDIR/yi.latin1.spl : $FILES_TR + :sys $VIM -u NONE -e -c "set enc=latin1" + -c "mkspell! $SPELLDIR/yi yi_tr" -c q + ../README_yi.txt : README.txt :copy $source $target @@ -23,7 +34,7 @@ $SPELLDIR/yi.utf-8.spl : $VIM $FILES # Fetch the word list when needed. # URLDIR = http://www.cs.uky.edu/~raphael/yiddish -:attr {fetch = $URLDIR/%file%} $WORDFILE +:attr {fetch = $URLDIR/%file%} $WORDFILE $WORDFILE_TR # We use the word list as a .dic file, so that we can use an affix file to # define a few extra things. @@ -35,13 +46,20 @@ $FILES: {buildcheck=} @if os.path.exists('yi.diff'): :sys patch < yi.diff -diff: +$FILES_TR: {buildcheck=} + :assertpkg patch + :fetch $WORDFILE_TR + :copy $WORDFILE_TR yi_tr.dic + :touch {force} yi_tr.aff + @if os.path.exists('yi_tr.diff'): + :sys patch < yi_tr.diff + +diff {virtual}: :assertpkg diff - :delete yi.diff # Using a context of two lines to work around a bug in FreeBSD patch. - :sys {force} diff -a -C 2 $WORDFILE yi.dic >yi.diff - :sys {force} diff -a -N -C 1 /dev/null yi.aff >>yi.diff - - + :sys {force} diff -a -C 2 $WORDFILE yi.dic > yi.diff + :sys {force} diff -a -N -C 1 /dev/null yi.aff >> yi.diff + :sys {force} diff -a -C 2 $WORDFILE_TR yi_tr.dic > yi_tr.diff + :sys {force} diff -a -N -C 1 /dev/null yi_tr.aff >> yi_tr.diff # vim: set sts=4 sw=4 : diff --git a/runtime/spell/yi/yi.diff b/runtime/spell/yi/yi.diff index 020f2dc49..45a2d90b0 100644 --- a/runtime/spell/yi/yi.diff +++ b/runtime/spell/yi/yi.diff @@ -1,18 +1,19 @@ -*** wordlist.utf8.txt Thu Aug 11 18:40:11 2005 ---- yi.dic Thu Aug 11 19:48:53 2005 +*** wordlist.utf8.txt Thu Aug 11 19:49:22 2005 +--- yi.dic Thu Aug 11 19:49:23 2005 *************** *** 1,2 **** --- 1,3 ---- + 999999 גרונטעלעמענט דזשאָבענדיקס -*** /dev/null Thu Aug 11 19:48:23 2005 ---- yi.aff Thu Aug 11 18:50:45 2005 +*** /dev/null Tue Aug 16 10:44:00 2005 +--- yi.aff Mon Aug 15 23:06:00 2005 *************** *** 0 **** ---- 1,5 ---- +--- 1,6 ---- + SET UTF-8 + -+ REP 2 ++ REP 3 + REP וו װ + REP יי ײ ++ REP וי ױ diff --git a/runtime/spell/yi/yi_tr.diff b/runtime/spell/yi/yi_tr.diff new file mode 100644 index 000000000..5f26a7b8a --- /dev/null +++ b/runtime/spell/yi/yi_tr.diff @@ -0,0 +1,18 @@ +*** wordlist.txt Tue Aug 16 10:46:26 2005 +--- yi_tr.dic Tue Aug 16 10:46:42 2005 +*************** +*** 1,2 **** +--- 1,3 ---- ++ 84608 + gruntelement + dzhobendiks +*** /dev/null Tue Aug 16 10:44:00 2005 +--- yi_tr.aff Tue Aug 16 10:48:01 2005 +*************** +*** 0 **** +--- 1,5 ---- ++ SET ISO8859-1 ++ ++ FOL ++ LOW ++ UPP diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 1b6dee4aa..a49df3f25 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Dr. Charles E. Campbell, Jr. " Previous Maintainer: Lennart Schultz -" Last Change: Jul 01, 2005 -" Version: 75 +" Last Change: Aug 16, 2005 +" Version: 76 " URL: http://www.erols.com/astronaut/vim/index.html#vimlinks_syntax " " Using the following VIM variables: {{{1 @@ -73,7 +73,7 @@ syn cluster shColonList contains=@shCaseList syn cluster shCommandSubList contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shSpecial,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shSpecial,shPosnParm -syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError +syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS syn cluster shDerefVarList contains=shDerefOp,shDerefVarArray,shDerefOpError syn cluster shEchoList contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shSpecial syn cluster shExprList1 contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shSpecial,shExpr,shDblBrace,shDeref,shDerefSimple @@ -368,24 +368,25 @@ syn match shDerefOp contained ":\=+" nextgroup=@shDerefPatternList if exists("b:is_bash") || exists("b:is_kornshell") syn match shDerefOp contained "#\{1,2}" nextgroup=@shDerefPatternList syn match shDerefOp contained "%\{1,2}" nextgroup=@shDerefPatternList - syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub nextgroup=shDerefPattern + syn match shDerefPattern contained "[^{}]\+" contains=shDeref,shDerefSimple,shDerefPattern,shDerefString,shCommandSub,shDerefEscape nextgroup=shDerefPattern syn region shDerefPattern contained start="{" end="}" contains=shDeref,shDerefSimple,shDerefString,shCommandSub nextgroup=shDerefPattern + syn match shDerefEscape contained '\%(\\\\\)*\\.' endif syn region shDerefString contained matchgroup=shOperator start=+'+ end=+'+ contains=shStringSpecial syn region shDerefString contained matchgroup=shOperator start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial syn match shDerefString contained "\\["']" -" bash : ${parameter:offset} -" bash : ${parameter:offset:length} -" bash : ${parameter//pattern/string} -" bash : ${parameter//pattern} if exists("b:is_bash") + " bash : ${parameter:offset} + " bash : ${parameter:offset:length} syn region shDerefOp contained start=":[$[:alnum:]_]"me=e-1 end=":"me=e-1 end="}"me=e-1 contains=@shCommandSubList nextgroup=shDerefPOL - syn match shDerefPOL contained ":[^}]\{1,}" contains=@shCommandSubList - syn match shDerefOp contained "/\{1,2}" nextgroup=shDerefPat - syn match shDerefPat contained "[^/}]\{1,}" nextgroup=shDerefPatStringOp - syn match shDerefPatStringOp contained "/" nextgroup=shDerefPatString - syn match shDerefPatString contained "[^}]\{1,}" + syn match shDerefPOL contained ":[^}]\+" contains=@shCommandSubList + + " bash : ${parameter//pattern/string} + " bash : ${parameter//pattern} + syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft + syn region shDerefPPSleft contained start='.' skip=@\%(\\\)\/@ matchgroup=shDerefOp end='/' nextgroup=shDerefPPSright contains=@shCommandSubList + syn region shDerefPPSright contained start='.' end='\ze}' contains=@shCommandSubList endif " Useful sh Keywords: {{{1 @@ -441,9 +442,8 @@ hi def link shCaseStart shConditional hi def link shCmdSubRegion shShellVariables hi def link shColon shStatement hi def link shDerefOp shOperator -hi def link shDerefPatStringOp shDerefOp -hi def link shDerefPatString shDerefPattern hi def link shDerefPOL shDerefOp +hi def link shDerefPPS shDerefOp hi def link shDeref shShellVariables hi def link shDerefSimple shDeref hi def link shDerefSpecial shDeref diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index fb7a7e41d..b18d908fd 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Dr. Charles E. Campbell, Jr. -" Last Change: Aug 11, 2005 -" Version: 28 +" Last Change: Aug 15, 2005 +" Version: 29 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Notes: {{{1 @@ -102,7 +102,7 @@ if !exists("g:tex_no_error") endif syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texSectionMarker,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract -syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption +syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter if !exists("tex_no_math") syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ @@ -114,6 +114,16 @@ if !exists("tex_no_math") syn cluster texMathMatchGroup add=texMathError syn cluster texMathZoneGroup add=texMathError endif + syn cluster texMathZoneGroup add=@NoSpell + " following used in the \part \chapter \section \subsection \subsubsection + " \paragraph \subparagraph \author \title highlighting + syn cluster texDocGroup contains=texPartZone,@texPartGroup + syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone + syn cluster texChapterGroup contains=texSectionZone,texParaZone + syn cluster texSectionGroup contains=texSubSectionZone,texParaZone + syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone + syn cluster texSubSubSectionGroup contains=texParaZone + syn cluster texParaGroup contains=texSubParaZone endif " Try to flag {} and () mismatches: {{{1 @@ -246,29 +256,27 @@ syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained " Sections, subsections, etc: {{{1 if g:tex_fold_enabled && has("folding") - syn cluster texDocGroup contains=texPartZone,@texPartGroup - syn cluster texPartGroup contains=texChapterZone,texSectionZone,texParaZone - syn cluster texChapterGroup contains=texSectionZone,texParaZone - syn cluster texSectionGroup contains=texSubSectionZone,texParaZone - syn cluster texSubSectionGroup contains=texSubSubSectionZone,texParaZone - syn cluster texSubSubSectionGroup contains=texParaZone - syn cluster texParaGroup contains=texSubParaZone - - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold keepend contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\n\ze\s*\\part\>' fold keepend contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\n\ze\s*\\chapter\>' fold keepend contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\n\ze\s*\\section\>' fold keepend contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\n\ze\s*\\subsection\>' fold keepend contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\n\ze\s*\\subsubsection\>' fold keepend contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\n\ze\s*\\paragraph\>' fold keepend contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\n\ze\s*\\subparagraph\>' fold keepend contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup + syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold keepend contains=@texFoldGroup,@texDocGroup,@Spell + syn region texPartZone matchgroup=texSection start='\\part\>' end='\n\ze\s*\\part\>' fold keepend contains=@texFoldGroup,@texPartGroup,@Spell + syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\n\ze\s*\\chapter\>' fold keepend contains=@texFoldGroup,@texChapterGroup,@Spell + syn region texSectionZone matchgroup=texSection start='\\section\>' end='\n\ze\s*\\section\>' fold keepend contains=@texFoldGroup,@texSectionGroup,@Spell + syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\n\ze\s*\\subsection\>' fold keepend contains=@texFoldGroup,@texSubSectionGroup,@Spell + syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\n\ze\s*\\subsubsection\>' fold keepend contains=@texFoldGroup,@texSubSubSectionGroup,@Spell + syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\n\ze\s*\\paragraph\>' fold keepend contains=@texFoldGroup,@texParaGroup,@Spell + syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\n\ze\s*\\subparagraph\>' fold keepend contains=@texFoldGroup,@Spell + syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell + syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell else - syn match texSection "\\\(sub\)*section\*\=\>" - syn match texSection "\\\(part\|chapter\|paragraph\|subparagraph\)\>" - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*\ze{' end='}' contains=@texFoldGroup - syn match texSection "\\begin\s*{\s*abstract\s*}\|\\end\s*{\s*abstract\s*}" + syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' keepend contains=@texFoldGroup,@texDocGroup,@Spell + syn region texPartZone matchgroup=texSection start='\\part\>' end='\n\ze\s*\\part\>' keepend contains=@texFoldGroup,@texPartGroup,@Spell + syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\n\ze\s*\\chapter\>' keepend contains=@texFoldGroup,@texChapterGroup,@Spell + syn region texSectionZone matchgroup=texSection start='\\section\>' end='\n\ze\s*\\section\>' keepend contains=@texFoldGroup,@texSectionGroup,@Spell + syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\n\ze\s*\\subsection\>' keepend contains=@texFoldGroup,@texSubSectionGroup,@Spell + syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\n\ze\s*\\subsubsection\>' keepend contains=@texFoldGroup,@texSubSubSectionGroup,@Spell + syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\n\ze\s*\\paragraph\>' keepend contains=@texFoldGroup,@texParaGroup,@Spell + syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\n\ze\s*\\subparagraph\>' keepend contains=@texFoldGroup,@Spell + syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell + syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell endif " Bad Math (mismatched): {{{1 @@ -370,7 +378,7 @@ endif " Separate lines used for verb` and verb# so that the end conditions {{{1 " will appropriately terminate. Ideally vim would let me save a " character from the start pattern and re-use it in the end-pattern. -syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" +syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" contains=@Spell if version < 600 syn region texZone start="\\verb\*\=`" end="`\|%stopzone\>" syn region texZone start="\\verb\*\=#" end="#\|%stopzone\>" diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index f895df705..9e79aabf4 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Vim 7.0 script " Maintainer: Dr. Charles E. Campbell, Jr. -" Last Change: August 02, 2005 -" Version: 7.0-11 +" Last Change: Aug 16, 2005 +" Version: 7.0-13 " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 @@ -16,7 +16,7 @@ syn keyword vimTodo contained COMBAK NOT RELEASED TODO WIP syn cluster vimCommentGroup contains=vimTodo,@Spell " regular vim commands {{{2 -syn keyword vimCommand contained ab[breviate] abc[lear] abo[veleft] al[l] arga[dd] argd[elete] argdo arge[dit] argg[lobal] argl[ocal] ar[gs] argu[ment] as[cii] bad[d] ba[ll] bd[elete] be bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bN[ext] bo[tright] bp[revious] brea[k] breaka[dd] breakd[el] breakl[ist] br[ewind] bro[wse] bufdo b[uffer] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cad[dfile] cal[l] cat[ch] cb[uffer] cc ccl[ose] cd ce[nter] cex[pr] cf[ile] cfir[st] cg[etfile] c[hange] changes chd[ir] che[ckpath] checkt[ime] cla[st] cl[ist] clo[se] cmapc[lear] cnew[er] cn[ext] cN[ext] cnf[ile] cNf[ile] cnorea[bbrev] col[der] colo[rscheme] comc[lear] comp[iler] conf[irm] con[tinue] cope[n] co[py] cpf[ile] cp[revious] cq[uit] cr[ewind] cuna[bbrev] cu[nmap] cw[indow] debugg[reedy] delc[ommand] d[elete] DeleteFirst delf[unction] delm[arks] diffg[et] diffoff diffpatch diffpu[t] diffsplit diffthis diffu[pdate] dig[raphs] di[splay] dj[ump] dl[ist] dr[op] ds[earch] dsp[lit] echoe[rr] echom[sg] echon e[dit] el[se] elsei[f] em[enu] emenu* endfo[r] endf[unction] en[dif] endt[ry] endw[hile] ene[w] ex exi[t] exu[sage] f[ile] files filetype fina[lly] fin[d] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] folddoc[losed] foldd[oopen] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] ha[rdcopy] h[elp] helpf[ind] helpg[rep] helpt[ags] hid[e] his[tory] I ia[bbrev] iabc[lear] if ij[ump] il[ist] imapc[lear] inorea[bbrev] is[earch] isp[lit] iuna[bbrev] iu[nmap] j[oin] ju[mps] k keepalt keepj[umps] kee[pmarks] lan[guage] la[st] lc[d] lch[dir] le[ft] lefta[bove] l[ist] lm[ap] lmapc[lear] ln[oremap] lo[adview] loc[kmarks] lockv[ar] ls lu[nmap] mak[e] ma[rk] marks mat[ch] menut[ranslate] mk[exrc] mks[ession] mksp[ell] mkvie[w] mkv[imrc] mod[e] m[ove] mzf[ile] mz[scheme] nbkey new n[ext] N[ext] nmapc[lear] noh[lsearch] norea[bbrev] Nread nu[mber] nun[map] Nw omapc[lear] on[ly] o[pen] opt[ions] ou[nmap] pc[lose] ped[it] pe[rl] perld[o] po[p] popu popu[p] pp[op] pre[serve] prev[ious] p[rint] P[rint] profd[el] prof[ile] prompt promptf[ind] promptr[epl] ps[earch] pta[g] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptN[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pw[d] pyf[ile] py[thon] qa[ll] q[uit] quita[ll] r[ead] rec[over] redi[r] red[o] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] rub[y] rubyd[o] rubyf[ile] ru[ntime] rv[iminfo] sal[l] san[dbox] sa[rgument] sav[eas] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbN[ext] sbp[revious] sbr[ewind] sb[uffer] scripte[ncoding] scrip[tnames] se[t] setf[iletype] setg[lobal] setl[ocal] sf[ind] sfir[st] sh[ell] sign sil[ent] sim[alt] sla[st] sl[eep] sm[agic] sn[ext] sN[ext] sni[ff] sno[magic] sor[t] so[urce] spelld[ump] spe[llgood] spellr[epall] spellw[rong] sp[lit] spr[evious] sre[wind] sta[g] star[tinsert] startr[eplace] stj[ump] st[op] stopi[nsert] sts[elect] sun[hide] sus[pend] sv[iew] syncbind t ta[g] tags tc[l] tcld[o] tclf[ile] te[aroff] tf[irst] the th[row] tj[ump] tl[ast] tm tm[enu] tn[ext] tN[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu tu[nmenu] una[bbreviate] u[ndo] unh[ide] unlo[ckvar] unm[ap] up[date] verb[ose] ve[rsion] vert[ical] v[global] vie[w] vim[grep] vimgrepa[dd] vi[sual] viu[sage] vmapc[lear] vne[w] vs[plit] vu[nmap] wa[ll] wh[ile] winc[md] windo winp[os] win[size] wn[ext] wN[ext] wp[revious] wq wqa[ll] w[rite] ws[verb] wv[iminfo] X xa[ll] x[it] y[ank] +syn keyword vimCommand contained ab[breviate] abc[lear] abo[veleft] al[l] arga[dd] argd[elete] argdo arge[dit] argg[lobal] argl[ocal] ar[gs] argu[ment] as[cii] bad[d] ba[ll] bd[elete] be bel[owright] bf[irst] bl[ast] bm[odified] bn[ext] bN[ext] bo[tright] bp[revious] brea[k] breaka[dd] breakd[el] breakl[ist] br[ewind] bro[wse] bufdo b[uffer] buffers bun[load] bw[ipeout] ca[bbrev] cabc[lear] cad[dfile] cal[l] cat[ch] cb[uffer] cc ccl[ose] cd ce[nter] cex[pr] cf[ile] cfir[st] cg[etfile] c[hange] changes chd[ir] che[ckpath] checkt[ime] cla[st] cl[ist] clo[se] cmapc[lear] cnew[er] cn[ext] cN[ext] cnf[ile] cNf[ile] cnorea[bbrev] col[der] colo[rscheme] comc[lear] comp[iler] conf[irm] con[tinue] cope[n] co[py] cpf[ile] cp[revious] cq[uit] cr[ewind] cuna[bbrev] cu[nmap] cw[indow] debugg[reedy] delc[ommand] d[elete] DeleteFirst delf[unction] delm[arks] diffg[et] diffoff diffpatch diffpu[t] diffsplit diffthis diffu[pdate] dig[raphs] di[splay] dj[ump] dl[ist] dr[op] ds[earch] dsp[lit] echoe[rr] echom[sg] echon e[dit] el[se] elsei[f] em[enu] emenu* endfo[r] endf[unction] en[dif] endt[ry] endw[hile] ene[w] ex exi[t] Explore exu[sage] f[ile] files filetype fina[lly] fin[d] fini[sh] fir[st] fix[del] fo[ld] foldc[lose] folddoc[losed] foldd[oopen] foldo[pen] for fu[nction] g[lobal] go[to] gr[ep] grepa[dd] ha[rdcopy] h[elp] helpf[ind] helpg[rep] helpt[ags] Hexplore hid[e] his[tory] I ia[bbrev] iabc[lear] if ij[ump] il[ist] imapc[lear] inorea[bbrev] is[earch] isp[lit] iuna[bbrev] iu[nmap] j[oin] ju[mps] k keepalt keepj[umps] kee[pmarks] lan[guage] la[st] lc[d] lch[dir] le[ft] lefta[bove] l[ist] lm[ap] lmapc[lear] ln[oremap] lo[adview] loc[kmarks] lockv[ar] ls lu[nmap] mak[e] ma[rk] marks mat[ch] menut[ranslate] mk[exrc] mks[ession] mksp[ell] mkvie[w] mkv[imrc] mod[e] m[ove] mzf[ile] mz[scheme] nbkey new n[ext] N[ext] nmapc[lear] noh[lsearch] norea[bbrev] Nread nu[mber] nun[map] Nw omapc[lear] on[ly] o[pen] opt[ions] ou[nmap] pc[lose] ped[it] pe[rl] perld[o] po[p] popu popu[p] pp[op] pre[serve] prev[ious] p[rint] P[rint] profd[el] prof[ile] prompt promptf[ind] promptr[epl] ps[earch] pta[g] ptf[irst] ptj[ump] ptl[ast] ptn[ext] ptN[ext] ptp[revious] ptr[ewind] pts[elect] pu[t] pw[d] pyf[ile] py[thon] qa[ll] q[uit] quita[ll] r[ead] rec[over] redi[r] red[o] redr[aw] redraws[tatus] reg[isters] res[ize] ret[ab] retu[rn] rew[ind] ri[ght] rightb[elow] rub[y] rubyd[o] rubyf[ile] ru[ntime] rv[iminfo] sal[l] san[dbox] sa[rgument] sav[eas] sba[ll] sbf[irst] sbl[ast] sbm[odified] sbn[ext] sbN[ext] sbp[revious] sbr[ewind] sb[uffer] scripte[ncoding] scrip[tnames] se[t] setf[iletype] setg[lobal] setl[ocal] Sexplore sf[ind] sfir[st] sh[ell] sign sil[ent] sim[alt] sla[st] sl[eep] sm[agic] sn[ext] sN[ext] sni[ff] sno[magic] sor[t] so[urce] spelld[ump] spe[llgood] spellr[epall] spellw[rong] sp[lit] spr[evious] sre[wind] sta[g] star[tinsert] startr[eplace] stj[ump] st[op] stopi[nsert] sts[elect] sun[hide] sus[pend] sv[iew] syncbind t ta[g] tags tc[l] tcld[o] tclf[ile] te[aroff] tf[irst] the th[row] tj[ump] tl[ast] tm tm[enu] tn[ext] tN[ext] to[pleft] tp[revious] tr[ewind] try ts[elect] tu tu[nmenu] una[bbreviate] u[ndo] unh[ide] unlo[ckvar] unm[ap] up[date] verb[ose] ve[rsion] vert[ical] Vexplore v[global] vie[w] vim[grep] vimgrepa[dd] vi[sual] viu[sage] vmapc[lear] vne[w] vs[plit] vu[nmap] wa[ll] wh[ile] winc[md] windo winp[os] win[size] wn[ext] wN[ext] wp[revious] wq wqa[ll] w[rite] ws[verb] wv[iminfo] X xa[ll] x[it] y[ank] syn match vimCommand contained "\=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile syn region vimOperParen oneline matchgroup=vimOper start="(" end=")" contains=@vimOperGroup @@ -193,8 +193,8 @@ syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\ syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone -syn region vimString oneline keepend start=+[^:a-zA-Z>!\\]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup -syn region vimString oneline keepend start=+[^:a-zA-Z>!\\]'+lc=1 end=+'+ contains=@vimStringGroup +syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup +syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]'+lc=1 end=+'+ contains=@vimStringGroup syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup @@ -232,21 +232,21 @@ syn match vimMark "\vval.v_string = s; - (void)vim_vsnprintf((char *)s, len + 1, fmt, NULL, argvars + 1); + (void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1); } } did_emsg |= saved_did_emsg; @@ -17482,6 +17488,10 @@ list_func_head(fp, indent) MSG_PUTS("..."); } msg_putchar(')'); +#ifdef FEAT_EVAL + if (p_verbose > 0) + last_set_msg(fp->uf_script_ID); +#endif } /* diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 0f5360f71..6e6e2971f 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -5117,6 +5117,10 @@ uc_list(name, name_len) msg_outtrans(IObuff); msg_outtrans_special(cmd->uc_rep, FALSE); +#ifdef FEAT_EVAL + if (p_verbose > 0) + last_set_msg(cmd->uc_scriptID); +#endif out_flush(); ui_breakcheck(); if (got_int) diff --git a/src/gui.c b/src/gui.c index f0d65eeb6..c7f872eaa 100644 --- a/src/gui.c +++ b/src/gui.c @@ -4590,6 +4590,7 @@ gui_do_findrepl(flags, find_text, repl_text, down) int type = (flags & FRD_TYPE_MASK); char_u *p; regmatch_T regmatch; + int save_did_emsg = did_emsg; ga_init2(&ga, 1, 100); if (type == FRD_REPLACEALL) @@ -4666,6 +4667,10 @@ gui_do_findrepl(flags, find_text, repl_text, down) msg_scroll = i; /* don't let an error message set msg_scroll */ } + /* Don't want to pass did_emsg to other code, it may cause disabling + * syntax HL if we were busy redrawing. */ + did_emsg = save_did_emsg; + if (State & (NORMAL | INSERT)) { gui_update_screen(); /* update the screen */ diff --git a/src/message.c b/src/message.c index 2b3adcf7d..cca8a5242 100644 --- a/src/message.c +++ b/src/message.c @@ -3800,7 +3800,7 @@ tv_str(tvs, idxp) * When va_list is not supported we only define vim_snprintf(). * * vim_vsnprintf() can be invoked with either "va_list" or a list of - * "typval_T". The other must be NULL. + * "typval_T". When the latter is not used it must be NULL. */ /* When generating prototypes all of this is skipped, cproto doesn't @@ -3937,7 +3937,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); #endif @@ -3974,7 +3974,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); #endif @@ -4050,7 +4050,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); #endif @@ -4066,7 +4066,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) (char *)get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_str(tvs, &arg_idx) : + tvs != NULL ? tv_str(tvs, &arg_idx) : # endif va_arg(ap, char *); #endif @@ -4127,10 +4127,10 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) length_modifier = '\0'; ptr_arg = #ifndef HAVE_STDARG_H - (void *)get_a_arg(arg_idx); + (void *)get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? (void *)tv_str(tvs, &arg_idx) : + tvs != NULL ? (void *)tv_str(tvs, &arg_idx) : # endif va_arg(ap, void *); #endif @@ -4150,7 +4150,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, int); #endif @@ -4165,7 +4165,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, long int); #endif @@ -4188,7 +4188,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, unsigned int); #endif @@ -4201,7 +4201,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) get_a_arg(arg_idx); #else # if defined(FEAT_EVAL) - ap == NULL ? tv_nr(tvs, &arg_idx) : + tvs != NULL ? tv_nr(tvs, &arg_idx) : # endif va_arg(ap, unsigned long int); #endif @@ -4484,7 +4484,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) } #ifdef HAVE_STDARG_H - if (ap == NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN) + if (tvs != NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN) EMSG(_("E767: Too many arguments to printf()")); #endif diff --git a/src/regexp.c b/src/regexp.c index 1ff5a069b..f8b86168d 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -3177,7 +3177,7 @@ reg_getline(lnum) * can't go before line 1 */ if (reg_firstlnum + lnum < 1) return NULL; - if (reg_firstlnum + lnum > reg_buf->b_ml.ml_line_count) + if (lnum > reg_maxline) /* Must have matched the "\n" in the last line. */ return (char_u *)""; return ml_get_buf(reg_buf, reg_firstlnum + lnum, FALSE); diff --git a/src/screen.c b/src/screen.c index 6562d655c..b3dbe0141 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2594,7 +2594,7 @@ win_line(wp, lnum, startrow, endrow) extra_check = 0; #endif #ifdef FEAT_SYN_HL - if (syntax_present(wp->w_buffer)) + if (syntax_present(wp->w_buffer) && !wp->w_buffer->b_syn_error) { /* Prepare for syntax highlighting in this line. When there is an * error, stop syntax highlighting. */ @@ -2602,7 +2602,7 @@ win_line(wp, lnum, startrow, endrow) did_emsg = FALSE; syntax_start(wp, lnum); if (did_emsg) - syntax_clear(wp->w_buffer); + wp->w_buffer->b_syn_error = TRUE; else { did_emsg = save_did_emsg; @@ -3643,7 +3643,10 @@ win_line(wp, lnum, startrow, endrow) has_spell ? &can_spell : NULL); if (did_emsg) - syntax_clear(wp->w_buffer); + { + wp->w_buffer->b_syn_error = TRUE; + has_syntax = FALSE; + } else did_emsg = save_did_emsg; diff --git a/src/spell.c b/src/spell.c index 114e3f2aa..a3fc24f72 100644 --- a/src/spell.c +++ b/src/spell.c @@ -51,16 +51,21 @@ */ /* Use SPELL_PRINTTREE for debugging: dump the word tree after adding a word. - * Only use it for small word lists! - * SPELL_COMPRESS_CNT is in how many words we compress the tree to limit the - * amount of memory used (esp. for Italian). */ + * Only use it for small word lists! */ #if 0 # define SPELL_PRINTTREE -# define SPELL_COMPRESS_CNT 1 -#else -# define SPELL_COMPRESS_CNT 1000000 #endif +/* SPELL_COMPRESS_CNT is after how many allocated blocks we compress the tree + * to limit the amount of memory used (esp. for Italian and Hungarian). The + * amount of memory used for nodes then is SPELL_COMPRESS_CNT times + * SBLOCKSIZE. + * Then compress again after allocating SPELL_COMPRESS_INC more blocks or + * adding SPELL_COMPRESS_ADDED words and running out of memory again. */ +#define SPELL_COMPRESS_CNT 30000 +#define SPELL_COMPRESS_INC 100 +#define SPELL_COMPRESS_ADDED 500000 + /* * Use this to adjust the score after finding suggestions, based on the * suggested word sounding like the bad word. This is much faster than doing @@ -594,8 +599,9 @@ typedef struct trystate_S char_u ts_fidx; /* index in fword[], case-folded bad word */ char_u ts_fidxtry; /* ts_fidx at which bytes may be changed */ char_u ts_twordlen; /* valid length of tword[] */ - char_u ts_prefixdepth; /* stack depth for end of prefix or PREFIXTREE - * or NOPREFIX */ + char_u ts_prefixdepth; /* stack depth for end of prefix or + * PFD_PREFIXTREE or PFD_NOPREFIX or + * PFD_COMPOUND */ #ifdef FEAT_MBYTE char_u ts_tcharlen; /* number of bytes in tword character */ char_u ts_tcharidx; /* current byte index in tword character */ @@ -613,8 +619,9 @@ typedef struct trystate_S #define DIFF_INSERT 2 /* inserting character */ /* special values ts_prefixdepth */ -#define PREFIXTREE 0xfe /* walking through the prefix tree */ -#define NOPREFIX 0xff /* not using prefixes */ +#define PFD_COMPOUND 0xfd /* prefixed is a compound word */ +#define PFD_PREFIXTREE 0xfe /* walking through the prefix tree */ +#define PFD_NOPREFIX 0xff /* not using prefixes */ /* mode values for find_word */ #define FIND_FOLDWORD 0 /* find word case-folded */ @@ -627,6 +634,7 @@ static slang_T *slang_alloc __ARGS((char_u *lang)); static void slang_free __ARGS((slang_T *lp)); static void slang_clear __ARGS((slang_T *lp)); static void find_word __ARGS((matchinf_T *mip, int mode)); +static int can_compound __ARGS((slang_T *slang, int flags)); static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req)); static void find_prefix __ARGS((matchinf_T *mip)); static int fold_more __ARGS((matchinf_T *mip)); @@ -740,6 +748,7 @@ static linenr_T apply_prefixes __ARGS((slang_T *slang, char_u *word, int round, static char *e_format = N_("E759: Format error in spell file"); static char *e_spell_trunc = N_("E758: Truncated spell file"); +static char *e_afftrailing = N_("Trailing text in %s line %d: %s"); static char *msg_compressing = N_("Compressing word tree..."); /* @@ -1156,8 +1165,7 @@ find_word(mip, mode) /* The word doesn't end or it comes after another: it must * have a compound flag. */ - /* TODO: check more flags */ - if (*slang->sl_compflags != ((unsigned)flags >> 24)) + if (!can_compound(slang, flags)) continue; } @@ -1230,6 +1238,19 @@ find_word(mip, mode) } } +/* + * Return TRUE if "flags" has a valid compound flag. + * TODO: check flags in a more advanced way. + */ + static int +can_compound(slang, flags) + slang_T *slang; + int flags; +{ + return slang->sl_compflags != NULL + && *slang->sl_compflags == ((unsigned)flags >> 24); +} + /* * Return non-zero if the prefix indicated by "arridx" matches with the prefix * ID in "flags" for the word "word". @@ -3324,17 +3345,19 @@ typedef struct spellinfo_S { wordnode_T *si_foldroot; /* tree with case-folded words */ long si_foldwcount; /* nr of words in si_foldroot */ - int si_fold_added; /* nr of words added since compressing */ wordnode_T *si_keeproot; /* tree with keep-case words */ long si_keepwcount; /* nr of words in si_keeproot */ - int si_keep_added; /* nr of words added since compressing */ wordnode_T *si_prefroot; /* tree with postponed prefixes */ sblock_T *si_blocks; /* memory blocks used */ + long si_blocks_cnt; /* memory blocks allocated */ + long si_compress_cnt; /* words to add before lowering + compression limit */ wordnode_T *si_first_free; /* List of nodes that have been freed during compression, linked by "wn_child" field. */ + long si_free_count; /* number of nodes in si_first_free */ #ifdef SPELL_PRINTTREE int si_wordnode_nr; /* sequence nr for nodes */ #endif @@ -3801,8 +3824,7 @@ spell_read_aff(spin, fname) /* Myspell allows extra text after the item, but that might * mean mistakes go unnoticed. Require a comment-starter. */ if (itemcnt > lasti && *items[lasti] != '#') - smsg((char_u *)_("Trailing text in %s line %d: %s"), - fname, lnum, items[lasti]); + smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); /* New item for an affix letter. */ --aff_todo; @@ -3983,9 +4005,13 @@ spell_read_aff(spin, fname) smsg((char_u *)_("Expected REP count in %s line %d"), fname, lnum); } - else if (STRCMP(items[0], "REP") == 0 && itemcnt == 3) + else if (STRCMP(items[0], "REP") == 0 && itemcnt >= 3) { /* REP item */ + /* Myspell ignores extra arguments, we require it starts with + * # to detect mistakes. */ + if (itemcnt > 3 && items[3][0] != '#') + smsg((char_u *)_(e_afftrailing), fname, lnum, items[3]); if (do_rep) add_fromto(spin, &spin->si_rep, items[1], items[2]); } @@ -4119,9 +4145,6 @@ spell_read_aff(spin, fname) smsg((char_u *)_("COMPOUNDFLAG(S) value differs from what is used in another .aff file")); else spin->si_compflags = aff->af_compflags; - - if (aff->af_pfxpostpone) - smsg((char_u *)_("Cannot use both PFXPOSTPONE and COMPOUNDFLAG(S)")); } vim_free(pc); @@ -4412,10 +4435,32 @@ spell_read_dic(spin, fname, affile) if (affile->af_pfxpostpone) /* Need to store the list of prefix IDs with the word. */ store_afflist = get_pfxlist(spin, affile, afflist); - else if (spin->si_compflags) - /* Need to store the list of affix IDs for compounding with - * the word. */ - store_afflist = get_compflags(spin, afflist); + + if (spin->si_compflags) + { + /* Need to store the list of compound flags with the word. */ + p = get_compflags(spin, afflist); + if (p != NULL) + { + if (store_afflist != NULL) + { + char_u *s; + + /* Concatenate the prefix IDs with the compound flags. + */ + s = getroom(spin, STRLEN(store_afflist) + + STRLEN(p) + 1, FALSE); + if (s != NULL) + { + STRCPY(s, store_afflist); + STRCAT(s, p); + store_afflist = s; + } + } + else + store_afflist = p; + } + } } /* Add the word to the word tree(s). */ @@ -4938,6 +4983,7 @@ getroom(spin, len, align) bl->sb_next = spin->si_blocks; spin->si_blocks = bl; bl->sb_used = 0; + ++spin->si_blocks_cnt; } p = bl->sb_data + bl->sb_used; @@ -4996,7 +5042,8 @@ wordtree_alloc(spin) * useful when the word can also be used with all caps (no WF_FIXCAP flag) and * used to find suggestions. * For a keep-case word also store it in the keep-case tree. - * When "pfxlist" is not NULL store the word for each postponed prefix ID. + * When "pfxlist" is not NULL store the word for each postponed prefix ID and + * compound flag. */ static int store_word(spin, word, flags, region, pfxlist) @@ -5158,29 +5205,38 @@ tree_add_word(spin, word, root, flags, region, affixID) /* count nr of words added since last message */ ++spin->si_msg_count; - /* - * Every so many words compress the tree, so that we don't use too much - * memory. - */ - i = FALSE; - if (root == spin->si_foldroot) + if (spin->si_compress_cnt > 1) { - if (++spin->si_fold_added >= SPELL_COMPRESS_CNT) - { - i = TRUE; - spin->si_fold_added = 0; - } + if (--spin->si_compress_cnt == 1) + /* Did enough words to lower the block count limit. */ + spin->si_blocks_cnt += SPELL_COMPRESS_INC; } - else if (root == spin->si_keeproot) - { - if (++spin->si_keep_added >= SPELL_COMPRESS_CNT) - { - i = TRUE; - spin->si_keep_added = 0; - } - } - if (i) + + /* + * When we have allocated lots of memory we need to compress the word tree + * to free up some room. But compression is slow, and we might actually + * need that room, thus only compress in the following situations: + * 1. When not compressed before (si_compress_cnt == 0): when using + * SPELL_COMPRESS_CNT blocks. + * 2. When compressed before and used SPELL_COMPRESS_INC blocks before + * adding SPELL_COMPRESS_ADDED words (si_compress_cnt > 1). + * 3. When compressed before, added SPELL_COMPRESS_ADDED words + * (si_compress_cnt == 1) and the number of free nodes drops below the + * maximum word length. + */ +#ifndef SPELL_PRINTTREE + if (spin->si_compress_cnt == 1 + ? spin->si_free_count < MAXWLEN + : spin->si_blocks_cnt >= SPELL_COMPRESS_CNT) +#endif { + /* Decrement the block counter. The effect is that we compress again + * when the freed up room has been used and another SPELL_COMPRESS_INC + * blocks have been allocated. Unless SPELL_COMPRESS_ADDED words have + * been added, then the limit is put back again. */ + spin->si_blocks_cnt -= SPELL_COMPRESS_INC; + spin->si_compress_cnt = SPELL_COMPRESS_ADDED; + if (spin->si_verbose) { msg_start(); @@ -5190,7 +5246,12 @@ tree_add_word(spin, word, root, flags, region, affixID) msg_col = 0; out_flush(); } - wordtree_compress(spin, root); + + /* Compress both trees. Either they both have many nodes, which makes + * compression useful, or one of them is small, which means + * compression goes fast. */ + wordtree_compress(spin, spin->si_foldroot); + wordtree_compress(spin, spin->si_keeproot); } return OK; @@ -5213,6 +5274,7 @@ get_wordnode(spin) n = spin->si_first_free; spin->si_first_free = n->wn_child; vim_memset(n, 0, sizeof(wordnode_T)); + --spin->si_free_count; } #ifdef SPELL_PRINTTREE n->wn_nr = ++spin->si_wordnode_nr; @@ -5252,6 +5314,7 @@ free_wordnode(spin, n) { n->wn_child = spin->si_first_free; spin->si_first_free = n; + ++spin->si_free_count; } /* @@ -5282,6 +5345,8 @@ wordtree_compress(spin, root) verbose_enter(); if (tot > 1000000) perc = (tot - n) / (tot / 100); + else if (tot == 0) + perc = 0; else perc = (tot - n) * 100 / tot; smsg((char_u *)_("Compressed %d of %d nodes; %d%% remaining"), @@ -5323,7 +5388,7 @@ node_compress(spin, node, ht, tot) * Note that with "child" we mean not just the node that is pointed to, * but the whole list of siblings, of which the node is the first. */ - for (np = node; np != NULL; np = np->wn_sibling) + for (np = node; np != NULL && !got_int; np = np->wn_sibling) { ++len; if ((child = np->wn_child) != NULL) @@ -5398,6 +5463,9 @@ node_compress(spin, node, ht, tot) node->wn_u1.hashkey[4] = n == 0 ? 1 : n; node->wn_u1.hashkey[5] = NUL; + /* Check for CTRL-C pressed now and then. */ + fast_breakcheck(); + return compressed; } @@ -7604,6 +7672,8 @@ suggest_try_change(su) fromto_T *ftp; int fl = 0, tl; int repextra = 0; /* extra bytes in fword[] from REP item */ + slang_T *slang; + int fword_ends; /* We make a copy of the case-folded bad word, so that we can modify it * to find matches (esp. REP items). Append some more text, changing @@ -7616,6 +7686,8 @@ suggest_try_change(su) for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); lp->lp_slang != NULL; ++lp) { + slang = lp->lp_slang; + /* * Go through the whole case-fold tree, try changes at each node. * "tword[]" contains the word collected from nodes in the tree. @@ -7639,22 +7711,22 @@ suggest_try_change(su) * When there are postponed prefixes we need to use these first. At * the end of the prefix we continue in the case-fold tree. */ - fbyts = lp->lp_slang->sl_fbyts; - fidxs = lp->lp_slang->sl_fidxs; - pbyts = lp->lp_slang->sl_pbyts; - pidxs = lp->lp_slang->sl_pidxs; + fbyts = slang->sl_fbyts; + fidxs = slang->sl_fidxs; + pbyts = slang->sl_pbyts; + pidxs = slang->sl_pidxs; if (pbyts != NULL) { byts = pbyts; idxs = pidxs; - sp->ts_prefixdepth = PREFIXTREE; + sp->ts_prefixdepth = PFD_PREFIXTREE; sp->ts_state = STATE_NOPREFIX; /* try without prefix first */ } else { byts = fbyts; idxs = fidxs; - sp->ts_prefixdepth = NOPREFIX; + sp->ts_prefixdepth = PFD_NOPREFIX; } /* @@ -7679,7 +7751,7 @@ suggest_try_change(su) len = byts[arridx]; /* bytes in this node */ arridx += sp->ts_curi; /* index of current byte */ - if (sp->ts_prefixdepth == PREFIXTREE) + if (sp->ts_prefixdepth == PFD_PREFIXTREE) { /* Skip over the NUL bytes, we use them later. */ for (n = 0; n < len && byts[arridx + n] == 0; ++n) @@ -7743,7 +7815,17 @@ suggest_try_change(su) flags = (int)idxs[arridx]; - if (sp->ts_prefixdepth < MAXWLEN) + if (sp->ts_prefixdepth == PFD_COMPOUND) + { + /* There was a compound word before this word. If this + * word does not support compounding then give up + * (splitting is tried for the word without compound + * flag). */ + if (sp->ts_twordlen - splitoff < slang->sl_compminlen + || !can_compound(slang, flags)) + break; + } + else if (sp->ts_prefixdepth < MAXWLEN) { /* There was a prefix before the word. Check that the * prefix can be used with this word. */ @@ -7756,10 +7838,8 @@ suggest_try_change(su) ; if (c > 0) { - /* The prefix ID is stored three bytes above the - * flags. */ c = valid_word_prefix(c, n, flags, - tword + splitoff, lp->lp_slang, FALSE); + tword + splitoff, slang, FALSE); if (c == 0) break; @@ -7776,7 +7856,7 @@ suggest_try_change(su) tword[sp->ts_twordlen] = NUL; if (flags & WF_KEEPCAP) /* Must find the word in the keep-case tree. */ - find_keepcap_word(lp->lp_slang, tword + splitoff, + find_keepcap_word(slang, tword + splitoff, preword + prewordlen); else { @@ -7818,9 +7898,9 @@ suggest_try_change(su) captype(preword + prewordlen, NULL))) newscore += SCORE_ICASE; - if ((fword[sp->ts_fidx] == NUL - || !spell_iswordp(fword + sp->ts_fidx, curbuf)) - && sp->ts_fidx >= sp->ts_fidxtry) + fword_ends = (fword[sp->ts_fidx] == NUL + || !spell_iswordp(fword + sp->ts_fidx, curbuf)); + if (fword_ends && sp->ts_fidx >= sp->ts_fidxtry) { /* The badword also ends: add suggestions. Give a penalty * when changing non-word char to word char, e.g., "thes," @@ -7849,17 +7929,38 @@ suggest_try_change(su) sp->ts_fidx - repextra, sp->ts_score + newscore, 0, FALSE); } - else if (sp->ts_fidx >= sp->ts_fidxtry + else if ((sp->ts_fidx >= sp->ts_fidxtry || fword_ends) #ifdef FEAT_MBYTE /* Don't split halfway a character. */ && (!has_mbyte || sp->ts_tcharlen == 0) #endif ) { - /* The word in the tree ends but the badword - * continues: try inserting a space and check that a valid - * words starts at fword[sp->ts_fidx]. */ - if (try_deeper(su, stack, depth, newscore + SCORE_SPLIT)) + int try_compound; + + /* Get here in two situations: + * 1. The word in the tree ends but the badword continues: + * If the word allows compounding try that. Otherwise + * try a split by inserting a space. For both check + * that a valid words starts at fword[sp->ts_fidx]. + * 2. The badword does end, but it was due to a change + * (e.g., a swap). No need to split, but do check that + * the following word is valid. + */ + if (!fword_ends + && spell_iswordp(fword + sp->ts_fidx, curbuf) + && sp->ts_twordlen - splitoff + >= slang->sl_compminlen + && can_compound(slang, flags)) + try_compound = TRUE; + else + { + try_compound = FALSE; + if (!fword_ends) + newscore += SCORE_SPLIT; + } + + if (try_deeper(su, stack, depth, newscore)) { /* Save things to be restored at STATE_SPLITUNDO. */ sp->ts_save_prewordlen = prewordlen; @@ -7870,28 +7971,49 @@ suggest_try_change(su) ++depth; sp = &stack[depth]; - /* Append a space to preword. */ - STRCAT(preword, " "); + /* Append a space to preword when splitting. */ + if (!try_compound && !fword_ends) + STRCAT(preword, " "); prewordlen = STRLEN(preword); splitoff = sp->ts_twordlen; /* If the badword has a non-word character at this * position skip it. That means replacing the - * non-word character with a space. */ - if (!spell_iswordp_nmw(fword + sp->ts_fidx)) + * non-word character with a space. Always skip a + * character when the word ends. */ + if ((!try_compound + && !spell_iswordp_nmw(fword + sp->ts_fidx)) + || fword_ends) { - sp->ts_score -= SCORE_SPLIT - SCORE_SUBST; + int l; + #ifdef FEAT_MBYTE if (has_mbyte) - sp->ts_fidx += MB_BYTE2LEN(fword[sp->ts_fidx]); + l = MB_BYTE2LEN(fword[sp->ts_fidx]); else #endif - ++sp->ts_fidx; + l = 1; + if (fword_ends) + { + /* Copy the skipped character to preword. */ + mch_memmove(preword + prewordlen, + fword + sp->ts_fidx, l); + prewordlen += l; + preword[prewordlen] = NUL; + } + else + sp->ts_score -= SCORE_SPLIT - SCORE_SUBST; + sp->ts_fidx += l; } + /* set flag to check compound flag on following word */ + if (try_compound) + sp->ts_prefixdepth = PFD_COMPOUND; + else + sp->ts_prefixdepth = PFD_NOPREFIX; + /* set su->su_badflags to the caps type at this * position */ - #ifdef FEAT_MBYTE if (has_mbyte) n = nofold_len(fword, sp->ts_fidx, su->su_badptr); @@ -7908,10 +8030,10 @@ suggest_try_change(su) break; case STATE_SPLITUNDO: - /* Undo the changes done for word split. */ + /* Undo the changes done for word split or compound word. */ su->su_badflags = sp->ts_save_badflags; splitoff = sp->ts_save_splitoff; - prewordlen = sp->ts_save_prewordlen; + prewordlen = sp->ts_save_prewordlen; /* Continue looking for NUL bytes. */ sp->ts_state = STATE_START; @@ -8018,8 +8140,8 @@ suggest_try_change(su) /* For a similar character adjust score * from SCORE_SUBST to SCORE_SIMILAR. */ - else if (lp->lp_slang->sl_has_map - && similar_chars(lp->lp_slang, + else if (slang->sl_has_map + && similar_chars(slang, mb_ptr2char(tword + sp->ts_twordlen - sp->ts_tcharlen), @@ -8064,8 +8186,8 @@ suggest_try_change(su) * We do this after calling try_deeper() because * it's slow. */ if (newscore != 0 - && lp->lp_slang->sl_has_map - && similar_chars(lp->lp_slang, + && slang->sl_has_map + && similar_chars(slang, c, fword[sp->ts_fidx - 1])) sp->ts_score -= SCORE_SUBST - SCORE_SIMILAR; } @@ -8432,7 +8554,7 @@ suggest_try_change(su) /* Check if matching with REP items from the .aff file would * work. Quickly skip if there are no REP items or the score * is going to be too high anyway. */ - gap = &lp->lp_slang->sl_rep; + gap = &slang->sl_rep; if (gap->ga_len == 0 || sp->ts_score + SCORE_REP >= su->su_maxscore) { @@ -8442,7 +8564,7 @@ suggest_try_change(su) /* Use the first byte to quickly find the first entry that * may match. If the index is -1 there is none. */ - sp->ts_curi = lp->lp_slang->sl_rep_first[fword[sp->ts_fidx]]; + sp->ts_curi = slang->sl_rep_first[fword[sp->ts_fidx]]; if (sp->ts_curi < 0) { sp->ts_state = STATE_FINAL; @@ -8458,7 +8580,7 @@ suggest_try_change(su) * word is valid. */ p = fword + sp->ts_fidx; - gap = &lp->lp_slang->sl_rep; + gap = &slang->sl_rep; while (sp->ts_curi < gap->ga_len) { ftp = (fromto_T *)gap->ga_data + sp->ts_curi++; @@ -8500,8 +8622,7 @@ suggest_try_change(su) case STATE_REP_UNDO: /* Undo a REP replacement and continue with the next one. */ - ftp = (fromto_T *)lp->lp_slang->sl_rep.ga_data - + sp->ts_curi - 1; + ftp = (fromto_T *)slang->sl_rep.ga_data + sp->ts_curi - 1; fl = STRLEN(ftp->ft_from); tl = STRLEN(ftp->ft_to); p = fword + sp->ts_fidx; @@ -8518,7 +8639,7 @@ suggest_try_change(su) /* Did all possible states at this level, go up one level. */ --depth; - if (depth >= 0 && stack[depth].ts_prefixdepth == PREFIXTREE) + if (depth >= 0 && stack[depth].ts_prefixdepth == PFD_PREFIXTREE) { /* Continue in or go back to the prefix tree. */ byts = pbyts; diff --git a/src/structs.h b/src/structs.h index af859bf99..5473510e2 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1432,6 +1432,7 @@ struct file_buffer #ifdef FEAT_SYN_HL hashtab_T b_keywtab; /* syntax keywords hash table */ hashtab_T b_keywtab_ic; /* idem, ignore case */ + int b_syn_error; /* TRUE when error occured in HL */ int b_syn_ic; /* ignore case for :syn cmds */ int b_syn_spell; /* SYNSPL_ values */ garray_T b_syn_patterns; /* table for syntax patterns */ diff --git a/src/syntax.c b/src/syntax.c index 4c4cbadba..aa393d7d6 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3182,6 +3182,7 @@ syntax_clear(buf) { int i; + buf->b_syn_error = FALSE; /* clear previous error */ buf->b_syn_ic = FALSE; /* Use case, by default */ buf->b_syn_spell = SYNSPL_DEFAULT; /* default spell checking */ buf->b_syn_containedin = FALSE; diff --git a/src/version.h b/src/version.h index 4b697355b..94726c6d0 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 15)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 15, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 16)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 16, compiled " -- cgit v1.2.1