Skip to content

Commit 6a6a44f

Browse files
committed
runtime(netrw): netrw#BrowseX() needs to distinguish local and remote file
fixes: #17794 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 66d8d28 commit 6a6a44f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • runtime/pack/dist/opt/netrw/autoload

runtime/pack/dist/opt/netrw/autoload/netrw.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
" Maintainer: This runtime file is looking for a new maintainer.
44
" Last Change:
55
" 2025 Aug 07 by Vim Project (use correct "=~#" for netrw_stylesize option #17901)
6+
" 2025 Aug 07 by Vim Project (netrw#BrowseX() distinguishes remote files #17794)
67
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
78
" Permission is hereby granted to use and distribute this code,
89
" with or without modifications, provided that this copyright
@@ -4125,7 +4126,7 @@ function s:NetrwBrowseUpDir(islocal)
41254126
endfunction
41264127

41274128
" netrw#BrowseX: (implements "x") executes a special "viewer" script or program for the {{{2
4128-
" given filename; typically this means given their extension.
4129+
" given filename; typically this means given their extension.
41294130
function netrw#BrowseX(fname)
41304131
" special core dump handler
41314132
if a:fname =~ '/core\(\.\d\+\)\=$' && exists("g:Netrw_corehandler")
@@ -4149,7 +4150,12 @@ function netrw#BrowseX(fname)
41494150
let fname = substitute(fname, '^\~', expand("$HOME"), '')
41504151
endif
41514152

4152-
call netrw#os#Open(s:NetrwFile(fname))
4153+
if fname =~ '^[a-z]\+://'
4154+
" open a remote file
4155+
call netrw#os#Open(fname)
4156+
else
4157+
call netrw#os#Open(s:NetrwFile(fname))
4158+
endif
41534159
endfunction
41544160

41554161
" s:NetrwBufRename: renames a buffer without the side effect of retaining an unlisted buffer having the old name {{{2

0 commit comments

Comments
 (0)