runtime(netrw): handle file/dir symlinks specifically in tree mode
Commit:
https://github.com/vim/vim/commit/56b7da3c051fe1a5fd76534998c17b22d83c0899
Author: Christian Brabandt <[email protected]>
Date: Thu Feb 29 17:48:14 2024 +0100
runtime(netrw): handle file/dir symlinks specifically in tree mode
fixes: https://github.com/vim/vim/issues/2386
related: https://github.com/vim/vim/issues/3609
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 0508dcae3..850e5a40f 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -9476,7 +9476,7 @@ fun! s:NetrwTreeDir(islocal)
" call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
elseif curline =~ '@$'
" call Decho("handle symbolic link from current line",'~'.expand("<slnum>"))
- let treedir=
resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e'))
+ let potentialdir=
resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e'))
" call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
else
" call Decho("do not extract tree subdirectory from current line and set
treedir to empty",'~'.expand("<slnum>"))
@@ -9501,7 +9501,6 @@ fun! s:NetrwTreeDir(islocal)
" call Decho("COMBAK#23 : mod=".&mod." win#".winnr())
" call Decho("islocal=".a:islocal."
curline<".curline.">",'~'.expand("<slnum>"))
- let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+
\(.*\)@$',' ',''))
" call Decho("potentialdir<".potentialdir.">
isdir=".isdirectory(potentialdir),'~'.expand("<slnum>"))
" call Decho("COMBAK#24 : mod=".&mod." win#".winnr())
@@ -9514,8 +9513,15 @@ fun! s:NetrwTreeDir(islocal)
" " call Decho("newdir <".newdir.">",'~'.expand("<slnum>"))
" else
" call Decho("apply NetrwTreePath to
treetop<".w:netrw_treetop.">",'~'.expand("<slnum>"))
- let treedir = s:NetrwTreePath(w:netrw_treetop)
-" endif
+ if a:islocal && curline =~ '@$'
+ if isdirectory(s:NetrwFile(potentialdir))
+ let treedir = w:netrw_treetop.'/'.potentialdir.'/'
+ let w:netrw_treetop = treedir
+ endif
+ else
+ let potentialdir=
s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$',' ',''))
+ let treedir = s:NetrwTreePath(w:netrw_treetop)
+ endif
endif
" call Decho("COMBAK#25 : mod=".&mod." win#".winnr())
--
--
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 on the web visit
https://groups.google.com/d/msgid/vim_dev/E1rfjlN-0095Gw-OW%40256bit.org.