diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-08-05 21:35:02 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-08-05 21:35:02 +0000 |
commit | 572cb561acc47c8e67fd111ec0418ee74256bf35 (patch) | |
tree | 0c90a55ab6a165d75c4e226464c5676fbe6d517f /runtime | |
parent | 86eb7a2c0346b0865d904d1627f52ad2274f2a01 (diff) |
updated for version 7.0124v7.0124
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 30 | ||||
-rw-r--r-- | runtime/doc/options.txt | 36 | ||||
-rw-r--r-- | runtime/doc/pi_netrw.txt | 51 | ||||
-rw-r--r-- | runtime/doc/tags | 3 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 9 | ||||
-rw-r--r-- | runtime/doc/version7.txt | 4 | ||||
-rw-r--r-- | runtime/plugin/netrw.vim | 216 | ||||
-rw-r--r-- | runtime/syntax/sh.vim | 9 | ||||
-rw-r--r-- | runtime/syntax/vim.vim | 14 |
9 files changed, 257 insertions, 115 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b7896be3ed..a47f472600 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Aug 01 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Aug 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1474,6 +1474,8 @@ call( {func}, {arglist} [, {dict}]) char2nr( {expr}) Number ASCII value of first char in {expr} cindent( {lnum}) Number C indent for line {lnum} col( {expr}) Number column nr of cursor or mark +complete_add( {expr}) Number add completion match +complete_check() Number check for key typed during completion confirm( {msg} [, {choices} [, {default} [, {type}]]]) Number number of choice picked by user copy( {expr}) any make a shallow copy of {expr} @@ -1886,6 +1888,22 @@ col({expr}) The result is a Number, which is the byte index of the column \<C-O>:echo col(".") . "\n" <Bar> \let &ve = save_ve<CR> < + +complete_add({expr}) *complete_add()* + Add {expr} to the list of matches. Only to be used by the + function specified with the 'completefunc' option. + Returns 0 for failure (empty string or out of memory), + 1 when the match was added, 2 when the match was already in + the list. + +complete_check() *complete_check()* + Check for a key typed while looking for completion matches. + This is to be used when looking for matches takes some time. + Returns non-zero when searching for matches is to be aborted, + zero otherwise. + Only to be used by the function specified with the + 'completefunc' option. + *confirm()* confirm({msg} [, {choices} [, {default} [, {type}]]]) Confirm() offers the user a dialog, from which a choice can be @@ -5233,8 +5251,8 @@ This would call the function "my_func_whizz(parameter)". value of each item. When an error is detected for a command inside the loop, execution continues after the "endfor". - Changing {list} affects what items are used. Make a - copy if this is unwanted: > + Changing {list} inside the loop affects what items are + used. Make a copy if this is unwanted: > :for item in copy(mylist) < When not making a copy, Vim stores a reference to the next item in the list, before executing the commands @@ -5252,12 +5270,6 @@ This would call the function "my_func_whizz(parameter)". changing. Unlet the variable at the end of the loop to allow multiple item types. -:for {var} in {string} -:endfo[r] Like ":for" above, but use each character in {string} - as a list item. - Composing characters are used as separate characters. - A Number is first converted to a String. - :for [{var1}, {var2}, ...] in {listlist} :endfo[r] Like ":for" above, but each item in {listlist} must be diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 3ad65d1812..f17cf6516d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2005 Aug 01 +*options.txt* For Vim version 7.0aa. Last change: 2005 Aug 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1607,7 +1607,15 @@ A jump table for the options with a short description can be found at |Q_op|. with the matching words. These matches should include the "a:base" text. When there are no matches return an empty List. + When searching for matches takes some time call |complete_add()| to + add each match to the total list. These matches should then not + appear in the returned list! Call |complete_check()| now and then to + allow the user to press a key while still searching for matches. Stop + searching when it returns non-zero. + The function must not move the cursor! + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. An example that completes the names of the months: > fun! CompleteMonths(findstart, col, base) @@ -1632,6 +1640,32 @@ A jump table for the options with a short description can be found at |Q_op|. endfun set completefunc=CompleteMonths < + The same, but now pretending searching for matches is slow: > + fun! CompleteMonths(findstart, col, base) + if a:findstart + " locate the start of the word + let line = getline('.') + let start = a:col + while start > 0 && line[start - 1] =~ '\a' + let start -= 1 + endwhile + return start + else + " find months matching with "a:base" + for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") + if m =~ '^' . a:base + call complete_add(m) + endif + sleep 300m " simulate searching for next match + if complete_check() + break + endif + endfor + return [] + endif + endfun + set completefunc=CompleteMonths +< *'confirm'* *'cf'* *'noconfirm'* *'nocf'* 'confirm' 'cf' boolean (default off) diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index ab152de6d0..4a04f72c1e 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 01, 2005 +*pi_netrw.txt* For Vim version 7.0. Last change: Aug 04, 2005 VIM REFERENCE MANUAL by Charles E. Campbell, Jr. @@ -584,6 +584,8 @@ MAPS *netrw-maps* :Sexplore[!] [dir].Split & Explore directory of current file|netrw-explore| :Hexplore[!] [dir].Horizontal Split & Explore...............|netrw-explore| :Vexplore[!] [dir].Vertical Split & Explore.................|netrw-explore| + :Pexplore[!] [dir].Vertical Split & Explore.................|netrw-explore| + :Nexplore[!] [dir].Vertical Split & Explore.................|netrw-explore| QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* > @@ -606,6 +608,7 @@ QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* <c-l> Causes Netrw to refresh the directory listing o Enter the file/directory under the cursor in a new browser window. A horizontal split is used. + p Preview the file r Reverse sorting order s Select sorting style: by name, time, or file size v Enter the file/directory under the cursor in a new browser @@ -741,10 +744,12 @@ ssh interaction, etc, see |netrw-list-hack|. DIRECTORY EXPLORING COMMANDS *netrw-explore* - :Explore[!] [dir].Explore directory of current file - :Sexplore[!] [dir].Split & Explore directory of current file - :Hexplore[!] [dir].Horizontal Split & Explore - :Vexplore[!] [dir].Vertical Split & Explore + :Explore[!] [dir]... Explore directory of current file + :Sexplore[!] [dir]... Split & Explore directory of current file + :Hexplore[!] [dir]... Horizontal Split & Explore + :Vexplore[!] [dir]... Vertical Split & Explore + :Nexplore............. used with **/patterns; go to next matching file + :Pexplore............. used with **/patterns; go to previous matching file The Explore command will open the local-directory browser on the current file's directory (or on directory [dir] if specified). The window @@ -762,6 +767,23 @@ optional ! does the Explore with |aboveleft| horizontal splitting. Vexplore does an Explore with |leftabove| vertical splitting; the optiona ! does an Explore with |topleft| vertical splitting. +(Following needs v7.0 or later) +When Explore, Sexplore, Hexplore, or Vexplore are used with +**/filename-patterns, netrw will attempt to find a (sub)directory which +matches the filename pattern. The Nexplore and Pexplore commands enable +one to proceed to the next/previous matching file, respectively. If your +console or gui produce recognizable shift-up or shift-down sequences, then + + <s-down> == Nexplore, and + <s-up> == Pexplore. + +As an example, consider > + + :Explore **/*.c + :Nexplore + :Nexplore + :Pexplore +< REFRESHING THE LISTING *netrw-ctrl-l* @@ -993,10 +1015,10 @@ the current directory to the current browsing directory. BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks* -One may easily "bookmark" a directory by using +One may easily "bookmark" a directory by using > {cnt}b - +< Any count may be used. One may use viminfo's "!" option to retain bookmarks between vim sessions. See |netrw-B| for how to return to a bookmark and |netrw-q| for how to list them. @@ -1143,6 +1165,21 @@ which is loaded automatically at startup (assuming :set nocp). ============================================================================== 10. History *netrw-history* + v58: * Explore and relatives can now handle **/somefilepattern (v7) + * Nexplore and Pexplore introduced (v7). shift-down and shift-up + cursor keys will invoke Nexplore and Pexplore, respectively. + * bug fixed with o and v + * autochdir only worked around for vim when it has been + compiled with either |+netbeans_intg| or |+sun_workshop| + * Under Windows, all directories and files were being preceded + with a "/" when local browsing. Fixed. + * When: syntax highlighting is off, laststatus=2, and remote + browsing is used, sometimes the laststatus highlighting + bleeds into the entire display. Work around - do an extra + redraw in that case. + * Bugfix: when g:netrw_keepdir=0, due to re-use of buffers, + netrw didn't change the directory when it should've + * Bugfix: D and R commands work again v57: * Explore and relatives can now handle RO files * reverse sort restored with vim7's sort command * g:netrw_keepdir now being used to keep the current directory diff --git a/runtime/doc/tags b/runtime/doc/tags index 09184811b6..e5eb5d36ef 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4456,6 +4456,8 @@ compl-occult insert.txt /*compl-occult* compl-tag insert.txt /*compl-tag* compl-vim insert.txt /*compl-vim* compl-whole-line insert.txt /*compl-whole-line* +complete_add() eval.txt /*complete_add()* +complete_check() eval.txt /*complete_check()* complex-change change.txt /*complex-change* complex-repeat repeat.txt /*complex-repeat* compress pi_gzip.txt /*compress* @@ -5163,6 +5165,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* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index ba45f2674a..c1a02fc94f 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 02 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Aug 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -66,8 +66,6 @@ PLANNED FOR VERSION 7.0: make it work for all completion methods. First cleanup the Insert-mode completion. - - check security of 'completefunc'. - - use callback to interrupt searching for matches. UI: - At first: use 'wildmenu' kind of thing. @@ -76,7 +74,8 @@ PLANNED FOR VERSION 7.0: alternatives). Completion logic: - Use 'coupler' option to list items that connect words. For C: ".,->". + Use something like 'completefunc'? + runtime/complete/{filetype}.vim files? In function arguments suggest variables of expected type. Ideas from others: @@ -102,7 +101,7 @@ PLANNED FOR VERSION 7.0: "Visual Assist" http://www.wholetomato.com/products: Completion in .NET framework SharpDevelop: http://www.icsharpcode.net - - Pre-expand abbreviations, show which abbrevs would match? + - Pre-expand abbreviations, show which abbrevs would match? - UNDO TREE: keep all states of the text, don't delete undo info. When making a change, instead of clearing any future undo (thus redo) diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 9ca05fc2ec..7119129565 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 04 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -399,6 +399,8 @@ New functions: ~ |browsedir()| dialog to select a directory |byteidx()| index of a character (Ilya Sher) |call()| call a function with List as arguments +|complete_add()| add match for 'completefunc' +|complete_check()| check for key pressed, for 'completefunc' |copy()| make a shallow copy of a List or Dictionary |count()| count nr of times a value is in a List or Dictionary |deepcopy()| make a full copy of a List or Dictionary diff --git a/runtime/plugin/netrw.vim b/runtime/plugin/netrw.vim index c515b8b9dc..79a7939223 100644 --- a/runtime/plugin/netrw.vim +++ b/runtime/plugin/netrw.vim @@ -1,8 +1,16 @@ " netrw.vim: Handles file transfer and remote directory listing across a network -" Last Change: Aug 02, 2005 +" Last Change: Aug 05, 2005 " Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> -" Version: 58b NOT RELEASED +" Version: 58e ASTRO-ONLY " 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) @@ -14,7 +22,7 @@ if exists("g:loaded_netrw") || &cp finish endif -let g:loaded_netrw = "v58b" +let g:loaded_netrw = "v58e" let loaded_explorer = 1 let s:keepcpo = &cpo set cpo&vim @@ -263,15 +271,17 @@ endfun " NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{1 fun! <SID>NetRestorePosn() " call Dfunc("NetRestorePosn() winnr=".s:netrw_winnr." line=".s:netrw_line." col=".s:netrw_col." hline=".s:netrw_hline) + let eikeep= &ei + set ei=all " restore window " call Decho("restore window: exe silent! ".s:netrw_winnr."wincmd w") exe "silent! ".s: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 +" 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! ".s:netrw_hline."G0z") @@ -281,6 +291,7 @@ fun! <SID>NetRestorePosn() " call Decho("restore posn: exe norm! ".s:netrw_line."G0".s:netrw_col."|") exe "norm! ".s:netrw_line."G0".s:netrw_col."\<bar>" + let &ei= eikeep " call Dret("NetRestorePosn") endfun @@ -354,7 +365,7 @@ fun! s:NetRead(...) let ichoice = ichoice + 1 if ichoice > a:0 if !exists("g:netrw_quiet") - echoerr "***netrw*** Unbalanced string in filename '". wholechoice ."'" + echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("NetRead") @@ -441,7 +452,7 @@ fun! s:NetRead(...) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep= &debug set debug=msg - echoerr "***netrw*** ".getline(1) + echohl Error | echo "***netrw*** ".getline(1) | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() let &debug= debugkeep endif @@ -487,7 +498,7 @@ fun! s:NetRead(...) if getline(1) !~ "^$" " call Decho("error<".getline(1).">") if !exists("g:netrw_quiet") - echoerr "***netrw*** ".getline(1) + echohl Error | echo "***netrw*** ".getline(1) | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif endif @@ -520,7 +531,7 @@ fun! s:NetRead(...) " call Decho("read via http (method #5)") if g:netrw_http_cmd == "" if !exists("g:netrw_quiet") - echoerr "***netrw*** neither wget nor fetch command is available" + echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif exit @@ -598,7 +609,7 @@ fun! s:NetRead(...) elseif b:netrw_method == 8 " read with fetch if g:netrw_fetch_cmd == "" if !exists("g:netrw_quiet") - echoerr "***netrw*** fetch command not available" + echohl Error | echo "***netrw*** fetch command not available" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif exit @@ -805,7 +816,7 @@ fun! s:NetWrite(...) range let ichoice = ichoice + 1 if choice > a:0 if !exists("g:netrw_quiet") - echoerr "***netrw*** Unbalanced string in filename '". wholechoice ."'" + echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("NetWrite") @@ -876,7 +887,7 @@ fun! s:NetWrite(...) range " 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") - echoerr "***netrw*** ".getline(1) + echohl Error | echo "***netrw*** ".getline(1) | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif let mod=1 @@ -916,7 +927,7 @@ fun! s:NetWrite(...) range " 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") - echoerr "***netrw*** ".getline(1) + echohl Error | echo "***netrw*** ".getline(1) | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif let mod=1 @@ -945,7 +956,7 @@ fun! s:NetWrite(...) range " http: NetWrite Method #5 elseif b:netrw_method == 5 if !exists("g:netrw_quiet") - echoerr "***netrw*** currently <netrw.vim> does not support writing using http:" + echohl Error | echo "***netrw*** currently <netrw.vim> does not support writing using http:" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif @@ -1044,7 +1055,7 @@ fun! <SID>NetBrowse(dirname) " call Decho("b:netrw_method=".b:netrw_method) if !executable("ftp") if !exists("g:netrw_quiet") - echoerr "***netrw*** this system doesn't support remote directory listing via ftp" + echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ftp" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("NetBrowse") @@ -1052,9 +1063,10 @@ fun! <SID>NetBrowse(dirname) endif elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' if !exists("g:netrw_quiet") - echoerr "***netrw*** this system doesn't support remote directory listing via ssh" + echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ssh" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif + " call Dret("NetBrowse") return endif @@ -1068,7 +1080,7 @@ fun! <SID>NetBrowse(dirname) " call Decho("dirpat<".dirpat.">") if dirname !~ dirpat if !exists("g:netrw_quiet") - echoerr "***netrw*** netrw doesn't understand your dirname<".dirname.">" + echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("NetBrowse : badly formatted dirname<".dirname.">") @@ -1100,7 +1112,7 @@ fun! <SID>NetBrowse(dirname) " optionally sort by time (-t) or by size (-S) if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]" - echoerr "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)" + 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 <cr> to continue")|call inputrestore() else if g:netrw_sort_by =~ "^t" @@ -1140,7 +1152,8 @@ fun! <SID>NetBrowse(dirname) silent call s:NetRead(method."://".user.machine."/".path) exe "silent doau BufReadPost ".fname keepjumps 1d - setlocal nomod + + setlocal nonu nomod noma " call Dret("NetBrowse : file<".fname.">") return @@ -1180,7 +1193,7 @@ fun! <SID>NetBrowse(dirname) " set up buffer-local mappings " call Decho("set up buffer-local mappings") nnoremap <buffer> <silent> <cr> :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr> - nnoremap <buffer> <silent> <c-l> :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr> + nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(<SID>NetBrowseChgDir(expand("%"),'./'))<cr> nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'../'))<cr> nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr> nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr> @@ -1279,26 +1292,25 @@ fun! <SID>NetBrowse(dirname) " 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) +" 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 -if !exists("g:junk") - let g:junk=1 -else - put ='testing' - return -endif 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 !has("syntax_items") + 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 @@ -1315,7 +1327,7 @@ endif if method == "ftp" " cleanup exe "keepjumps ".s:netrw_bannercnt - while getline(".") =~ '^total\s\+\d\+$' || getline(".") =~ 'Trying\s\+\d\+.*$' + while getline(".") =~ g:netrw_ftp_browse_reject keepjumps d endwhile " if there's no ../ listed, then put ./ and ../ in @@ -1355,9 +1367,8 @@ endif endif endif exe "keepjumps ".s:netrw_bannercnt - setlocal nomod - setlocal noma - setlocal nonu + + setlocal nomod noma nonu " call Dret("NetBrowse") return @@ -1497,7 +1508,7 @@ fun! <SID>NetBrowseRm(usrhost,path) range " call Decho("returned=".ret." errcode=".v:shell_error) if v:shell_error != 0 && !exists("g:netrw_quiet") - echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" + echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif endif @@ -1561,6 +1572,17 @@ fun! <SID>NetBrowseRename(usrhost,path) range endfun " --------------------------------------------------------------------- +" NetRefresh: {{{2 +fun! <SID>NetRefresh(dirname) +" call Dfunc("NetRefresh(dirname<".a:dirname.">)") + set ma + %d + call <SID>NetBrowse(dirname) + redraw! +" call Dret("NetRefresh") +endfun + +" --------------------------------------------------------------------- " NetBrowseX: allows users to write custom functions to operate on {{{2 " files given their extension. Passes 0=local, 1=remote fun! <SID>NetBrowseX(fname,remote) @@ -1580,10 +1602,8 @@ fun! <SID>NetBrowseX(fname,remote) let fname= tempname().".".exten " call Decho("create a local copy of <".a:fname."> as <".fname.">") exe "keepjumps silent bot 1new ".a:fname - let eikeep= &ei - set ei=all bh=delete + set bh=delete exe "w! ".fname - let &ei= eikeep q endif " call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten)) @@ -1627,10 +1647,8 @@ fun! <SID>NetBrowseX(fname,remote) endif if a:remote == 1 - let eikeep= &ei - set ei=all bh=delete bt=nofile noswf + set bh=delete bt=nofile noswf exe "norm! \<c-o>" - let &ei= eikeep redraw! endif @@ -1764,7 +1782,7 @@ fun! <SID>NetHideEdit(mode) if a:mode == 0 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./')) else - silent call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./")) + silent call s:LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,"./")) endif " call Dret("NetHideEdit") @@ -1809,6 +1827,8 @@ fun! <SID>NetLongList(mode) 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 @@ -1818,7 +1838,7 @@ fun! <SID>NetLongList(mode) silent call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./")) endif - call s:NetRestorePosn() +" call s:NetRestorePosn() " call Dret("NetLongList : g:netrw_longlist=".g:netrw_longlist) endfun @@ -1866,7 +1886,7 @@ fun! <SID>NetMakeDir(usrhost) " call Decho("fullnewdir<".fullnewdir.">") if isdirectory(fullnewdir) if !exists("g:netrw_quiet") - echoerr "***netrw*** <".newdirname."> is already a directory!" + echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("NetMakeDir : directory<".newdirname."> exists previously") @@ -1874,7 +1894,7 @@ fun! <SID>NetMakeDir(usrhost) endif if filereadable(fullnewdir) if !exists("g:netrw_quiet") - echoerr "***netrw*** <".newdirname."> is already a file!" + echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("NetMakeDir : file<".newdirname."> exists previously") @@ -1900,11 +1920,12 @@ fun! <SID>NetMakeDir(usrhost) let linenum= line(".") norm! H0 let hline = line(".") + set ma|norm! 2D call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./')) exe "norm! ".hline."G0z\<CR>" exe linenum elseif !exists("g:netrw_quiet") - echoerr "***netrw*** unable to make directory<".newdirname.">" + echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif redraw! @@ -1924,7 +1945,7 @@ fun! <SID>NetMakeDir(usrhost) exe "norm! ".hline."G0z\<CR>" exe linenum elseif !exists("g:netrw_quiet") - echoerr "***netrw*** unable to make directory<".newdirname.">" + echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif redraw! @@ -1935,8 +1956,12 @@ endfun " --------------------------------------------------------------------- " NetBookmarkDir: {{{2 -" 0: bookmark the current directory -" 1: change to the bookmarked directory +" 0: (user: <b>) bookmark current directory +" 1: (user: <B>) change to the bookmarked directory +" 2: (user: <q>) list bookmarks +" 3: (LocalBrowse) record current directory history +" 4: (user: <u>) go up (previous) bookmark +" 5: (user: <U>) go down (next) bookmark fun! <SID>NetBookmarkDir(chg,curdir) " call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count) @@ -1958,8 +1983,8 @@ fun! <SID>NetBookmarkDir(chg,curdir) endif elseif a:chg == 2 + " list user's bookmarks if exists("g:NETRW_BOOKMARKMAX") - " list user's bookmarks " call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]") let cnt= 0 while cnt <= g:NETRW_BOOKMARKMAX @@ -1990,10 +2015,12 @@ fun! <SID>NetBookmarkDir(chg,curdir) endwhile elseif a:chg == 3 - " saves most recently visited directories - 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}.">") + " 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 @@ -2042,12 +2069,12 @@ fun! <SID>LocalBrowse(dirname) " 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()) +" call Dfunc("LocalBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by) " call Dredir("ls!") if v:version < 603 if !exists("g:netrw_quiet") - echoerr "***netrw*** vim version<".v:version."> too old for browsing with netrw" + echohl Error | echo "***netrw*** vim version<".v:version."> too old for browsing with netrw" | echohl None call inputsave()|call input("Press <cr> to continue")|call inputrestore() endif " call Dret("LocalBrowse : vim version<".v:version."> too old") @@ -2087,19 +2114,23 @@ fun! <SID>LocalBrowse(dirname) endif " call Decho("enew buffer") else - let eikeep= &ei - set ei=BufEnter if v:version < 700 exe "b ".bufnum else exe "keepalt b ".bufnum endif - let &ei= eikeep - if getline(2) =~ '^" Directory Listing ' -" call Dret("LocalBrowse : reusing buffer#".bufnum."<".a:dirname.">") - return + 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') @@ -2119,6 +2150,7 @@ fun! <SID>LocalBrowse(dirname) " make this buffer modifiable and hidden setlocal ma hidden nonu + keepalt silent! %d " --------------------------- " Perform Directory Listing: @@ -2129,9 +2161,9 @@ fun! <SID>LocalBrowse(dirname) " set up all the maps " call Decho("Setting up local browser maps") nnoremap <buffer> <silent> <cr> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr> - nnoremap <buffer> <silent> <c-l> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr> + nnoremap <buffer> <silent> <c-l> :set ma<bar>%d<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<bar>redraw!<cr> nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr> - nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr> + nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr> nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr> nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr> nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr> @@ -2148,7 +2180,9 @@ fun! <SID>LocalBrowse(dirname) nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr> nnoremap <buffer> <silent> v :exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"<bar>exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr> nnoremap <buffer> <silent> x :exe "norm! 0"<bar>call <SID>NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)<cr> - nnoremap <buffer> <silent> <2-leftmouse> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr> + nnoremap <buffer> <silent> <2-leftmouse> :exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr> + nnoremap <buffer> <silent> <s-up> :Pexplore<cr> + nnoremap <buffer> <silent> <s-down> :Nexplore<cr> exe 'nnoremap <buffer> <silent> <del> :exe "norm! 0"<bar>call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' exe 'vnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' exe 'nnoremap <buffer> <silent> D :exe "norm! 0"<bar>call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>' @@ -2208,7 +2242,7 @@ fun! <SID>LocalBrowse(dirname) " set up syntax highlighting if has("syntax") setlocal ft=netrwlist - if !has("syntax_items") + if !exists("g:syntax_on") || !g:syntax_on setlocal ft= endif endif @@ -2305,11 +2339,11 @@ fun! LocalBrowseList() if isdirectory(filename) let pfile= filename."/" endif - let pfile= substitute(pfile,'^/','','e') if pfile =~ '//$' |