mirror of
				https://github.com/vim/vim.git
				synced 2025-10-30 09:47:20 -04:00 
			
		
		
		
	runtime(netrw): Sync with netrw 174b (#13836)
* Import netrw v174b * Revert unwanted changes * Fix indent * Revert some changes * Update tags * Break long line Signed-off-by: Ken Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
		| @@ -2121,9 +2121,9 @@ fun! netrw#NetRead(mode,...) | |||||||
|        let wholechoice = wholechoice . " " . choice |        let wholechoice = wholechoice . " " . choice | ||||||
|        let ichoice     = ichoice + 1 |        let ichoice     = ichoice + 1 | ||||||
|        if ichoice > a:0 |        if ichoice > a:0 | ||||||
|        	if !exists("g:netrw_quiet") |         if !exists("g:netrw_quiet") | ||||||
| 	 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) |          call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3) | ||||||
| 	endif |         endif | ||||||
| "        call Dret("netrw#NetRead :2 getcwd<".getcwd().">") | "        call Dret("netrw#NetRead :2 getcwd<".getcwd().">") | ||||||
|         return |         return | ||||||
|        endif |        endif | ||||||
| @@ -2544,9 +2544,9 @@ fun! netrw#NetWrite(...) range | |||||||
|        let wholechoice= wholechoice . " " . choice |        let wholechoice= wholechoice . " " . choice | ||||||
|        let ichoice    = ichoice + 1 |        let ichoice    = ichoice + 1 | ||||||
|        if choice > a:0 |        if choice > a:0 | ||||||
|        	if !exists("g:netrw_quiet") |         if !exists("g:netrw_quiet") | ||||||
| 	 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) |          call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13) | ||||||
| 	endif |         endif | ||||||
| "        call Dret("netrw#NetWrite") | "        call Dret("netrw#NetWrite") | ||||||
|         return |         return | ||||||
|        endif |        endif | ||||||
| @@ -5003,12 +5003,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) | |||||||
|       if g:netrw_chgwin >= 1 |       if g:netrw_chgwin >= 1 | ||||||
| "       call Decho("edit-a-file: changing window to #".g:netrw_chgwin.": (due to g:netrw_chgwin)",'~'.expand("<slnum>")) | "       call Decho("edit-a-file: changing window to #".g:netrw_chgwin.": (due to g:netrw_chgwin)",'~'.expand("<slnum>")) | ||||||
|        if winnr("$")+1 == g:netrw_chgwin |        if winnr("$")+1 == g:netrw_chgwin | ||||||
| 	" if g:netrw_chgwin is set to one more than the last window, then |        " if g:netrw_chgwin is set to one more than the last window, then | ||||||
| 	" vertically split the last window to make that window available. |        " vertically split the last window to make that window available. | ||||||
| 	let curwin= winnr() |        let curwin= winnr() | ||||||
| 	exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" |        exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" | ||||||
| 	vs |        vs | ||||||
| 	exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin |        exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin | ||||||
|        endif |        endif | ||||||
|        exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" |        exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" | ||||||
|       endif |       endif | ||||||
| @@ -6127,7 +6127,7 @@ fun! s:NetrwServerEdit(islocal,fname) | |||||||
|        " used something like <cr>. |        " used something like <cr>. | ||||||
| "       call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("<slnum>")) | "       call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("<slnum>")) | ||||||
|        if exists("g:netrw_browse_split") |        if exists("g:netrw_browse_split") | ||||||
| 	unlet g:netrw_browse_split |         unlet g:netrw_browse_split | ||||||
|        endif |        endif | ||||||
|        let g:netrw_browse_split= 0 |        let g:netrw_browse_split= 0 | ||||||
|        if exists("s:netrw_browse_split_".winnr()) |        if exists("s:netrw_browse_split_".winnr()) | ||||||
| @@ -6161,7 +6161,7 @@ fun! s:NetrwServerEdit(islocal,fname) | |||||||
|       if !ctrlr |       if !ctrlr | ||||||
| "       call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("<slnum>")) | "       call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("<slnum>")) | ||||||
|        if exists("g:netrw_browse_split") |        if exists("g:netrw_browse_split") | ||||||
| 	unlet g:netrw_browse_split |         unlet g:netrw_browse_split | ||||||
|        endif |        endif | ||||||
|        let g:netrw_browse_split= 0 |        let g:netrw_browse_split= 0 | ||||||
|        call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) |        call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) | ||||||
| @@ -7506,7 +7506,7 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) | |||||||
|      for fname in s:netrwmarkfilelist_{curbufnr} |      for fname in s:netrwmarkfilelist_{curbufnr} | ||||||
|       if a:islocal |       if a:islocal | ||||||
|        if g:netrw_keepdir |        if g:netrw_keepdir | ||||||
| 	let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) |         let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) | ||||||
|        endif |        endif | ||||||
|       else |       else | ||||||
|        let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) |        let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) | ||||||
| @@ -10685,7 +10685,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) | |||||||
|       let ret= system(netrw_rm_cmd) |       let ret= system(netrw_rm_cmd) | ||||||
|       if v:shell_error != 0 |       if v:shell_error != 0 | ||||||
|        if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir |        if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir | ||||||
| 	call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102) |         call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102) | ||||||
|        else |        else | ||||||
|         call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) |         call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) | ||||||
|        endif |        endif | ||||||
| @@ -11193,16 +11193,16 @@ fun! s:LocalListing() | |||||||
| "   call Decho("pfile   <".pfile.">",'~'.expand("<slnum>")) | "   call Decho("pfile   <".pfile.">",'~'.expand("<slnum>")) | ||||||
|  |  | ||||||
|    if w:netrw_liststyle == s:LONGLIST |    if w:netrw_liststyle == s:LONGLIST | ||||||
|     let longfile= printf("%-".g:netrw_maxfilenamelen."S",pfile) |     let longfile = printf("%-".g:netrw_maxfilenamelen."S",pfile) | ||||||
|     let sz   = getfsize(filename) |     let sz       = getfsize(filename) | ||||||
| 	let szlen = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen) |     let szlen    = 15 - (strdisplaywidth(longfile) - g:netrw_maxfilenamelen) | ||||||
|     let szlen = (szlen > 0) ? szlen : 0 |     let szlen    = (szlen > 0) ? szlen : 0 | ||||||
|  |  | ||||||
|     if g:netrw_sizestyle =~# "[hH]" |     if g:netrw_sizestyle =~# "[hH]" | ||||||
|      let sz= s:NetrwHumanReadable(sz) |      let sz= s:NetrwHumanReadable(sz) | ||||||
|     endif |     endif | ||||||
|     let fsz  = printf("%".szlen."S",sz) |     let fsz  = printf("%".szlen."S",sz) | ||||||
|     let pfile   = longfile."  ".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) |     let pfile= longfile."  ".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) | ||||||
| "    call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) | "    call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) | ||||||
|    endif |    endif | ||||||
|  |  | ||||||
| @@ -12222,7 +12222,7 @@ fun! s:NetrwLcd(newdir) | |||||||
|      if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin |      if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin | ||||||
|        if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+' |        if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+' | ||||||
|          let dirname = '\' |          let dirname = '\' | ||||||
| 	 exe 'NetrwKeepj sil lcd '.fnameescape(dirname) |          exe 'NetrwKeepj sil lcd '.fnameescape(dirname) | ||||||
|        endif |        endif | ||||||
|      endif |      endif | ||||||
|   catch /^Vim\%((\a\+)\)\=:E472/ |   catch /^Vim\%((\a\+)\)\=:E472/ | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| *pi_netrw.txt*  For Vim version 9.1.  Last change: 2023 May 14 | *pi_netrw.txt*  For Vim version 9.1.  Last change: 2023 Jun 19 | ||||||
|  |  | ||||||
| 	    ------------------------------------------------ | 	    ------------------------------------------------ | ||||||
| 	    NETRW REFERENCE MANUAL    by Charles E. Campbell | 	    NETRW REFERENCE MANUAL    by Charles E. Campbell | ||||||
| @@ -1625,10 +1625,8 @@ A further approach is to delete files which match a pattern. | |||||||
|       This will cause the matching files to be marked.  Then, |       This will cause the matching files to be marked.  Then, | ||||||
|       press "D". |       press "D". | ||||||
|  |  | ||||||
| If your vim has 7.4 with patch#1107, then |g:netrw_localrmdir| no longer | Please note that only empty directories may be deleted with the "D" mapping. | ||||||
| is used to remove directories; instead, vim's |delete()| is used with | Regular files are deleted with |delete()|, too. | ||||||
| the "d" option.  Please note that only empty directories may be deleted |  | ||||||
| with the "D" mapping.  Regular files are deleted with |delete()|, too. |  | ||||||
|  |  | ||||||
| The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are | The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are | ||||||
| used to control the attempts to remove remote files and directories.  The | used to control the attempts to remove remote files and directories.  The | ||||||
| @@ -1647,8 +1645,7 @@ to remove it again using the g:netrw_rmf_cmd variable.  Its default value is: | |||||||
| 	|g:netrw_rmf_cmd|: ssh HOSTNAME rm -f | 	|g:netrw_rmf_cmd|: ssh HOSTNAME rm -f | ||||||
|  |  | ||||||
| Related topics: |netrw-d| | Related topics: |netrw-d| | ||||||
| Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd| | Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd| | ||||||
|                              |g:netrw_rmdir_cmd|   |g:netrw_ssh_cmd| |  | ||||||
|  |  | ||||||
|  |  | ||||||
| *netrw-explore*  *netrw-hexplore* *netrw-nexplore* *netrw-pexplore* | *netrw-explore*  *netrw-hexplore* *netrw-nexplore* *netrw-pexplore* | ||||||
| @@ -1691,7 +1688,11 @@ DIRECTORY EXPLORATION COMMANDS  {{{2 | |||||||
| 	  to 2; edits will thus preferentially be made in window#2. | 	  to 2; edits will thus preferentially be made in window#2. | ||||||
|  |  | ||||||
| 	  The [N] specifies a |g:netrw_winsize| just for the new :Lexplore | 	  The [N] specifies a |g:netrw_winsize| just for the new :Lexplore | ||||||
| 	  window. | 	  window. That means that | ||||||
|  | 	    if [N] < 0 : use |N| columns for the Lexplore window | ||||||
|  | 	    if [N] = 0 : a normal split is made | ||||||
|  | 	    if [N] > 0 : use N% of the current window will be used for the | ||||||
|  | 	                 new window | ||||||
|  |  | ||||||
| 	  Those who like this method often also like tree style displays; | 	  Those who like this method often also like tree style displays; | ||||||
| 	  see |g:netrw_liststyle|. | 	  see |g:netrw_liststyle|. | ||||||
| @@ -2863,14 +2864,6 @@ your browsing preferences.  (see also: |netrw-settings|) | |||||||
| 				=" /c move"                     Windows | 				=" /c move"                     Windows | ||||||
| 				Options for |g:netrw_localmovecmd| | 				Options for |g:netrw_localmovecmd| | ||||||
|  |  | ||||||
|   *g:netrw_localrmdir*		="rmdir"        Linux/Unix/MacOS/Cygwin |  | ||||||
| 				=expand("$COMSPEC")             Windows |  | ||||||
| 				Remove directory command (rmdir) |  | ||||||
| 				This variable is only used if your vim is |  | ||||||
| 				earlier than 7.4 or if your vim doesn't |  | ||||||
| 				have patch#1107.  Otherwise, |delete()| |  | ||||||
| 				is used with the "d" option. |  | ||||||
|  |  | ||||||
|   *g:netrw_maxfilenamelen*	=32 by default, selected so as to make long |   *g:netrw_maxfilenamelen*	=32 by default, selected so as to make long | ||||||
| 				    listings fit on 80 column displays. | 				    listings fit on 80 column displays. | ||||||
| 				If your screen is wider, and you have file | 				If your screen is wider, and you have file | ||||||
| @@ -3781,7 +3774,7 @@ Example: Clear netrw's marked file list via a mapping on gu > | |||||||
| 	     Netrw uses several system level commands to do things (see | 	     Netrw uses several system level commands to do things (see | ||||||
|  |  | ||||||
| 		 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, | 		 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, | ||||||
| 		 |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|). | 		 |g:netrw_mkdir_cmd|). | ||||||
|  |  | ||||||
| 	    You may need to adjust the default commands for one or more of | 	    You may need to adjust the default commands for one or more of | ||||||
| 	    these commands by setting them properly in your .vimrc.  Another | 	    these commands by setting them properly in your .vimrc.  Another | ||||||
| @@ -3907,8 +3900,13 @@ netrw: | |||||||
| ============================================================================== | ============================================================================== | ||||||
| 12. History						*netrw-history* {{{1 | 12. History						*netrw-history* {{{1 | ||||||
|  |  | ||||||
| 	v172:	Apr 22, 2023	* removed g:netrw_localrmdiropt | 	v172:	Sep 02, 2021	* (Bram Moolenaar) Changed "l:go" to "go" | ||||||
| 				  removed g:netrw_localrmdir | 				* (Bram Moolenaar) no need for "b" in | ||||||
|  | 				  netrw-safe guioptions | ||||||
|  | 		Nov 15, 2021	* removed netrw_localrm and netrw_localrmdir | ||||||
|  | 				  references | ||||||
|  | 		Aug 18, 2022	* (Miguel Barro) improving compatability with | ||||||
|  | 				  powershell | ||||||
| 	v171:	Oct 09, 2020	* included code in s:NetrwOptionsSafe() | 	v171:	Oct 09, 2020	* included code in s:NetrwOptionsSafe() | ||||||
| 				  to allow |'bh'| to be set to delete when | 				  to allow |'bh'| to be set to delete when | ||||||
| 				  rather than hide when g:netrw_fastbrowse | 				  rather than hide when g:netrw_fastbrowse | ||||||
| @@ -3996,7 +3994,6 @@ netrw: | |||||||
| 				  |g:netrw_localcopydircmdopt| | 				  |g:netrw_localcopydircmdopt| | ||||||
| 				  |g:netrw_localmkdiropt| | 				  |g:netrw_localmkdiropt| | ||||||
| 				  |g:netrw_localmovecmdopt| | 				  |g:netrw_localmovecmdopt| | ||||||
| 				  g:netrw_localrmdiropt |  | ||||||
| 		Nov 21, 2016	* (mattn) provided a patch for preview; swapped | 		Nov 21, 2016	* (mattn) provided a patch for preview; swapped | ||||||
| 				  winwidth() with winheight() | 				  winwidth() with winheight() | ||||||
| 		Nov 22, 2016	* (glacambre) reported that files containing | 		Nov 22, 2016	* (glacambre) reported that files containing | ||||||
| @@ -4056,7 +4053,7 @@ netrw: | |||||||
| 				  refreshes.  However, inside a |:map-<expr>|, | 				  refreshes.  However, inside a |:map-<expr>|, | ||||||
| 				  tab and window changes are disallowed.  Fixed. | 				  tab and window changes are disallowed.  Fixed. | ||||||
| 				  (affects netrw's s:LocalBrowseRefresh()) | 				  (affects netrw's s:LocalBrowseRefresh()) | ||||||
| 				* |g:netrw_localrmdir| not used any more, but | 				* g:netrw_localrmdir not used any more, but | ||||||
| 				  the relevant patch that causes |delete()| to | 				  the relevant patch that causes |delete()| to | ||||||
| 				  take over was #1107 (not #1109). | 				  take over was #1107 (not #1109). | ||||||
| 				* |expand()| is now used on |g:netrw_home|; | 				* |expand()| is now used on |g:netrw_home|; | ||||||
|   | |||||||
| @@ -7535,7 +7535,6 @@ g:netrw_localmkdir	pi_netrw.txt	/*g:netrw_localmkdir* | |||||||
| g:netrw_localmkdiropt	pi_netrw.txt	/*g:netrw_localmkdiropt* | g:netrw_localmkdiropt	pi_netrw.txt	/*g:netrw_localmkdiropt* | ||||||
| g:netrw_localmovecmd	pi_netrw.txt	/*g:netrw_localmovecmd* | g:netrw_localmovecmd	pi_netrw.txt	/*g:netrw_localmovecmd* | ||||||
| g:netrw_localmovecmdopt	pi_netrw.txt	/*g:netrw_localmovecmdopt* | g:netrw_localmovecmdopt	pi_netrw.txt	/*g:netrw_localmovecmdopt* | ||||||
| g:netrw_localrmdir	pi_netrw.txt	/*g:netrw_localrmdir* |  | ||||||
| g:netrw_maxfilenamelen	pi_netrw.txt	/*g:netrw_maxfilenamelen* | g:netrw_maxfilenamelen	pi_netrw.txt	/*g:netrw_maxfilenamelen* | ||||||
| g:netrw_menu	pi_netrw.txt	/*g:netrw_menu* | g:netrw_menu	pi_netrw.txt	/*g:netrw_menu* | ||||||
| g:netrw_mkdir_cmd	pi_netrw.txt	/*g:netrw_mkdir_cmd* | g:netrw_mkdir_cmd	pi_netrw.txt	/*g:netrw_mkdir_cmd* | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user