runtime(netrw): simplify gx file handling

Commit: 
https://github.com/vim/vim/commit/3d7e567ea7392e43a90a6ffb3cd49b71a7b59d1a
Author: Konfekt <konf...@users.noreply.github.com>
Date:   Sun Oct 27 22:16:49 2024 +0100

    runtime(netrw): simplify gx file handling
    
    It did not work very well, at least on Debian 12, and I am not sure Git
    Bash and WSL, for example, were taken care of as maintenance stalled.
    
    The whole logic was somewhat convoluted with some parts repeatedly invoking
    failed commands.
    
    The file handling was outdated, for example, nowadays Netscape is rarely
    used, and also opinionated, for example mainly Microsoft Paint and Gimp for
    Image files.
    
    Instead, let's use (xdg-)open and similar commands on other systems
    which respects the user's preferences.
    
    closes: #15721
    
    Co-authored-by: Luca Saccarola 
<96259932+saccaros...@users.noreply.github.com>
    Signed-off-by: Konfekt <konf...@users.noreply.github.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 0adcc6586..e09716de1 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -27,6 +27,7 @@
 "   2024 Sep 19 by Vim Project: mf-selection highlight uses wrong pattern 
(#15700)
 "   2024 Sep 21 by Vim Project: remove extraneous closing bracket (#15718)
 "   2024 Oct 21 by Vim Project: remove netrwFileHandlers (#15895)
+"   2024 Oct 27 by Vim Project: clean up gx mapping (#15721)
 "   }}}
 " Former Maintainer:   Charles E Campbell
 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
@@ -538,7 +539,6 @@ if !exists("g:netrw_sort_sequence")
 endif
 call s:NetrwInit("g:netrw_special_syntax"   , 0)
 call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$')
-call s:NetrwInit("g:netrw_suppress_gx_mesg",  1)
 call s:NetrwInit("g:netrw_use_noswf"        , 1)
 call s:NetrwInit("g:netrw_sizestyle"        ,"b")
 " Default values - t-w ---------- {{{3
@@ -5406,25 +5406,6 @@ fun! netrw#BrowseX(fname,remote)
 "  call Decho("fname<".fname.">",'~'.expand("<slnum>"))
 "  call Decho("exten<".exten."> 
"."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("<slnum>"))
 
-  " set up redirection (avoids browser messages)
-  " by default, g:netrw_suppress_gx_mesg is true
-  if g:netrw_suppress_gx_mesg
-   if &srr =~ "%s"
-    if has("win32")
-     let redir= substitute(&srr,"%s","nul","")
-    else
-     let redir= substitute(&srr,"%s","/dev/null","")
-    endif
-   elseif has("win32")
-    let redir= &srr . "nul"
-   else
-    let redir= &srr . "/dev/null"
-   endif
-  else
-   let redir= ""
-  endif
-"  call Decho("set up redirection: redir{".redir."} 
srr{".&srr."}",'~'.expand("<slnum>"))
-
   " extract any viewing options.  Assumes that they're set apart by spaces.
   if exists("g:netrw_browsex_viewer")
 "   call Decho("extract any viewing options from 
g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
@@ -5447,86 +5428,14 @@ fun! netrw#BrowseX(fname,remote)
 "   call Decho("viewer<".viewer.">  
viewopt<".viewopt.">",'~'.expand("<slnum>"))
   endif
 
-  " execute the file handler
-"  call Decho("execute the file handler (if any)",'~'.expand("<slnum>"))
   if exists("g:netrw_browsex_viewer") && executable(viewer)
 "   call Decho("(netrw#BrowseX) 
g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
-   call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir)
-   let ret= v:shell_error
-
-  elseif has("win32")
-"   call Decho("(netrw#BrowseX) win".(has("win32")? "32" : 
"64"),'~'.expand("<slnum>"))
-   if executable("start")
-    call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler 
'.s:ShellEscape(fname,1))
-   elseif executable("rundll32")
-    call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler 
'.s:ShellEscape(fname,1))
-   else
-    call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
-   endif
-   let ret= v:shell_error
-
-  elseif has("win32unix")
-   let winfname= 'c:

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1t5Apn-00BxAF-Bt%40256bit.org.

Raspunde prin e-mail lui