A more general way to do this is with M-. (Esc-.). This fetches the last argument from the previously entered command. Very handy when you need to apply multiple commands to a file or directory.
Repeat this key combo to fetch the last argument from further back in your command history.
I use this all the time (almost as much as tab completion).
even better (if you are using bash, not sure about other shells) and use
shopt -s histverify
then if you type !$<enter> will replace !$ with /somedir but not hit return, so you could then modify it. Then you could do...
mv somefile -t /somedir
vim !$<enter>/somefile
mv somefile -t /somedir
cd !$ # now you are in /somedir