Blog

Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Monday, April 22, 2013

Open Gems with vim-bundler

When working with platforms such as Spree and RefineryCMS it's more than likely that I will be extending their models more often that not. This means opening the Gem to identify a specific behaviour I want to override. Vim is my text editor of choice, and I typically try to restrict my self to one instance of the editor running. It makes working with multiple buffers a lot easier! Whenever I want to open a Ruby Gem, it always irks me that I have to open another instance of the editor, in a separate window/pane (although Tmux reduces the pain of this a wee bit).

Vim does offer a client-server option, but admittedly I couldn't get this working and in my search I came across Tim Pope's vim-bundler. From the README:

An internalized version of bundle open : :Bopen (and :Bsplit , :Btabedit , etc.).

Exactly what I wanted, a way to `bundle open` within Vim. Here's a quick demo of using vim-bundler to open Spree's `Order` model and navigate to the `add_variant` method.

vim-bundler from Nicholas Henry on Vimeo.

Friday, November 30, 2012

Have you tried ctags with Vim?

After reading Mislav Marohnić's excellent post on Vim, I decided to add ctags to my development environment. What does it buy you? It allows you to jump to method or class definitions with these commands:


Setup is pretty easy:


You can generate tags with:


But you probably won't want to do all that manually. As Mislav points out in his post, Tim Pope shows us how to automate tag generation with git hooks.

I've been using ctags this afternoon and already it has turned Vim into a completely different editor for me.

Saturday, March 5, 2011

Trigger Cucumber Features from Vim

I use rstakeout to automatically run my Cucumber features when a feature changes (yes I probably should be using watchr). I use the following command:

rstakeout "rake cucumber:wip" "features/**/*"

But sometimes I want to run the features manually. However, I don't want to leave my editor to do this. A mapping in Vim to trigger the run saves the day:

map <Leader>c :call system("touch features/support/env.rb")<CR>

Please note this blog is no longer maintained. Please visit CivilCode Inc - Custom Software Development.