Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我喜欢使用 Vim(和 shell)来编辑我的文件。当我生成迁移时,我经常发现尝试通过像20121209200054.
20121209200054
如何轻松编辑db/migrate(刚刚生成的)中的最后一个文件?
db/migrate
您可以简单地ls将目录输入到vim命令中:
ls
vim
vim db/migrate/$(ls db/migrate/ | tail -n 1)
然后,您可以从中创建一个 Bash 别名(在您的~/.bashrcor中~/.bash_aliases)
~/.bashrc
~/.bash_aliases
alias vim-last-migration='vim db/migrate/$(ls db/migrate/ | tail -n 1)'
或者,还有更好的方法?