zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: completion fails if dir referenced via variable.
Date: Wed, 26 Feb 2014 18:29:21 -0800	[thread overview]
Message-ID: <140226182921.ZM3650@torch.brasslantern.com> (raw)
In-Reply-To: <530CF1D5.2050805@eastlink.ca>

On Feb 25, 11:41am, Ray Andrews wrote:
}
} But couldn't we have:
} 
}   zstyle ':completion:*' auto-multiple-completion
} 
} or something like that? In the above situation I'd want it to perform 
} any and all completions/expansions/corrections all at once, every time. 

The default tab-binding around which this is essentially designed is
the builtin widget "expand-or-complete".  Note "or": expand if possible,
else complete, not both.

If what you want is "expand-and-complete" you can construct that:

    expand-and-complete() {
      zle expand-word	# perhaps _expand_word for compsys support
      zle complete-word
    }
    zle -N expand-and-complete
    bindkey $'\t' expand-and-complete

If you go with _expand_word instead of expand-word you still need the
tag-order all-expansions style that Oliver described, but there are some
rare cases that _expand_word handles better than the builtin expand-word.

Here's a slightly more sophisticated version:

    expand-and-complete() {
      if [[ $LASTWIDGET != expand-and-complete ]]; then
        zle expand-word
	zle auto-remove-suffix
      fi
      zle complete-word
    }
    zle -N expand-and-complete
    bindkey $'\t' expand-and-complete

This allows multiple TABs to enter menu completion, otherwise the call
to expand-word breaks off the last completion and starts a new one.


  reply	other threads:[~2014-02-27  2:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04  4:09 How to make a function use inbuilt completions of another command? Keerthan jai.c
2014-02-04 15:39 ` Bart Schaefer
2014-02-04 16:10   ` Frank Terbeck
2014-02-04 18:08     ` Bart Schaefer
2014-07-21  0:52       ` Keerthan jai.c
2014-02-04 16:25   ` Access command that called a function within the function Ray Andrews
2014-02-05  3:46     ` Bart Schaefer
2014-02-05 18:33       ` Ray Andrews
2014-02-05 20:21         ` Bart Schaefer
2014-02-05 22:54           ` Ray Andrews
2014-02-22 18:35           ` key bindings table? Ray Andrews
2014-02-23 23:40             ` Bart Schaefer
2014-02-24  3:31               ` Ray Andrews
2014-02-25 15:21           ` completion fails if dir referenced via variable Ray Andrews
2014-02-25 17:46             ` Bart Schaefer
2014-02-25 18:25               ` Ray Andrews
2014-02-25 19:21                 ` Bart Schaefer
2014-02-25 19:41                   ` Ray Andrews
2014-02-27  2:29                     ` Bart Schaefer [this message]
2014-02-27  5:06                       ` Ray Andrews
2014-02-27  5:34                         ` key codes table Ray Andrews
2014-03-01  5:08                           ` Bart Schaefer
2014-03-01 20:44                             ` Ray Andrews
2014-03-01 22:50                               ` shawn wilson
2014-03-02 17:27                                 ` Bart Schaefer
2014-03-02 18:18                                   ` shawn wilson
2014-03-03  1:52                                     ` Ray Andrews
2014-02-25 20:02                   ` completion fails if dir referenced via variable Oliver Kiddle
2014-02-25 21:57                     ` Ray Andrews
2014-02-27  2:32                       ` Bart Schaefer
2014-02-05 22:45       ` Access command that called a function within the function Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140226182921.ZM3650@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).