aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-11 15:52:11 +0800
committerGitHub <noreply@github.com>2024-11-11 07:52:11 +0000
commit7906532e08a09b7ab29990bc67f719a07576fe51 (patch)
tree251c2c97884014d5e38bf54f0a077f8000cc21a3
parentf37d29077527a7d89a845270a71ae885dee4538d (diff)
downloadrneovim-7906532e08a09b7ab29990bc67f719a07576fe51.tar.gz
rneovim-7906532e08a09b7ab29990bc67f719a07576fe51.tar.bz2
rneovim-7906532e08a09b7ab29990bc67f719a07576fe51.zip
vim-patch:5b63b23: runtime(netrw): directory symlink not resolved in tree view (#31161)
closes: vim/vim#16020 https://github.com/vim/vim/commit/5b63b236a0af198f6c3c9883a3f6344b110dabb3 Co-authored-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--runtime/autoload/netrw.vim7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index a861914fef..f32367ffd8 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -34,6 +34,7 @@
" 2024 Oct 31 by Vim Project: fix E874 when browsing remote dir (#15964)
" 2024 Nov 07 by Vim Project: use keeppatterns to prevent polluting the search history
" 2024 Nov 07 by Vim Project: fix a few issues with netrw tree listing (#15996)
+" 2024 Nov 10 by Vim Project: directory symlink not resolved in tree view (#16020)
" }}}
" Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
@@ -4580,6 +4581,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,cursor,...)
if a:cursor && exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treetop")
" dirname is the path to the word under the cursor
let dirname = s:NetrwTreePath(w:netrw_treetop)
+ " newdir resolves to a directory and points to a directory in dirname
+ " /tmp/test/folder_symlink/ -> /tmp/test/original_folder/
+ if a:islocal && fnamemodify(dirname, ':t') == newdir && isdirectory(resolve(dirname)) && resolve(dirname) == resolve(newdir)
+ let dirname = fnamemodify(resolve(dirname), ':p:h:h')
+ let newdir = fnamemodify(resolve(newdir), ':t')
+ endif
" Remove trailing "/"
let dirname = substitute(dirname, "/$", "", "")