Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Change cd hook in _ssh_hosts
- X-seq: zsh-workers 54255
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: lemen@xxxxxxxxx
- Cc: zsh-workers@xxxxxxx
- Subject: Re: Change cd hook in _ssh_hosts
- Date: Thu, 26 Mar 2026 08:29:38 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XD07/bp+soTVl5vjXDSzSzIFwKxT5QJnPTJphLw4RZI=; fh=NnJZxlhgM2F48+yA+Y4qHdSkRFK47x0ezJYq6S1lW60=; b=GBEo0hRX4vYQovFhrm+7ZGBktg5JkCuwQl1P2v1BCYIBAig2FyeUCd7x/zOHqgWJPg 8a4nAYo6IEz+dAZmKjFsyHQ6asa5KduB67Se7zRpjz8RWB/fpEKsTk/XaiaiVhkkxZnw eUJIatW99QJURRfaJtbG52cXjyuSHuFJrmGonJtxIfaG45NhRp+mSz/Jfot3NNyIlhpu tC3sme98eEkA6KD30eo6Dk4YsWxwq2g3B58/O7YEiRyyO0zkV6VOCXTNOxjAMOQ94jXO 9KmhbTV4LGqi13dE6wKenrwZ7hSMik8m3YNktZ4lAquhGzfVk3OQSt2pY9fDJElGZ/y3 L8HA==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1774538990; cv=none; d=google.com; s=arc-20240605; b=LGiXvklagcULWzZTRphJSc1qwLw1TQuhpTjtRkndjiBYpTjCGSNJbN6uvfyZect6uy 76ueSmF5NbtEky8SLkbtEjzqHhp6RFK4t7alS8p8NOSXZ4Dff8f6yqQJPehQ8BHwVWnz HGG65I2LcfTsYOa3PpLRyNy/HptmcSIpmr5XGq+N89ggOJ/o4pe2xK1X0QWyDpKsrvas yd4XMHCONjseJ8gOLuDLRwjBjhf6NopF/blHi/dZvsbaS9166on95mB2KOIQjZ2ujv2v uviRgRGZ0sEzIRmqA8KUVrJuUvz4arg7dhAiBVJ1i4a7LSPnkPZpL1m1O/uCnXPXglJO JoHQ==
- Archived-at: <https://zsh.org/workers/54255>
- In-reply-to: <7d943b2a-b52d-4ab6-82f2-6f48b946bda9@lemen.xyz>
- List-id: <zsh-workers.zsh.org>
- References: <7d943b2a-b52d-4ab6-82f2-6f48b946bda9@lemen.xyz>
On Thu, Mar 26, 2026 at 6:59 AM <lemen@xxxxxxxxx> wrote:
>
> function chpwd() { pwd > "$lwd_file" }
>
> When a shell completion uses cd, the hook is also executed and and sets
> the directory accordingly.
There are likely more cases than just _ssh_hosts that assume "cd" has
no side-effects outside the current (sub)shell, including at least the
_cd function for "cd" completion itself. The question is whether
those would misbehave if changed to "cd -q" (and why they don't use
that already).
In the meantime I suggest this:
function chpwd() { [[ -o zle ]] && pwd > "$lwd_file" }
This updates the file only for "cd" executed at a shell prompt.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author