Scenario 1
To reproduce:
Expected result: switch to file 1's buffer
Actual result: E23: No alternate file
Scenario 2
Expected result: switch to file 1's buffer
Actual result: switch to netrw browser buffer
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
This is just a guess (couldn't locate the relevant code), but for scenario 1 the issue may be that "keepalt" is used when the netrw browser is opened. Since there is no alternate buffer initially (when vim is opened to the empty buffer) and since netrw_altfile = 1 causes "keepalt" to be used when opening file 1 and then file 2, the non-existent alternate buffer is "keepalt"ed all the way through the sequence of operations.
If the above guess is correct, perhaps a solution would be to not use "keepalt" to open the netrw browser when netrw_altfile is 1.
@cecamp Any thoughts on this issue?
I'm willing to try to diagnose it further, just need some general guidance
Scenario 1
I think this patch would fix the issue:
diff --git a/autoload/netrw.vim b/autoload/netrw.vim index d095f6d..04aef12 100644 --- a/autoload/netrw.vim +++ b/autoload/netrw.vim @@ -4279,7 +4279,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum else " call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum,'~'.expand("<slnum>")) - exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum + exe "sil! NetrwKeepj noswapfile b ".bufnum endif " call Decho(" line($)=".line("$"),'~'.expand("<slnum>")) if bufname("%") == '.' @@ -11883,7 +11883,7 @@ fun! s:NetrwEnew(...) " COMBAK: this causes a problem, see P43 " setl nobl let netrw_keepdiff= &l:diff - noswapfile NetrwKeepj keepalt enew! + noswapfile NetrwKeepj enew! let &l:diff= netrw_keepdiff " call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("<slnum>")) NetrwKeepj call s:NetrwOptionsSave("w:")
Scenario 2
I'm not sure this behavior is guaranteed by the current documentation.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
![]()