From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16400 invoked by alias); 7 Apr 2015 13:14:25 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20105 Received: (qmail 20809 invoked from network); 7 Apr 2015 13:14:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=CjvE7dGEtkG/0TJJmiTLTha4V46ZrhlQx6aeupwoxjI=; b=VFv+hc89WTHBJ31SjZyaGxWeuq1bJJH0UtgEkO1cwu4OGtKGchi7DJmhWGnyBl0lmD iFrO/rMSmLL8NWu3JXMa5T3x1L5BzXSMbC+CO9WcqzDzwIM4Ai1c6XtSL5g6reAGM98T be5Qdne66P8LK4h5qXWIAqWlr1ZWCTpltu4yV6bnbeBokUZyjkrglbrgDtgmdPdHRfOc fzfYmS4bVuaxIrUyZ/ZLOiwCXeIa+axcNWmzVBEumtvjCaFQcxKKSxLlUpDN5R46Eiyd IKZsTmztz5Iyo/AL+l5R2lZltSdGRqmdzmeL7MFXRiIR39+m12hG3jNmO8Nbdu4mFQgj TLcg== MIME-Version: 1.0 X-Received: by 10.152.21.136 with SMTP id v8mr18237600lae.64.1428412456424; Tue, 07 Apr 2015 06:14:16 -0700 (PDT) Date: Tue, 7 Apr 2015 15:14:16 +0200 Message-ID: Subject: Ssh completion from ~/.ssh/config From: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=089e0158b7180ed9ce05132231c8 --089e0158b7180ed9ce05132231c8 Content-Type: text/plain; charset=UTF-8 I would like to have ssh complete with hosts from my ~/.ssh/config, but I can't get it to work. I don't know if I'm missing something obvious. Suppose I have the following in my ssh-config: Host myhost HostName 192.168.1.1 User jesper Typing "ssh " I would like it to supply "myhost". Looking through the standard completion script _ssh, I see the following lines: # If users-hosts matches, we shouldn't complete anything else. if [[ "$IPREFIX" == *@ ]]; then _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return else _combination -s '[:@]' my-accounts users-hosts \ ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return fi In this case the else statement is executed. Since I have not defined any "my-accounts", the completion file _hosts is auto-loaded. This script reads several files to find possible completions (among others /etc/hosts and ~/.ssh/known_hosts). Since this fulfills _combination, the lines in _ssh which parse ~/.ssh/config are never executed. If I comment out the lines I quoted above it works as I would like it to work, but with the obvious drawback that I have modified a file that is part of the zsh distribution, and I need to keep track of this file every time I upgrade. I could also specify "my-accounts" or "hosts" in my .zshrc, but then I need to keep it in sync with my ~/.ssh/config. Is there no way to get this to work the way I like through some configuration that I have missed? Jesper --089e0158b7180ed9ce05132231c8--