From faff69f8ec90996d7ec4115abf1fca553f33414f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Fri, 5 Jun 2020 00:46:50 +0200 Subject: TBuffer command to open the tab page containing the specified buffer Like `:buffer`, except it switches to the tab page containing the specified buffer instead of opening in the current window. --- tbuffer.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tbuffer.vim diff --git a/tbuffer.vim b/tbuffer.vim new file mode 100644 index 0000000..b19b61e --- /dev/null +++ b/tbuffer.vim @@ -0,0 +1,16 @@ +function! TBuffer(file) + " save swb + " swb=usetab + " b $1 + " restore swb + + let switchbuf_save = &switchbuf + + let &switchbuf = 'usetab' + + execute 'sbuffer ' . a:file + + let &switchbuf = switchbuf_save +endfunction + +command! -nargs=1 -complete=buffer TBuffer call TBuffer() -- cgit v1.2.3