mirror of
https://github.com/vim/vim.git
synced 2025-09-06 21:53:38 -04:00
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 <cb@256bit.org>
This commit is contained in:
parent
44c1c04ddb
commit
ee1a24b21d
42
runtime/pack/dist/opt/netrw/autoload/netrw.vim
vendored
42
runtime/pack/dist/opt/netrw/autoload/netrw.vim
vendored
@ -5297,30 +5297,32 @@ endfun
|
|||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2
|
" s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2
|
||||||
function! s:NetrwHome()
|
function! s:NetrwHome()
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
let home = netrw#own#PathJoin(stdpath('state'), 'netrw')
|
let home = netrw#own#PathJoin(stdpath('state'), 'netrw')
|
||||||
elseif exists("g:netrw_home")
|
elseif exists('g:netrw_home')
|
||||||
let home = expand(g:netrw_home)
|
let home = expand(g:netrw_home)
|
||||||
else
|
elseif exists('$MYVIMDIR')
|
||||||
let home = expand("$MYVIMDIR")->substitute("/$", "", "")
|
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)))
|
|
||||||
else
|
else
|
||||||
call mkdir(home)
|
let home = netrw#own#PathJoin(expand('~'), '.vim')
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
" Normalize directory if on Windows
|
" insure that the home directory exists
|
||||||
if has("win32")
|
if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home))
|
||||||
let home = substitute(home, '/', '\\', 'g')
|
if exists("g:netrw_mkdir")
|
||||||
endif
|
call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)))
|
||||||
|
else
|
||||||
|
call mkdir(home)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let g:netrw_home = home
|
" Normalize directory if on Windows
|
||||||
return home
|
if has("win32")
|
||||||
|
let home = substitute(home, '/', '\\', 'g')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:netrw_home = home
|
||||||
|
return home
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user