I often find myself using mv to rename a file. E.g.
mv app/models/keywords_builder.rb app/models/keywords_generator.rb
Doing so I need to w
You can use history expansion like this:
mv app/modules/keywords_builder.rb !#^:h/keywords_generator.rb
!
introduces history expansion.#
refers to the command currently being typed^
means the first argument:h
is a modifier to get the "head", i.e. the directory without the file partIt's supported in bash
and zsh
.
Docs: