zsh-dwim: Most Recent Remote File Completion

| Comments

Progress on zsh-dwim has been pretty slow lately. It didn’t take long to mine my shell history dry, and I have been having some difficulty coming up with new ideas. That is, until I came across a post on Reddit asking about a good way to find the most recently edited file on a server for the purpose of pulling a copy down over scp.

This idea seemed useful enough to be worth pursuing.

Wouldn’t this be better server by a tab completion?

Maybe it would, but I’m quite pleased with how shoehorning this functionality into zsh-dwim worked out. I’m very happy with the way the progression from “ssh” to “scp” to “scp with latest file” is working with just a couple of presses of the zsh-dwim key.

When the command line reads “scp patshead.com:” and I press control-u, zsh-dwim queries the patshead.com server looking for the most recently modified (non-hidden) file in my home directory.