Background
- Vim 7.3 all platforms.
- Vim allows the user to open a file "hyperlink" by pressing
gf
.
Problem
Goal
Find a solution that makes gf
work with tab-page
as the default behavior.
Details
The current default behavior opens the new file in the same viewport, but sometimes a user might want to open the new file in a different tab using the Vim tab-page
feature.
Alternatively, a user may wish to always have gf
use tab-page and never open the linked file in the same viewport.
Vim allows the gf
command to open in a new tab, but it requires the user to type control-W <C-W>
before invoking gf
.
The existing approach is not optimal, because the keystrokes are cumbersome and introduce the risk of repetitive strain injury for users who make heavy use of the gf
command.
See also
Vim help:
- :help gf
- :help tab-page-intro
- :help tab-page
- :help tab-page-commands | /_gf
- :help CTRL-W_gf
Desired solution
It would be desirable to do away with the need to type <C-W>gf
all the time, in order to save keystrokes and reduce the risk of repetitive strain injury.
Failed attempt
The following attempt did not work (use a normal command):
:normal <C-W>gf
Questions
- why does not
:normal <C-W>gf
work as expected? - what alternative approaches will work to make Vim exhibit the desired behavior and reach the goal?