zefei / vim-wintabs

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

Suggestion for "new tab" shortcut #11

Closed jordwalke closed 7 years ago

jordwalke commented 7 years ago

What vim command would you recommend for vim-wintabs "new tab" equivalent. I've tried :enew (mapping command + n to this), but it doesn't actually recreate the notion of "new tab" because if my current buffer has unsaved changes, it complains that there are unsaved changes. Do you have another suggestion for a command for opening a "new tab".

zefei commented 7 years ago

You can set hidden, or use :enew!, or map something to :confirm enew. Wintabs already handle many cases using :confirm ..., but I'd still suggest you :h 'hidden' and maybe :h bd to know more about this.

BTW, due to how wintabs handles new buffer or unlisted buffer, the empty buffer tab won't show on the tabline until it's changed.

jordwalke commented 7 years ago

:enew! will discard changes to the buffer! Were you aware?

zefei commented 7 years ago

Oh sorry, I know how :enew! works but wasn't really aware that it's not what you weren't looking for.

jordwalke commented 7 years ago

I think setting hidden will work (I suppose I have to create an autocmd that will cause it to happen for every new file that will open). Are there any bad consequences to doing so?

zefei commented 7 years ago

set hidden is a good default in .vimrc if you use any kind of buffer browser (like wintabs). You don't need to use autocmd for this, because the consequence of leaving it on is just that you can lose track of unsaved buffers without a buffer list. I've had set hidden for years and never had any issue.

jordwalke commented 7 years ago

"because the consequence of leaving it on is just that you can lose track of unsaved buffers without a buffer list"

I see, so something like WinTabs removes all of the downside?

zefei commented 7 years ago

Yeah, any buffer browser, even the old minibufexpl, will do.