Code Monkey home page Code Monkey logo

vim-behat's Introduction

behat.vim

This is an adaptation of cucumber.vim for Behat.

Behat uses the same language as cucumber to describe features, so indent and syntax scripts are the same as cucumber runtime files. Only the compiler and ftplugin are specific to Behat.

Features

  • autocompletion of steps (with <C-X><C-O>)
  • jump to step definition (behat version from 2.2 and ctags are required) with tag commands <C-]>, <C-W>], <C-W>}
  • compiler plugin that allows you to run behat with :make and see errors in the quickfix window (enable with :compiler behat) (Not tested after forking)
  • works well with neocomplcache (see below the settings needed) (Not tested after forking)
  • Copy to the clipboard the behat command to run features in the current buffer (:BehatCmdToClipBoard). You need to enable behat compiler to have this command. (Not tested after forking)

Installation

Plug 'sunnypp/vim-behat'
cd ~/.vim/bundle
git clone git://github.com/sunnypp/vim-behat.git

Behat feature files share the same .feature extension with cucumber, so in order to choose the behat filetype plugin, you need to set the following global in your .vimrc:

let g:feature_filetype='behat'

If you don't, cucumber will be used as filetype by default.

Commands

  • :BehatCmdToClipBoard: copy the behat command for current buffer into the clipboard
  • :BehatInvalidatesOmniCache: clear omni completion cache

Configuration

Global settings examples

" ~/.vimrc

" mandatory if you want the '*.feature' files to be set with behat filetype
let g:feature_filetype='behat'

" The plugin tries successively several behat executables to find the good one
" (php behat.phar, bin/behat, etc). You can define a custom list that will
" be prepended to the default path with g:behat_executables.
let g:behat_executables = ['behat.sh']

" if you use neocomplcache add this to enable behat completion
if !exists('g:neocomplcache_omni_patterns')
    let g:neocomplcache_omni_patterns = {}
endif
let g:neocomplcache_omni_patterns.behat = '\(When\|Then\|Given\|And\)\s.*$'

" disable omni completion steps cache
" normally you don't want to do this because it's slow (and will prevent neocomplcache from working)
" let g:behat_disable_omnicompl_cache = 1

Buffer (local) settings examples

" ~/.vim/ftplugin/behat.vim

" b:behat_cmd_args let you add arguments to the behat command.
" This is useful if you use profiles, or/and a different config file.
let b:behat_cmd_args = '-c path/to/behat.yml'

" This variable is bound to the current buffer, so it let you add custom logic
" to define it.
" For instance, you can set a profile according to features location:
if match(expand('%:h'), 'features\/foo') != -1
    let b:behat_cmd_args = '-p foo'
elseif match(expand('%:h'), 'features\/bar') != -1
    let b:behat_cmd_args = '-p bar'
endif

" add this to automatically set the behat compiler (slows down buffer loading)
compiler behat

vim-behat's People

Contributors

haringsrob avatar sunnypp avatar veloce avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

haringsrob

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.