vital-vcs-git


Ⅰ. 插件描述

[Deprecated] A external module of vital.vim for providing fundemental functions related to git manipulation

Ⅱ. 基本信息

创建日期:  2014-12-30
使用用户:  2
Github星:  1
插件作者:  Alisue

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'lambdalisue/vital-vcs-git'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

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

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'lambdalisue/vital-vcs-git'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'lambdalisue/vital-vcs-git'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

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

Ⅳ. 文档说明

vital-VCS-Git Build Status

A fundamental git manipulation library.

  • Version: 0.1.0
  • Author: Alisue <lambdalisue@hashnote.net>
  • Support: Vim 7.3 and above (See travis-ci)

INTRODUCTIONS

Vital.VCS.Git is a fundemental Git manipulation library powerd by vital.vim.
It provide the following features.

  1. Find git repository recursively from a specified path
  2. Parse Git repository config (.git/config)
  3. Parse Git config (git config --list)
  4. Parse Git status (git status --porcelain)
  5. Parse Git blame (git blame --porcelain)
  6. Parse Git commit status (git commit --dry-run --porcelain)
  7. Fetch Git meta information (e.g. current branch name)
  8. Execute Git command

The library try to NOT use Git command as much as possible and try to cache
result as much as possible to improve the speed. With this strategy, the
response speed would 100 times faster than executing Git command everytime.

General vim plugin developer do not need to know but if you want to manipulate
Git in low level, the following submodules would help you.

  • Vital.VCS.Git.Core - A core function module of Git manipulation
  • Vital.VCS.Git.Finder - A fast git repository finder
  • Vital.VCS.Git.ConfigParser - A Git config parser
  • Vital.VCS.Git.StatusParser - A Git status parser
  • Vital.VCS.Git.BlameParser - A Git blame parser
  • Vital.VCS.Git.Conflict - A helper library to manipulate conflicts

All modules above provide a low level API and do not cache any results,
contrusting to Vital.VCS.Git which try to cache things per each Git
repository.

Benchmark: https://gist.github.com/lambdalisue/c73ad37a33b8242fba13

This library is strongly inspired by vim-vcs
and several mechanisms (especially finding a git repository) is taken from that.

DOCUMENTATIONS

INSTALL

To install it and requirements, use neobundle.vim (or other vim plugin
managers) like:

NeoBundle 'lambdalisue/vital-VCS-Git'

USAGE

First of all, call Vital.VCS.Git.new() or Vital.VCS.Git.find() to create
a Git instance. The instance will cached per each Git working tree.


let s:G = s:V.import('VCS.Git')
" find a git working tree and repository to create a Git instance
let git = s:G.find(expand('%'))

Then you can get meta information of the repository with
Vital.VCS.Git-instance.get_XXXXX()

let head = git.get_meta()
" echo current branch
echo meta.local.branch_name
" echo remote branch of current branch
echo meta.remote.branch_name

To call a git command, call Vital.VCS.Git-instance.exec().

call git.exec(['rev-parse', '--is-inside-work-tree'])

To bundle Vital.VCS.Git into your plugin, call Vitalize as

:Vitalize --name=your_plugin_name . +VCS.Git

It will automatically bundle Vital.VCS.Git and required vital modules to
your plugin.

LICENSE

MIT license

Copyright (c) 2014 Alisue, hashnote.net

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

添加新评论