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.
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.
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.)
Per the maintainer you can also configure fzf.vim
to open the selected file in a new tab by default by adding this to your ~/.vimrc
:
let g:fzf_action = { 'enter': 'tab split' }
The accepted solution works as well, I'm just too lazy to include those extra two key strokes.