runtime(netrw): fix s:NetrwHome() regression
Commit:
https://github.com/vim/vim/commit/ee1a24b21d10903ee4369d1df514af9eb4c400a6
Author: Luca Saccarola <[email protected]>
Date: Tue Feb 18 20:11:51 2025 +0100
runtime(netrw): fix s:NetrwHome() regression
If $MYVIMDIR is unset netrw creates a directory called '$MYVIMDIR' in
the current directory
fixes: #16609
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 215ab618f..71310028f 100644
--- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -5297,30 +5297,32 @@ endfun
" ---------------------------------------------------------------------
" s:NetrwHome: this function determines a "home" for saving bookmarks and
history {{{2
function! s:NetrwHome()
- if has('nvim')
- let home = netrw#own#PathJoin(stdpath('state'), 'netrw')
- elseif exists("g:netrw_home")
- let home = expand(g:netrw_home)
- else
- let home = expand("$MYVIMDIR")->substitute("/$", "", "")
- endif
-
- " insure that the home directory exists
- if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home))
- if exists("g:netrw_mkdir")
- call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)))
+ if has('nvim')
+ let home = netrw#own#PathJoin(stdpath('state'), 'netrw')
+ elseif exists('g:netrw_home')
+ let home = expand(g:netrw_home)
+ elseif exists('$MYVIMDIR')
+ let home = expand('$MYVIMDIR')->substitute('/$', '', '')
else
- call mkdir(home)
+ let home = netrw#own#PathJoin(expand('~'), '.vim')
endif
- endif
- " Normalize directory if on Windows
- if has("win32")
- let home = substitute(home, '/', '\', 'g')
- endif
+ " insure that the home directory exists
+ if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home))
+ if exists("g:netrw_mkdir")
+ call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)))
+ else
+ call mkdir(home)
+ endif
+ endif
+
+ " Normalize directory if on Windows
+ if has("win32")
+ let home = substitute(home, '/', '\', 'g')
+ endif
- let g:netrw_home = home
- return home
+ let g:netrw_home = home
+ return home
endfunction
" ---------------------------------------------------------------------
--
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1tkT3l-00Gehg-8j%40256bit.org.