Resolves #7773.
When using :mkview on a file when working with other files open in buffers, Vim saves the alternate file for a file in the view file (the exact command is :balt), that is opened when calling :loadview. This means that when I load the view for a file in a different session, Vim open the alternate file in a new buffer automatically.
This behaviour wasn't present before, and it's annoying when it automatically opens a random file that happened to be the alternate file when I was using Vim previously.
Therefore, I've added an option balt in viewoptions to control this. If balt is not present in viewoptions, then the alternate file isn't saved to the view file. I've then set the default value for viewoptions to folds,options,cursor,curdir,balt, so that the default behaviour isn't affected. Therefore I can simply use set viewoptions-=balt in my vimrc to disable this, while others wouldn't be affected.
I've also added some documentation and a test for this.
https://github.com/vim/vim/pull/7779
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Merging #7779 (2ca1bf0) into master (92bb83e) will decrease coverage by
86.21%.
The diff coverage is0.00%.
@@ Coverage Diff @@ ## master #7779 +/- ## =========================================== - Coverage 88.70% 2.48% -86.22% =========================================== Files 148 146 -2 Lines 164696 159614 -5082 =========================================== - Hits 146088 3964 -142124 - Misses 18608 155650 +137042
| Flag | Coverage Δ | |
|---|---|---|
| huge-clang-none | ? |
|
| huge-gcc-none | ? |
|
| huge-gcc-unittests | 2.48% <0.00%> (-0.01%) |
⬇️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/optionstr.c | 21.79% <ø> (-72.80%) |
⬇️ |
| src/session.c | 0.00% <0.00%> (-81.75%) |
⬇️ |
| src/sha256.c | 0.00% <0.00%> (-97.96%) |
⬇️ |
| src/digraph.c | 0.00% <0.00%> (-97.78%) |
⬇️ |
| src/gui_gtk_f.c | 0.00% <0.00%> (-97.54%) |
⬇️ |
| src/crypt_zip.c | 0.00% <0.00%> (-97.06%) |
⬇️ |
| src/debugger.c | 0.00% <0.00%> (-96.62%) |
⬇️ |
| src/libvterm/src/rect.h | 0.00% <0.00%> (-96.56%) |
⬇️ |
| src/evalbuffer.c | 0.00% <0.00%> (-96.29%) |
⬇️ |
| src/cmdhist.c | 0.00% <0.00%> (-96.07%) |
⬇️ |
| ... and 136 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update 92bb83e...9039ad9. Read the comment docs.
When you say " Vim open the alternate file in a new buffer automatically" I suppose you mean that a buffer is added to the buffer list. No window is opened, right?
Saving the alternate file was implemented in 8.2.1967. But this was intended for the session file. It just happened to also affect ":mkview". One possibility is to not set the alternate file for :mkview, only do this when writing the session file.
Hmm, it actually sets the alternate file after editing the file the view is for, thus you can't go back to the original file.
So yes, we should not set the alternate file for :mkview. Can you adjust the pull request for that?
When you say " Vim open the alternate file in a new buffer automatically" I suppose you mean that a buffer is added to the buffer list. No window is opened, right?
Yes, you're right. It keeps the window, but the alternate file is added to the buffer list.
So yes, we should not set the alternate file for :mkview. Can you adjust the pull request for that?
Sure, I'll do this. I'll remove the balt viewoption and adapt the test.
@rharish101 pushed 1 commit.
—
You are receiving this because you are subscribed to this thread.