Commit: runtime(netrw): only keep cursor position in tree listing mode

1 view
Skip to first unread message

Christian Brabandt

unread,
Sep 11, 2025, 3:30:13 PMSep 11
to vim...@googlegroups.com
runtime(netrw): only keep cursor position in tree listing mode

Commit: https://github.com/vim/vim/commit/9e100b8d14ceb562bcb2c60033a3d92ec4d2c126
Author: Tom Benham <tom.be...@gmail.com>
Date: Thu Sep 11 15:15:43 2025 -0400

runtime(netrw): only keep cursor position in tree listing mode

fixes: https://github.com/vim/vim/issues/16255
closes: https://github.com/vim/vim/issues/18275

Signed-off-by: Tom Benham <tom.be...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 6863c222d..0168d2348 100644
--- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -6,6 +6,7 @@
" 2025 Aug 07 by Vim Project (netrw#BrowseX() distinguishes remote files #17794)
" 2025 Aug 22 by Vim Project netrw#Explore handle terminal correctly #18069
" 2025 Sep 05 by Vim Project ensure netrw#fs#Dirname() returns trailing slash #18199
+" 2025 Sep 11 by Vim Project only keep cursor position in tree mode #18275
" 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
@@ -3083,7 +3084,7 @@ function s:NetrwBrowse(islocal,dirname)
" previous buffer
let prevbufnr = bufnr('%')
let reusing= s:NetrwGetBuffer(a:islocal,dirname)
- if exists("s:rexposn_".prevbufnr)
+ if exists("s:rexposn_".prevbufnr) && exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
let s:rexposn_{bufnr('%')} = s:rexposn_{prevbufnr}
endif

Reply all
Reply to author
Forward
0 new messages