Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if !exists("g:WindowBufManager")
- let g:WindowBufManager= {}
- endif
- function! StoreBufTab()
- if !has_key(g:WindowBufManager, tabpagenr())
- let g:WindowBufManager[tabpagenr()] = []
- endif
- " add the new buffer to our explorer
- if index(g:WindowBufManager[tabpagenr()], bufname("%")) == -1 && bufname("%") != ""
- call add (g:WindowBufManager[tabpagenr()],bufname("%"))
- endif
- endfunction
- function! WindowBufManagerNext()
- " find the next index of the buffer
- let s = index(g:WindowBufManager[tabpagenr()], bufname("%"))
- if (s!= -1)
- let s = (s +1) % len(g:WindowBufManager[tabpagenr()])
- execute 'b ' . g:WindowBufManager[tabpagenr()][s]
- endif
- endfunction
- augroup WindowBufManagerGroup
- autocmd! BufEnter * call StoreBufTab()
- augroup END
- :call WindowBufManagerNext()
- $ vim file1 file2
- :tabnew
- :argl file3 file4 file5
- :n
- :n
- gt
- :n
- gt
- :N
- and so on…
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement