views:

32

answers:

2

I find myself doing this a lot:

script/generate migration my_new_migration

.. then select & copy the generated filename, then paste it into vi to actually write the migration.

Is there any way to do this in one step? i.e. when the script/generate migration runs, it creates the file the automatically opens that file in an editor?

(I'm working in an SSH terminal window on linux..)

A: 

Maybe you can edit generator script. When file is generated than exec $EDITOR [new_file] or something like that?

Sebastian
A: 

Thanks for the suggestions. However, I actually just stumbled upon this: http://www.vim.org/scripts/script.php?script_id=1567

Pretty sweet, as it lets you do

> :Rscript generate migration my_migration

.. from inside VIM, and it will automatically generate the migration then load it up in the editor for you.

geosteve