As title. In fact, I just encountered a situation where I cannot change the buffer of the current window, which is created by some plugin. So I guess there might be some window/buffer option(s) to prevent the current buffer from being changed.
In short, there is no built-in option to prevent you from switching(I used the word changing and now I think that is misleading since my question is not about changing the content of a file) the buffer of a given window. (Since the repo. has <200 commits there, so I read through those commit messages and found the one that caused the behavior.)
In that commit, the author uses a function that will be called on two
autocmds under a
BufWinEnter,BufWinLeave to achieve the behavior described in my OP. (This might be a piece of useful information if you want to implement the reverse: prevent switching the buffer of a given window, as the commit did.) By deleting that
augroup I get the original behavior I want. (Regarding the LICENSE of that Repo., I won't post the code here.)