vim-drawer


Ⅰ. 插件描述

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

Ⅱ. 基本信息

创建日期:  2016-06-12
使用用户:  1
Github星:  23
插件作者:  Samuel Simões

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'samuelsimoes/vim-drawer'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'samuelsimoes/vim-drawer'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'samuelsimoes/vim-drawer'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/samuelsimoes/vim-drawer

Ⅳ. 文档说明

# VimDrawer

:point_right: 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.

:bulb: 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.

:bulb: 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

添加新评论