Recently, I use Vim as my editor while programming Ruby, but I don’t know if I can do that in Vim. Let’s say in my Vim, I already have 2 vertical split windows named A and B like this:

And then I hit gf to jump to the source file xyz.rb if I park the cursor under the require statement, but it will show in the same window A by default.
Is there any shortcuts or quick combo that I can open or show the source file xyz.rb in the opened B split window? (and even if the window B doesn’t exist yet, create one automatically)
I’ve check the manual, and it does has some ways to show xyz.rb in different horizontal split window or a new tab, but is it possible if I want to show it in specify opened split window B.
thanks 🙂
The functionality you describe is already present in the form of a ‘preview window’.
You could map a key (e.g. gf) to something like
This will open the filename under the cursor in the preview window. A new preview window will be opened if none exists. See
:he preview-windowfor more information.Use ^Wz (or
:pclose) to close the preview window