I know gf
opens the file under cursor, and CTRL-w
f
opens the file under cursor in a new split window.
I'm probably being greedy but, how do you open it in a new vertical window?
From normal mode, you could type C-w f C-w L
or C-w v gf
, and from the command-line you could execute :wincmd f | wincmd L
or :vert wincmd f
.
They are not strictly equivalent, though.
With C-w f C-w L
and :wincmd f | wincmd L
, the height of your vertical viewport will be maximized no matter the current layout. So, for example, if you have a horizontal viewport below, its width should be decreased:
+-----------------+ +--------+-------+
| path/to/fileC | | | |
| | → | | |
| fileA | | fileA | fileC |
+-----------------+ +--------+ |
| | | | |
| fileB | | fileB | |
+-----------------+ +--------+-------+
With C-w v gf
and :vert wincmd f
, the height of your vertical viewport should be the same as the current one, and thus it shouldn't affect the horizontal viewport below:
+-----------------+ +--------+-------+
| path/to/fileC | | | |
| | → | | |
| fileA | | fileA | fileC |
+-----------------+ +--------+-------+
| | | |
| fileB | | fileB |
+-----------------+ +----------------+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With