Skip to content

VimDrawer is a Vim plugin to group related buffers in tabs automatically by the file name.

Notifications You must be signed in to change notification settings

samuelsimoes/vim-drawer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

VimDrawer

👉 When you work with some big tasks you may need edit too many files at once and most of the time you may get lost in so many files.

VimDrawer is a Vim plugin to help you to work with many open files on Vim in a sane way.

Usage

First, you must be familiar with Vim buffers, if you are, the basic idea is to create scoped buffer lists per tab AND do a file auto classification to send your file to the correct tab based on the file name. For now on I will call this tabs as "drawer".

To use you must define the schema of your drawers using an array on the global variable g:vim_drawer_spaces on your vimfiles. The array's first position is the drawer name and the second is the RegExp to match the file name if it should or not go to the drawer. Example:

" ~/.vimrc
let g:vim_drawer_spaces = [
  \["model", "model"],
  \["controller", "controller"],
  \["view", "\.html\.erb$"],
  \["asset", "\.[js|css]$"]
\]

In the example above every file that has model in the name goes to the tab named as model, your models drawer.

Any other file that hasn't the declared drawer destination goes to the current drawer.

💡 You can define drawers schema per project by adding in your project's root the .vim-drawer.vim file, on this file you must set the g:vim_drawer_spaces array.

To check what files are in the drawer you will need to invoke the command :VimDrawer. This command will open a horizontal split with a list of the current buffers in the drawer. To open the buffer just press enter. To close a buffer right on the selector just press c. To just preview a buffer without leave the drawer press space.

💡 You can map this command to a shortcut like:

nnoremap <C-Space> :VimDrawer<CR>

Now you can invoke the drawer's buffers selector pressing Ctrl + Space.

Installation

You can install this plugin with Pathogen, Vundle and other plugin loaders.

Is it a vim-ctrl-space copycat?

This plugin is a simplified version of the awesome vim-ctrl-space plugin with the auto file classification feature (that I even had shown to vim-ctrlspace folks). I decide to create a separate version mainly to implement the auto classification feature and because vim-ctrl-space IMHO could be much more simple at some aspects that I won't discourse here. Ping me on Twitter if you are interested.


Samuel Simões ~ @samuelsimoes ~ Blog

About

VimDrawer is a Vim plugin to group related buffers in tabs automatically by the file name.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published