]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0792: runtime(netrw): Explore without optional dir broken v9.2.0792
authorMark Woods <mwoods.online.ie@gmail.com>
Sat, 18 Jul 2026 13:25:17 +0000 (13:25 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 18 Jul 2026 13:25:17 +0000 (13:25 +0000)
Problem:  runtime(netrw): Explore without optional [dir] argument should
          open directory of the current file
Solution: Make it work as documented (Mark Woods)

Broken by fix for #20636 in PR #20663

related: #20663
closes:  #20761

Signed-off-by: Mark Woods <mwoods.online.ie@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/netrw/autoload/netrw.vim
src/testdir/test_plugin_netrw.vim
src/version.c

index d82dd907689e0c9d5b4f13cc435672bdb6e10e41..bbb2deb00fe134efb1615bdaac617ecaf2877e05 100644 (file)
@@ -1,7 +1,7 @@
 " Creator:    Charles E Campbell
 " Previous Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
 " Maintainer: This runtime file is looking for a new maintainer.
-" Last Change: 2026 Jul 17
+" Last Change: 2026 Jul 18
 " 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
@@ -571,6 +571,9 @@ function netrw#Explore(indx,dosplit,style,...)
   endif
 
   if starpat == 0 && a:indx >= 0
+    if dirname == ""
+      let dirname= curfiledir
+    endif
     " [Explore Hexplore Vexplore Sexplore] [dirname]
     if dirname =~# '^scp://' || dirname =~ '^ftp://'
       call netrw#Nread(2,dirname)
index a6dcf33e042a57a81ff50f5853391cf2334aebee..2530b0a70fc9fd6c08ea4a8f279c6f8e4527cd24 100644 (file)
@@ -901,4 +901,15 @@ func Test_netrw_open_backslash_file()
   bw!
 endfunc
 
+" :Explore without a [dir] argument should open the dir of the current file
+func Test_netrw_open_no_dir_arg()
+  let dir = tempname()
+  call mkdir(dir, 'pR')
+  call writefile([], dir . '/foo')
+  exe 'edit ' . dir . '/foo'
+  Explore
+  call assert_equal(fnamemodify(dir, ':p'), fnamemodify(b:netrw_curdir, ':p'))
+  bw!
+endfunc
+
 " vim:ts=8 sts=2 sw=2 et
index 77d596c04e6d207d7d1252f3caca45bf850df20e..9118c769d828996a7f59adde05bfb0fda4236039 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    792,
 /**/
     791,
 /**/