Skip to content

Instantly share code, notes, and snippets.

@khalidchawtany
Created June 8, 2016 01:00
Show Gist options
  • Save khalidchawtany/bb6564832df8a82224e6e2287897903d to your computer and use it in GitHub Desktop.
Save khalidchawtany/bb6564832df8a82224e6e2287897903d to your computer and use it in GitHub Desktop.
call plug#begin('~/.config/nvim/plugged')
set rtp+=/usr/local/opt/fzf
Plug 'junegunn/fzf.vim',
function! s:tablist()
redir => tabs
silent tabs
redir END
return filter(split(tabs, '\n'), 'v:val =~ "Tab page"')
endfunction
function! s:tabopen(e)
echomsg 'normal! '. matchstr(a:e, 'Tab page \zs[0-9]*\ze.*$').'gt'
execute 'normal! '. matchstr(a:e, 'Tab page \zs[0-9]*\ze.*$').'gt'
endfunction
nnoremap <silent> <c-p><c-i> :call fzf#run({
\ 'source': reverse(<sid>tablist()),
\ 'sink': function('<sid>tabopen'),
\ 'options': '+m',
\ 'down': len(<sid>tablist()) + 2
\ })<CR>
call plug#end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment