I like to use Vim (and the shell) to edit my files. When I generate a migration, I often find it cumbersome to try to complete through a datetime like 20121209200054
.
How can I edit the last file in db/migrate
(the one just generated) easily?
I like to use Vim (and the shell) to edit my files. When I generate a migration, I often find it cumbersome to try to complete through a datetime like 20121209200054
.
How can I edit the last file in db/migrate
(the one just generated) easily?
You could simply ls
the directory and feed that into the vim
command:
vim db/migrate/$(ls db/migrate/ | tail -n 1)
You can then make a Bash alias out of that (in your ~/.bashrc
or ~/.bash_aliases
)
alias vim-last-migration='vim db/migrate/$(ls db/migrate/ | tail -n 1)'
Or is there a better way?