next-alter.vim


Ⅰ. 插件描述

This is Vim Plugin for supporting open alternate file.

Ⅱ. 基本信息

创建日期:  2014-03-02
使用用户:  4
Github星:  4
插件作者:  mopp

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

## next-alter.vim
This is Vim Plugin for supporting open alternate file.
For example, There are hoge.c.
You execute :OpenNAlter. then it opens hoge.h.
And it opens hoge.c when you edit hoge.h

So, it can switch c <-> h, cpp <-> hpp and etc.

In particular, when you open vim plugin file.
It will switch "autoload/hoge.vim" <-> "plugin/hoge.vim".

installation

NeoBundle 'mopp/next-alter.vim'

usage

Command is here.

:OpenNAlter
:OpenNAlter vertical

Mapping is here.

nmap <Leader>ano <Plug>(next-alter-open)
nnoremap <expr> <Leader>anb next_alter#open_mapexpr('vertical botright')
nnoremap <expr> <Leader>ant next_alter#open_mapexpr('vertical topleft')

setting

This is default values below.

" key is file extension, value is alternate file extension.
let g:next_alter#pair_extension = {
            \ 'c'   : [ 'h' ],
            \ 'C'   : [ 'H' ],
            \ 'cc'  : [ 'h' ],
            \ 'CC'  : [ 'H', 'h'],
            \ 'cpp' : [ 'h', 'hpp' ],
            \ 'CPP' : [ 'H', 'HPP' ],
            \ 'cxx' : [ 'h', 'hpp' ],
            \ 'CXX' : [ 'H', 'HPP' ],
            \ 'h'   : [ 'c', 'cpp', 'cxx' ],
            \ 'H'   : [ 'C', 'CPP', 'CXX' ],
            \ 'hpp' : [ 'cpp', 'cxx'],
            \ 'HPP' : [ 'CPP', 'CXX'],
            \ }

" this list shows search directory to find alternate file.
let g:next_alter#search_dir = [ '.' , '..', './include', '../include' ]

" this is used when it opens alternate file buffer.
let g:next_alter#open_option = 'vertical topleft'

screenshot

SS

添加新评论