Wednesday, September 2, 2009

Re: How to use vim tabs like other editors' tabs

On Sep 2, 5:53 am, Bu Rak <loku...@gmail.com> wrote:
> I want to use vim tabs like the ones in MiniBufferExplorer or other editor
> tabs (when a file opens, it will open in a new tab, when closes close the
> tab).
>

Why do you want this? Vim's tab pages are more like workspaces. They
can be much more powerful than the usual one-file-per-tab setup used
in other editors. There is nothing wrong with using tabs *mostly* in a
one-file-per-tab fashion (I do this myself), but trying to force Vim
to *always* work this way is bound to cause frustration and will only
serve to impose artificial limits anyway.

If you want to LAUNCH files in a new tab always, that isn't too hard
using the --remote-tab-silent or -p command-line switches, or using
the :tab drop command from within Vim. --remote-tab-silent and :tab
drop will even jump to the file without opening a new tab for it if it
is already open. But don't try to lock each tab so that they can only
ever have a single file in them, or lock Vim so that a given file can
only ever be open in a single tab page. You would lose out on tons of
useful things you can do with Vim if you ever succeed.

As for closing tabs, whenever you close the last window in a tab, the
tab already closes. If you have several windows open, there is
the :tabclose command to close the entire tab if desired.

> I try to use autocmds but no success at all (it will open tabs for files but
> there are some problems).
>
> My .vimrc related to these:
>
> autocmd BufNew * :tablast
> autocmd BufAdd * :tabnew <sfile>
>

I'm not even sure how these are SUPPOSED to work, and I'm not going to
try them out to guess at what is going wrong.

I'd suggest looking at vim.wikia.com/wiki/Category:Tabs for a tip or
two about one-tab-per-file ideas, as well as tips about how to use Vim
tab pages the right way.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments: