Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom autocompletion for zsh

Tags:

vim

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?

like image 206
mrwooster Avatar asked Aug 25 '11 20:08

mrwooster


1 Answers

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.

like image 90
ZyX Avatar answered Oct 21 '22 10:10

ZyX