Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with custom config setopt globsubst #137

Open
fdelavier opened this issue Nov 1, 2022 · 0 comments
Open

Incompatibility with custom config setopt globsubst #137

fdelavier opened this issue Nov 1, 2022 · 0 comments

Comments

@fdelavier
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant