Next: , Previous: , Up: Using TRAMP   [Contents][Index]

5.3 File name completion

TRAMP can complete the following TRAMP file name components: method names, user names, host names, and file names located on remote hosts. User name and host name completion is activated only, if file name completion has one of the styles basic, emacs21, or emacs22.

For example, type C-x C-f / s TAB, TRAMP completion choices show up as

sbin/
scp:
scpx:
sftp:
sg:
smb:
srv/
ssh:
sshx:
su:
sudo:
sys/

ssh:’ is a possible completion for the respective method, and ‘sbin/’ stands for the directory /sbin on your local host.

Type s h : for the minibuffer completion to ‘/ssh:’. Typing TAB shows host names TRAMP extracts from ~/.ssh/config file, for example1.

ssh:127.0.0.1:
ssh:192.168.0.1:
ssh:[::1]:
ssh:localhost:
ssh:melancholia.danann.net:
ssh:melancholia:

Choose a host from the above list and then continue to complete file names on that host.

When the configuration (see Selecting config files for user/host name completion) includes user names, then the completion lists will account for the user names as well.

Results from auth-sources search (see Using an authentication file) are added to the completion candidates. This search could be annoying, for example due to a passphrase request of the ~/.authinfo.gpg authentication file. The user option tramp-completion-use-auth-sources controls, whether such a search is performed during completion.

Remote hosts previously visited or hosts whose connections are kept persistently (see Reusing connection related information) 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.

Example:

C-x C-f /ssh:melancholia:/usr/local/bin//etc TAB
     -| /ssh:melancholia:/etc

C-x C-f /ssh:melancholia://etc TAB
     -| /ssh:melancholia:/etc

C-x C-f /ssh:melancholia:/usr/local/bin///etc TAB
     -| /etc

Footnotes

(1)

Some completion styles, like substring or flex, require to type at least one character after the trailing ‘:’.

Next: Declaring multiple hops in the file name, Previous: Alternative file name syntax, Up: Using TRAMP   [Contents][Index]