zefei / vim-wintabs

Modern buffer manager for Vim
MIT License
325 stars 25 forks source link

[Feature request] Close tabs (buffers) to the left/right like chrome #47

Closed dylan-chong closed 5 years ago

dylan-chong commented 5 years ago

Would be very useful because it's easy to open many many files

zefei commented 5 years ago

I don't feel like adding this to the public commands as it feels a bit arbitrary. But here's the function that does what you want:

function! WintabsCloseRight()
  call wintabs#refresh_buflist(0)
  let buflist = copy(w:wintabs_buflist)
  call filter(buflist, 'v:key > '.index(buflist, bufnr('%')))
  " 'v:key < ' for all tabs to the left
  for buffer in buflist
    execute 'buffer! '.buffer
    WintabsClose
  endfor
endfunction
dylan-chong commented 5 years ago

Wow thanks so much! (sorry for the slow reply)