vim file browser that stays open across tabs?
Here's what I mean. The built in file browser :Ex and others like NERDtree and Project have the fatal flaw that they only operate inside a single tab. I use tabs heavily, and I want a file tree view that I can keep visible globally to all tabs and open files from it into new/existing tabs. Some kind of pane or detached window or what have you. Like the way kate (kde) works.
I know that there is something like this for emacs because I've used it in the past, but I don't remembe开发者_C百科r what it's called.
Probably not quite the answer you're looking for, but there's another way of thinking about tabs in vim that will help with your problem.
You can think of each tab as a 'view' into your workspace (equivalent to something like a perspective in an IDE like eclipse), and the buffer list as what would normally be tabs in other programs.
That way you can have one tab for 'single editor with NERDTree open', one tab for 'large editor', one tab for 'vertical split editor' etc, and each tab may or may not have the same buffers open.
That way you can just stick with your single layout, and use :bnext
and :bprev
to switch buffers sequentially along the list, or :b <approxname>
to jump to a named buffer easily. If you get the unimpaired plugin, the mappings ]b
and [b
are also defined that map to :bnext
and :bprev
for easy access. The fuzzyfinder plugin also has a :FufBuffer command that lets you easily jump to an open buffer (and then either open, split open or tab open at the press of a key once you've found it with some really intuitive default bindings).
I'm a huge fan of vimcasts, and this episode has a bit more detail of the general idea I'm talking about here.
I had the same problem, so I wrote this little application http://vimpal.sourceforge.net/
From my limited experience, Vim's tabs are not at all the same as in firefox or kate or textmate or, well, any other app. They don't represent files and you should not use them like that. Like actionshrimp said, tabs are more like views or perspectives and you can't have a window (like NERDTree) detached from a tab.
While keeping that distinction in mind you could try to detect the creation of a tab and launch NERDTree. This way you may have file explorers on every tab but these file explorers would be x instances of NERDTree, not 1 instance. I think that would lead to memory problems quickly.
I have one tab for each project I'm working on. That's consistant with what I think is the idea behind tabs and is tremendously helpful for staying organised.
精彩评论