vim-flog


Ⅰ. 插件描述

Vim Flog Plugin

Ⅱ. 基本信息

创建日期:  2010-11-27
使用用户:  3
Github星:  5
插件作者:  Vladimir Rybas

Ⅲ. 安装方法

使用Vundle管理器安装

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

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

使用NeoBundle管理器安装

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

使用VimPlug管理器安装

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

使用Pathogen管理器安装

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

Ⅳ. 文档说明

Vim Flog Plugin

(Forked from Ruby Cyclomatic Complexity Plugin created by @skammer)

Indicates the Flog number in front of the action in your Ruby code to indicate the complexity.

Screen shot

Requirements

  • ruby
  • flog rubygem
  • vim 7.3+, compiled with:

    • +ruby
    • +signs

Installation

First of all make sure you have a Vim installed with Ruby support. If you use MacVim than you can build your own version of Vim like this.

Here is an example of my configuration during the build:

./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-perlinterp --enable-cscope

Install the Flog gem like this: gem install flog.

To install the plugin just run this command in your Terminal:

curl https://raw.github.com/fousa/vim-flog/master/plugin/flog.vim -o ~/.vim/plugin/flog.vim

When this is done add :silent exe "g:flog_enable" to your .vimrc file.

Configuration

To change colors of sings, use the higlight command. The used groups are

  • SignLowComplexity
  • SignMediumComplexity
  • SignHighComplexity

You can set the limits for the complexity indication with the following commands in your .vimrc:

  • Set the limit to switch to a medium complexity: <br/>

    `:silent exe "let g:flog_medium_limit=10"`
    
  • Set the limit to switch to a high complexity: <br/>

    :silent exe "`let g:flog_high_limit=20"`
    

You can hide some levels of complexity:

  • Hide low complexity: <br/>

    `:silent exe "let g:flog_hide_low=1"`
    
  • Hide medium complexity: <br/>

    `:silent exe "let g:flog_hide_medium=1"`
    

You can also turn flog off and on:

  • Turn on flog

    `:call FlogEnable()`
    
  • Turn off flog

    `:call FlogDisable()`
    
  • Toggle flog

    `:call FlogToggle()`
    

Additionally, you can map this in your .vimrc:

`:map ,f :call FlogToggle()<cr>`

Credits

@garybernhardt's pycomplexity.vim.

@topfunky's rubycomplexity.el

@skammer's Ruby Cyclomatic Complexity Plugin

添加新评论