Skip to content

Incompatibility with custom config setopt globsubst #137

@fdelavier

Description

@fdelavier

Hi,

I notice an issue when using zsh-history-substring-search plugin with my existing zsh customizations.

Indeed, in my .zshrc I typically use this configuration :
setopt globsubst

Problem: this option breaks zsh-history-substring-search when using "eval" build-in command.

First, enter this eval command :

% eval $(echo date +"%D")
11/01/22

So now this command is in the history.

Then, without option globsubst, we can use the Up key (click many times on this key)

% unsetopt globsubst

% [click on Up key several times]

=> OK

But now, with option globsubst, if we click 3 times on the Up key :

% setopt globsubst

% [click on Up key 3 times]

% eval $(echo date +"%D")
_history-substring-search-begin:46: missing end of string

=> history call fails after the eval command.

Maybe zsh-history-substring-search should use something like "emulate -L zsh" ?

According to man zshoptions :

       LOCAL_OPTIONS <K>
              If this option is set at the point of return from a shell  func‐
              tion, most options (including this one) which were in force upon
              entry to the function are restored; options  that  are  not  re‐
              stored  are PRIVILEGED and RESTRICTED.  Otherwise, only this op‐
              tion, and the LOCAL_LOOPS, XTRACE and  PRINT_EXIT_VALUE  options
              are  restored.   Hence  if  this  is explicitly unset by a shell
              function the other options in force at the point of return  will
              remain  so.   A shell function can also guarantee itself a known
              shell configuration with a formulation like  `emulate  -L  zsh';
              the -L activates LOCAL_OPTIONS.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions