E492: Not an editor command: when parsing a long regular expression
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- vim
- Ambito
- tooling
Direzione di ricerca
Start by reproducing the error with the attached timetracker.txt renamed to timetracker.vim, focusing on the errTimestamp syntax line and the parser entry point used for it. Compare the parser's handling of the long regular expression with Vim's successful parsing, then add a regression case that parses the line without reporting E492.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I had originally posted this error on the vim-language-server issue, and the author of that projected directed me to vim-vmlparser. Here's my original post:
Describe the bug
I'm not sure why this error is being thrown, it seems to be throwing an error at a specific point and I don't understand why. I have a long regex pattern which is designed to match a timestamp string (%Y-%m-%d %H:%M:%S), and a negation to flag invalid timestamps as errors. The syntax line in question:
syntax region errTimestamp matchgroup=timestamp start="^\%(\d\{4}-\%(0[135789]-\%([0-2]\d\|3[01]\)\|\%(1[02]-\%([0-2]\d\|3[01]\)\)\|0[46]-\%([0-2]\d\|30\)\|11-\%([0-2]\d\|30\)\|02-[0-2]\d\) \%([01]\d\|2[0-3]\)\%(:[0-5]\d\)\{2}\)\@!" end=": "
It generates the following error:
E492: Not an editor command: [0-3]\)\%(:[0-5]\d\)\{2}\)\@!" end=": "
I have vim-language-parser installed using vim-lsp (which itself is installed via vim-plug)
Here's a screenshot of the error:

Here's the full copy of my syntax file:
timetracker.txt
Here's an example log file the syntax file highlights:
example.log
This file loads successfully, vim doesn't make a similar complaint when applying the syntax highlighting to my log file.
To Reproduce
Steps to reproduce the behavior:
- Rename timetracker.txt to timetracker.vim, and ensure vim-language-server parses the file
- On errTimestamp line, vim-language-server throws an error.
At first I thought it might be too many capture groups, but I replaced all the nested \(...\) with \%(...\). An interesting thing about this, the character it highlights is the last character of the visual line before it line wraps, or the last visible character of the line with :set nowrap set.
Expected behavior
I don't expect vim to show an error on this line, not when vim itself can parse this line correctly (and not throw an error).
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: macOS Monterey 12.6.3
- vim 9.0.1-1400 (installed via Homebrew)
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 11 2023 13:55:53)
macOS version - x86_64
Included patches: 1-1400
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
-balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
-browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand +perl +title
+channel +ipv6 +persistent_undo -toolbar
+cindent +job +popupwin +user_commands
-clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap +ruby +wildignore
+cursorbind +lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con +mksession +smartindent +writebackup
+diff +modify_fname +sodium -X11
+digraphs +mouse +sound -xfontset
-dnd -mouseshape +spell -xim
-ebcdic +mouse_dec +startuptime -xpm
+emacs_tags -mouse_gpm +statusline -xsmp
+eval -mouse_jsbterm -sun_workshop -xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/Users/tblancher/homebrew/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -L/usr/local/lib -o vim -lm -lncurses -lsodium -liconv -lintl -framework AppKit -L/Users/tblancher/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=11.7 -fstack-protector-strong -L/usr/local/lib -L/Users/tblancher/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE -lperl -L/Users/tblancher/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -lintl -framework CoreFoundation -lruby.3.2 -L/Users/tblancher/homebrew/Cellar/ruby/3.2.1/lib
- vim-language-server (re-)installed today, vim-lsp uses npm for this
- vim-lsp installed via vim-plug
Log:
Not sure how to capture logs from vim-language-server. enabling logging in vim-lsp doesn't appear to log the error.
- Lingua principale
- Vim Script
- Stelle
- 173
- Fork
- 28
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di vim-jp/vim-vimlparser
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
vim-jp/vim-vimlparser#201 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
vim-jp/vim-vimlparser#200 ·
-
Support for falsy operator?Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
vim-jp/vim-vimlparser#197 · 2 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
vim-jp/vim-vimlparser#191 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
vim-jp/vim-vimlparser#174 ·
Tutte le issue di vim-jp/vim-vimlparser
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
jessepollak/home#1454 ·
I maintainer di solito rispondono entro 1 giorno
-
kinogo-films.vipApertaN: AdGuard for iOS P3: Medium T: Ads
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
AdguardTeam/AdguardFilters#242874 ·
I maintainer di solito rispondono entro 1 giorno
-
Theme: Bots Type: Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
internetarchive/openlibrary#13743 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
bytedance/trae-agent#526 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno