jeffreytse / zsh-vi-mode

💻 A better and friendly vi(vim) mode plugin for ZSH.
MIT License
2.99k stars 103 forks source link

zvm_cursor_style errors out every return #159

Open klmanion opened 2 years ago

klmanion commented 2 years ago

General information

Problem description

zvm_cursor_style:33: failed to compile regex: trailing backslash ()

Reproduction steps

  1. source attached zshrc
  2. will occur after hitting return (but not before, i.e. not right when terminal loads)

Expected behavior

error shown in prob. desc. occurs immediately after the command line. There is no newline before it. The error is itself followed by a newline. There is no extraneous trailing newline occurring after command output.

Occurs regardless of whether ZVM_CURSOR_STYLE_ENABLED is set to true or false

zprofile.txt zshrc.txt

anupamsr commented 1 year ago

The error is in if [[ $old_style =~ '\e\][0-9]+;.+\a' ]]; then in zsh-vi-mode.zsh:3047

juliekoubova commented 1 year ago

I'm hitting this, too 😢

anupamsr commented 1 year ago

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

jeffreytse commented 1 year ago

Hi @klmanion,

Thanks for your reporting, may I know if this issue is still existing in using the latest version?

Thanks & Regards

anupamsr commented 1 year ago

@jeffreytse I am on freebsd and can verify that the issue still exists with the latest version,

jeffreytse commented 12 months ago

Hi @anupamsr

Currently, I can't reproduce your issue on my local env. Could we have a co-debugging on your env?

Thanks & Regards

otaviof commented 10 months ago

Hello! Well, apparently zsh on FreeBSD does not support PCRE by default, as in, the following shall fail:

setopt re_match_pcre

A practical approach to enable PCRE support is to reinstall via the ports tree with the respective flag enabled:

cd /usr/ports/shells/zsh

# enable the "pcre" option...
make config

# reinstall the shell...
make reinstall clean

Thus you can issue the setopt again:

setopt re_match_pcre

With the module in place the error messages are gone.

On macOS (homebrew) and Linux (DNF/Fedora), zsh supports PCRE by default, apparently this issue will only occur on FreeBSD using pre-compiled packages.

wahaj4311 commented 10 months ago

zvm_cursor_style:33: failed to compile regex: trailing backslash () i got same error on termux. Which line to delete or comment.

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

daiaji commented 8 months ago

zvm_cursor_style:33: failed to compile regex: trailing backslash () i got same error on termux. Which line to delete or comment.

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

https://github.com/jeffreytse/zsh-vi-mode/blob/ea1f58ab9b1f3eac50e2cde3e3bc612049ef683b/zsh-vi-mode.zsh#L3222-L3224

The three lines of if judgment code from line 3222 to line 3224.

But here comes the question, is it caused by regularity or something else?

anupamsr commented 7 months ago

@daiaji thanks @otaviof I tried compiling zsh from port using libpcre but still faced the same issue.

jeffreytse commented 7 months ago

Hi @anupamsr, I'd love to help settle this issue, but currently I can not reproduce it in my local.

rosetintedcheeks commented 7 months ago

zvm_cursor_style:33: failed to compile regex: trailing backslash () i got same error on termux. Which line to delete or comment.

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

I also got this error in termux. I fixed it by just adding setopt re_match_pcre to .zshrc as @otaviof suggested. I did not have to recompile anything.

@anupamsr As for freebsd, you might try recompiling libpcre with different config options? That's the only relevant difference I can find between the termux version, the archlinux version (which works without the zsh option), and the port version.

For reference, Archlinux https://gitlab.archlinux.org/archlinux/packaging/packages/pcre/-/blob/8.45-4/PKGBUILD#L40

Termux-pacman https://github.com/termux-pacman/termux-packages/blob/master/packages/pcre/build.sh#L13

FreeBSD https://cgit.freebsd.org/ports/tree/devel/pcre/Makefile?id=56fcffd8655a1cc30676ff357af80be1225b4c34#n23

Hope that helps

NotRexButCaesar commented 5 months ago

I did not have this problem, but when I set -o GLOB_SUBST then I have almost the same error after every <CR>, <Up>, or <Down>: zvm_cursor_style:38: bad pattern: \e[0 q. I also get zvm_update_repeat_commands:42: bad pattern: ^[[A

anupamsr commented 1 month ago

Thanks @rosetintedcheeks . I have stopped using freebsd now so I can't be of more help here.