Gherkin Highlighting for VIM
I really wanted some highlighting on my .feature files in vim, I’m no vim expert so I did a bit of googling and came up with the following:
- Download cucumber.vim from http://github.com/tpope/vim-cucumber/blob/master/syntax/cucumber.vim
- Save the file to ~/.vim/cucumber.vim (creating the directory if required)
-
vim ~/.vimrc and add the following lines
au Bufread,BufNewFile *.feature set filetype=gherkin
au! Syntax gherkin source ~/.vim/cucumber.vim - Make sure
syntax on
is also present
- Open your feature file
If anyone knows a more vim way of doing this feel free to add a comment.
4 Comments to Gherkin Highlighting for VIM
That is a really neat feaature. Custom highlighting in VIM based on the file type. I didnt know you could do that.
I should look for some of these to make viewing XML files easier to read.
Vim usually comes with XML syntax highlighting by default, you might need to turn syntax highlighting to auto to have it automatically picked up.
August 9, 2010
I can’t get this to work. I downloaded cucumber.vim, put it in /home/myacct/.vim/, added those lines in /home/myacct/.vimrc, but nothing happened.
Hmmm, sorry Petri, all I can say is ‘it works on my machine’.
Leave a comment
Search
Subscribe
Recent Posts
Tags
Archives
- I tend to print more and more emails these days... a sign of old age? 1 week ago
- Checking out slides on "Every day groovy" by @mr_paul_woods via @grailspodcast http://slidesha.re/9u3yrN 2 weeks ago
- Set up a twitter team account (@rickrollingnz) for our crazy trip through India in a Rickshaw, hoping to tweet from mobile as we go! 2 weeks ago
- More updates...

July 1, 2010