diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim b/runtime/pack/dist/opt/netrw/autoload/netrw.vim index cabcd0c925..c1f7b55c85 100644 --- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim +++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim @@ -1,7 +1,7 @@ " Creator: Charles E Campbell " Previous Maintainer: Luca Saccarola " Maintainer: This runtime file is looking for a new maintainer. -" Last Change: 2026 Jul 23 +" Last Change: 2026 Aug 19 " 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 diff --git a/test/old/testdir/test_plugin_netrw.vim b/test/old/testdir/test_plugin_netrw.vim index b6a18ff418..0a5e594ad8 100644 --- a/test/old/testdir/test_plugin_netrw.vim +++ b/test/old/testdir/test_plugin_netrw.vim @@ -196,6 +196,11 @@ function Test_NetrwMarkFile_match_pattern_rebuild() bw endfunction + +" Test the "home" directory used for bookmarks and history +function Test_NetrwHome() abort + return s:NetrwHome() +endfunction " }}} END @@ -921,4 +926,39 @@ func Test_netrw_open_no_dir_arg() bw! endfunc +func Test_netrw_home_setting() + let save_home = get(g:, 'netrw_home', '') + let dir = fnamemodify('XnetrwHome', ':p:h') + if has('win32') + let dir = substitute(dir, '/', '\\', 'g') + endif + + if has('nvim') + unlet! g:netrw_home + call assert_equal(netrw#fs#PathJoin(stdpath('state'), 'netrw'), Test_NetrwHome()) + endif + + let g:netrw_home = dir + call assert_equal(dir, Test_NetrwHome()) + call assert_true(isdirectory(dir)) + + " the value is expanded + let $NETRW_TEST_HOME = dir + let g:netrw_home = '$NETRW_TEST_HOME' + call assert_equal(dir, Test_NetrwHome()) + + " without the setting $MYVIMDIR is used + unlet g:netrw_home + let $MYVIMDIR = dir + call assert_equal(dir, Test_NetrwHome()) + + call delete(dir, 'd') + let $NETRW_TEST_HOME = '' + if empty(save_home) + unlet! g:netrw_home + else + let g:netrw_home = save_home + endif +endfunc + " vim:ts=8 sts=2 sw=2 et