There doesn't seem to be one of these available in the archives, and
it's the thing I've missed most since moving from zsh, so I figured I'd
really get fishy and write it.  Appending the following to your scp.fish
(or making an alternate scp.fish in .config/fish/completions) will allow
you to preform tab completion of remote paths for scp!  Identical
completions could also provide identical functionality in rsync.  It
would be nice to integrate fish's built-in description methods, but I
can't think of a way to do that without ensuring fish is installed on
the remote system (not a general fix) or mounting an sshfs (gross).

Code:
> complete -c scp -d "Remote Path" -n "echo (commandline -ct)|sgrep -o 
> '.*:';and true" -a "
> 
> (
>       #Prepend any user@host information supplied before the remote completion
>       echo (commandline -ct)|sgrep -o '.*:'
> )(
>       #Get the list of remote files from the specified ssh server
>       ssh -o \"BatchMode yes\" (echo (commandline -ct)|sed -ne 
> 's/\(.*\):.*/\1/p') ls\ -d\ (echo (commandline -ct)|sed -ne 's/.*://p')\*
> )
> 
> "

Enjoy!

Cheers,

pants.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to