zsh-vi-mode
zsh-vi-mode copied to clipboard
zvm_cursor_style errors out every return
General information
- konsole 21.08.1 - and, xterm-370
- FreeBSD 13.0-RELEASE-p3
- zinit
- zsh 5.8
- zvm 0.8.5
Problem description
zvm_cursor_style:33: failed to compile regex: trailing backslash ()
Reproduction steps
- source attached zshrc
- 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
The error is in if [[ $old_style =~ '\e\][0-9]+;.+\a' ]]; then
in zsh-vi-mode.zsh:3047
I'm hitting this, too 😢
@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075
Hi @klmanion,
Thanks for your reporting, may I know if this issue is still existing in using the latest version?
Thanks & Regards
@jeffreytse I am on freebsd and can verify that the issue still exists with the latest version,
Hi @anupamsr
Currently, I can't reproduce your issue on my local env. Could we have a co-debugging on your env?
Thanks & Regards
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.
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
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?
@daiaji thanks @otaviof I tried compiling zsh from port using libpcre but still faced the same issue.
Hi @anupamsr, I'd love to help settle this issue, but currently I can not reproduce it in my local.
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
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