Say I have stuff.txt, filled with stuff, in the current directory. And I want to get rid of it, and make a new stuff.txt in vim. Obviously I could do
rm stuff.txt
vi stuff.txt
But that's two steps, the horror! Is there a way to consolidate this into one vim/vi call without invoking rm? Perphaps some -option on vim that I somehow missed when looking in the manual?
Obvious workaround is to create something like this, in a file called, for example, new.sh:
#!/bin/bash
rm $1
vim $1
and then do from the command line, ./new.sh stuff.txt, but that seems a bit un-eleagant. I'm on ubuntu using the standard bash.
> stuff.txt
andvim !$
?!$
(e.g.vim !$
) or useM-.
See post: How to use arguments from previous command?