Custom autocomplete for zsh

ZSH has built-in autocomplete for scp, so a command like

scp user@host /path/ 

displays a list of directories on the remote server.

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

 vim scp:// user@host /path/ 

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

+6
source share
1 answer

Full documentation on autocompletion is in man zshall (if you do not want to view all sections in one person, see the index in man zsh ). The completion for vim is in /usr/share/zsh/$ZSH_VERSION/functions/Completion/Unix/_vim , I think you need to change the _vim_files function located at the top of the file and somehow export the _remote_files function located in /usr/share/zsh/$ZSH_VERSION/functions/Completion/Unix/_ssh .

+2
source

Source: https://habr.com/ru/post/895921/


All Articles