Others will probably give you answers that more directly respond to your question. My answer is to just move the focus to the window you want and then use C-x C-f
or whatever to open the file or display the buffer you want in that selected window.
In order to do what you requested directly, you need anyway to use a key sequence that invokes the command you want. And if you want something general that works with different commands (e.g. find-file
and switch-to-buffer
) then you need to use a prefix key or repurpose the prefix arg. That is typically just as many key strokes as it is to switch to the window and then use the usual command.
Of course, with my suggestion you need a command to quickly switch to the window you want. There are various commands out there that let you cycle among windows or use completion to quickly pick a window by name or number.
So that's what I would suggest: switch to the window and then display whatever you want there, instead of trying to combine (a) designating the target window with (b) invoking the command that displays the buffer. IOW, just do it the old-school way: go to the window and then display there.
Of course, if you don't really want to end up in that newly displayed buffer, and you just want to keep the focus where you started, then with my suggestion you would need to cycle (e.g.) back to your starting window. It's not clear from your description whether this is your use case. If it is, then my solution is probably not that helpful.
But even in that case, it might still be useful to split things up: (a) a command to (only) designate the window to use for the following display-buffer command and (b) the display-buffer command. IOW, do essentially the same thing I suggested, but the first step would only designate the target window instead of switching to it, and the second step would use that designated window. (You would need to define (a) and (b), as a general mechanism.)
In this case too my suggestion differs probably from what others might suggest, in that it does not try to combine window choice with display command. They are coupled sequentially, but not combined in one command.