zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: make history-complete-older do nothing on empty string
Date: Wed, 18 Apr 2018 09:11:11 -0700	[thread overview]
Message-ID: <CAH+w=7ZJd8Ruf7-Pwozjyt=zcQKE3ND5w=vE=QuSPfHyo2nwYA@mail.gmail.com> (raw)
In-Reply-To: <20180418135817.7edca58c@camnpupstephen.cam.scsc.local>

On Wed, Apr 18, 2018 at 5:58 AM, Peter Stephenson
<p.stephenson@samsung.com> wrote:
>
> So when you interrupted it it was apparently reading in 66742 history
> words

Some people have really large shell history.  Manipulating that many
completion possibilities takes a long time.

Vincent, what version of zsh are you running?  There were some memory
management optimizations done in the past year or so that might speed
up large history accesses in general.

Although it would be nice to find out exactly what part of completion
is occupying time in this case (if only so that we might look into
making it interruptible), to answer the original question:

You'd want a wrapper around _history_complete_word to check the state
of the editor buffer, or you could copy that function to a location at
the front of your $fpath and modify it.  The test you want is probably
something like:

[[ ${LBUFFER:- } == ' ' && ${RBUFFER:- } == ' ' ]] && return 1

There's a space after :- in both of those references.  This means "if
either the buffer is empty or the cursor is sitting in the middle of a
run of spaces, then return" (i.e. don't complete anything).


  parent reply	other threads:[~2018-04-18 16:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180418052832epcas2p1df623a44c88edae226f65a2d5edc90f2@epcas2p1.samsung.com>
2018-04-18  5:21 ` Vincent Bernat
2018-04-18  8:40   ` Peter Stephenson
2018-04-18  9:15     ` Vincent Bernat
2018-04-18  9:45       ` Peter Stephenson
2018-04-18 12:20         ` Vincent Bernat
2018-04-18 12:58           ` Peter Stephenson
2018-04-18 13:28             ` Peter Stephenson
2018-04-18 16:15               ` Vincent Bernat
2018-04-18 16:11             ` Bart Schaefer [this message]
2018-04-18 16:28               ` Vincent Bernat
2018-04-18 18:41               ` Vincent Bernat
2018-04-18 18:53                 ` Ray Andrews
2018-04-19  5:49                   ` Vincent Bernat
2037-12-03 12:10                     ` Ray Andrews
2037-12-03 14:36                       ` 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='CAH+w=7ZJd8Ruf7-Pwozjyt=zcQKE3ND5w=vE=QuSPfHyo2nwYA@mail.gmail.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).