mrwooster
mrwooster

Reputation: 24207

Custom autocompletion for zsh

ZSH has builtin autocompletion for scp, so a command like

scp user@host/path/

would show directory listings on the remote server.

However, this does not work when opening a remote file in vim

vim scp://user@host/path/

I have googled around for documentation on the zsh autocomplete functions but it seems very complicated. How can I enable autocomplete for vim scp?

Upvotes: 8

Views: 2103

Answers (1)

ZyX
ZyX

Reputation: 53614

Complete autocompletion documentation is located in man zshall (if you don't want to view all sections in one man, see index in man zsh). Completion for vim is located in /usr/share/zsh/$ZSH_VERSION/functions/Completion/Unix/_vim, I guess you need to modify _vim_files function located at the top of the file and somehow export function _remote_files located in the /usr/share/zsh/$ZSH_VERSION/functions/Completion/Unix/_ssh.

Upvotes: 3

Related Questions