Last active
August 29, 2015 14:13
-
-
Save mattantonelli/9d060fcc49d853bdda22 to your computer and use it in GitHub Desktop.
Open the latest migration for a Rails application in VIM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add to your .zshrc | |
| # find git home directory | |
| function find-git-home() { | |
| git rev-parse --show-toplevel | |
| } | |
| # find the filename of the last migration based on file timestamp | |
| function last-migration() { | |
| ls -rt `find "$(find-git-home)/db/migrate" -type f -name "*" -print` | tail -1 | |
| } | |
| # commands on last migration | |
| alias vlmg='vim "$(last-migration)"' | |
| alias rmlmg='rm "$(last-migration)"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment