VimL
#5 Compare This branch is 9 commits ahead of fousa:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
plugin
.gitignore
README.md

README.md

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

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

  • Set the color of for low complexity:
    :let g:flog_low_color_hl = "term=standout ctermfg=118 ctermbg=235 guifg=#999999 guibg=#323232"

  • Set the color of for medium complexity:
    :let g:flog_medium_color_hl = "term=standout ctermfg=81 ctermbg=235 guifg=#66D9EF guibg=#323232"

  • Set the color of for high complexity:
    :let g:flog_high_color_hl = "term=standout cterm=bold ctermfg=199 ctermbg=16 gui=bold guifg=#F92672 guibg=#232526"

  • Set the background color:
    :let s:background_hl = "guifg=#999999 guibg=#323232 gui=NONE"

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:
    :silent exe "let g:flog_medium_limit=10"

  • Set the limit to switch to a high complexity:
    :silent exe "let g:flog_high_limit=20"

You can hide some levels of complexity:

  • Hide low complexity:
    :silent exe "let g:flog_hide_low=1"

  • Hide medium complexity:
    :silent exe "let g:flog_hide_medium=1"

You can also turn flog off and on:

  • Turn on flog :call EnableFlog()

  • Turn off flog :call DisableFlog()

  • Toggle flog :call ToggleFlog()

Additionally, you can map this in your .vimrc: :map ,f :call ToggleFlog()<cr>

Credits

@garybernhardt's pycomplexity.vim.

@topfunky's rubycomplexity.el

@skammer's Ruby Cyclomatic Complexity Plugin