4

I use airline to manage my status-line and tab-line. This worked great until I started to code for an MVC project that has way too many modules and files going on. I now have tabs coming out my ears. More to the point: they don't fit in my tab line.

Is there a way to configure airline to run over into multiple lines? Alternatively is there an alternate way to take a gander at what tabs I have open?

  • 1
    If you're talking about buffers, rather than Vim-tabs, you could try fholgado.com/minibufexpl, which provides more of a tabby sort of experience than the answers currently given. It will resize itself to be as many rows as necessary to fit in all the buffer names. – Rich Mar 17 '15 at 13:43
13

This is an inherent issue with the tab metaphor and every solution introduces more problems:

  • multiple lines are harder to parse and take up too much space,
  • tab groups make it impossible to see what's in them at a glance and thus defeat the whole purpose of having a tab-line,
  • arrows to scroll the tab-line are also very impractical and contrary to the purpose of the tab-line.

You should learn how to use buffers without relying on a mostly useless and wasteful visible list (that "requires" a mostly useless and wasteful plugin).

Put these in your vimrc:

set wildmenu
nnoremap gb :ls<CR>:b<Space>

and enjoy the ride.

Also, :b <Tab>.

5

Vim provides 3 concepts for working with multiple files:

  • Buffers: one for each file you've opened.
  • Windows/Splits: view multiple things at the same time.
  • Tabs: For multiple sets of windows. Useful for managing multiple tasks.

By conflating them all into the same thing, you're losing out on a lot of power. You should consider other ways which you can use these three things in your workflow.

Everyone has their own preferred technique for doing this. Here are a few distinct tasks you probably want the ability to do and some methods for doing them:

  1. Switch to a file you were recently looking at

    • Use a plugin that manages buffers. There are a ton to choose from, but most either utilize fuzzy search or listing them all and allowing you to switch via keyboard/mouse
    • Just use a regular fuzzy file opener. I use :CtrlPMRUFiles a lot. Even though :CtrlPBuffer limits to only the buffers currently opened, MRU mode prioritizes these while still letting me open any file in a few keystrokes, whether it's already in a buffer or not.
    • Layout everything in splits/tabs and switch based on their position. See #2 for more info about this
  2. Group related files

    • Use tabs for separate tasks. If you want to really embrace this idea, check out ctrl-space.
    • Put related files in splits next to each other. If you want to look at many files this way (i.e. 10 levels of a call stack), put them in parallel splits and try my accordion plugin.
    • Use the quickfix list to store lists of files (i.e. :grep/Ack/Ag to populate it with occurrences of a phrase.) Note that you can cycle between multiple lists with :colder and :cnewer
  3. Jump to specific places in the codebase

    • Jump to definition by setting up tags or using gd
    • Jump to corresponding test/template by installing and configuring projectionist
    • If a file is jumped to especially often, create a mapping to jump right to it

Try to figure out what works best for you. I personally use a combination of organizing files in splits/tabs and using fuzzy openers, but many people are more comfortable/efficient with other techniques.

1

Instead of relying on a visible list, you should try something like ctrl-p. With this plugin you can navigate to a file by pressing ctrlp and adding some letters of the file name you're looking for.

If the following is added to your .vimrc:

let g:ctrlp_cmd = 'CtrlPBuffer'

Then it will search only in the open buffer list, which makes it more appropriate and fast if the file you're looking for is already opened.

There many more options that you can use to customize this plugin in the most efficient way for your personal work flow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.