E492: Not an editor command: when parsing a long regular expression
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- vim
- Domain
- tooling
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Vim Script
- Stars
- 173
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vim-jp/vim-vimlparser
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
vim-jp/vim-vimlparser#201 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
vim-jp/vim-vimlparser#200 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
vim-jp/vim-vimlparser#197 · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
vim-jp/vim-vimlparser#191 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
vim-jp/vim-vimlparser#174 ·
All issues in vim-jp/vim-vimlparser
Similar issues
-
area:release bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
registrystack/registry-stack#1874 ·
Maintainers usually reply within 1 day
-
namespace operations
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
EclipseFdn/open-vsx.org#13702 ·
Maintainers usually reply within 1 day
-
Adding SIMD typesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
material-extensions/vscode-material-icon-theme#3610 ·
Maintainers usually reply within 2 days
-
deltareview treats a line-range citation as an unknown path, firing the delta-review pass spuriouslyOpenagent-butler-finding bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
jordansmall/spindrift#4366 ·
Maintainers usually reply within 1 day