1

I've configured my VIM to find and open a file by fzf:

nmap <c-x><c-f> :Files<cr>

It works fine, but I wanna open the file in a new tab instead of the current tab with the same shortcut keys.

5
  • @filbranden When I press Ctrl-t it says about tags and Ctrl-T in my Gnome Terminal will open a new tab in Terminal generally. Do you know what's the function behind it that I set a shortcut key for it?
    – mortymacs
    Dec 21 '20 at 17:21
  • 1
    @filbranden Thanks a lot! It worked!
    – mortymacs
    Dec 21 '20 at 21:17
  • @filbranden you'll post as an answer? or I do it?
    – mortymacs
    Dec 21 '20 at 21:29
  • 1
    I'll do it. Thanks for confirming this works for you!
    – filbranden
    Dec 21 '20 at 21:38
  • 1
    Welcome to Vi and Vim!
    – D. Ben Knoble
    Dec 22 '20 at 19:19
5

The Vim fzf plug-in has a native feature to open the selected item in a new tab.

If you type Ctrl+T inside the fzf selection window, it will tell Vim to open the item in a new tab (when applicable.)

See here, below the table it says:

Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new tab, a new split, or in a new vertical split.

If this is acceptable for you, you don't need a new mapping to open files in a new tab, just to use the appropriate Ctrl+key sequence when selecting an entry, to have that entry opened in a new tab (or a split too, since that's also supported.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.