vim-patch:5bf41e7: runtime(netrw): update regex to handle remote archives (#35822)

closes: vim/vim#18318

5bf41e7418

Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
This commit is contained in:
zeertzjq
2025-09-18 08:01:33 +08:00
committed by GitHub
parent b5e6f44c08
commit 3c480fca57

View File

@@ -7,6 +7,7 @@
" 2025 Aug 22 by Vim Project netrw#Explore handle terminal correctly #18069
" 2025 Sep 05 by Vim Project ensure netrw#fs#Dirname() returns trailing slash #18199
" 2025 Sep 11 by Vim Project only keep cursor position in tree mode #18275
" 2025 Sep 17 by Vim Project tighten the regex to handle remote compressed archives #18318
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
@@ -3048,12 +3049,12 @@ function s:NetrwBrowse(islocal,dirname)
exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname)
sil call netrw#NetRead(2,url)
" netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error
if s:path =~ '.bz2'
if s:path =~ '\.bz2$'
exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','',''))
elseif s:path =~ '.gz'
elseif s:path =~ '\.gz$'
exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','',''))
elseif s:path =~ '.gz'
exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','',''))
elseif s:path =~ '\.xz$'
exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.xz$','',''))
else
exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(s:fname)
endif