tramp can complete the following tramp file name components: method names, user names, host names, and file names located on remote hosts. Enable this by activating partial completion in .emacs.
For example, type C-x C-f /t <TAB>, tramp completion choices show up as
‘telnet:’ is a possible completion for the respective method, ‘tmp/’ stands for the directory /tmp on your local host, and ‘toto:’ might be a host tramp has detected in your ~/.ssh/known_hosts file (when using ssh as default method).
Type e <TAB> for the minibuffer completion to ‘/telnet:’. Typing <TAB> shows host names tramp from /etc/hosts file, for example.
Choose a host from the above list and then continue to complete file names on that host.
When the configuration (see Customizing Completion) includes user names, then the completion lists will account for the user names as well.
Remote hosts previously visited or hosts whose connections are kept persistently (see Connection caching) will be included in the completion lists.
After remote host name completion comes completion of file names on the remote host. It works the same as with local host file completion, except that killing with double-slash // kills only the file name part of the tramp file name syntax. A triple-slash stands for the default behavior.
C-x C-f /telnet:melancholia:/usr/local/bin//etc <TAB> -| /telnet:melancholia:/etc C-x C-f /telnet:melancholia://etc <TAB> -| /etc C-x C-f /telnet:melancholia:/usr/local/bin///etc <TAB> -| /etc
During file name completion, remote directory contents are re-read regularly to account for any changes in the filesystem that may affect the completion candidates. Such re-reads can account for changes to the file system by applications outside Emacs (see Connection caching).