[vim/vim] vimscript: do not highlight `\v` as error in a command (Issue #17873)

6 views
Skip to first unread message

Maxim Kim

unread,
Jul 28, 2025, 7:07:29 AM7/28/25
to vim/vim, Subscribed
habamax created an issue (vim/vim#17873)

Steps to reproduce

# fix trailing spaces
command! FixTrailingSpaces :exe 'normal! m`'<bar>
      \ :keepj silent! :%s/\r\+$//g<bar>
      \ :keepj silent! :%s/\v(\s+$)//g<bar>
      \ :exe 'normal! ``'<bar>
      \ :echom 'Remove trailing spaces and ^Ms.'
image.png (view on web)

@dkearns fyi

Expected behaviour

'v' shouldn't be highlighted as error.

Version of Vim

9.1.1591

Environment

debian12,bash

Logs and stack traces


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17873@github.com>

dkearns

unread,
Jul 28, 2025, 7:19:27 AM7/28/25
to vim/vim, Subscribed
dkearns left a comment (vim/vim#17873)

As a workaround until it's fixed, a block can be used rather than line continuations. It's arguably the better approach anyway.

# fix trailing spaces
command! FixTrailingSpaces {
   :exe 'normal! m`'<bar>
   :keepj silent! :%s/\r\+$//g<bar>
   :keepj silent! :%s/\v(\s+$)//g<bar>
   :exe 'normal! ``'<bar>
   :echom 'Remove trailing spaces and ^Ms.'
}


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17873/3126754744@github.com>

Maxim Kim

unread,
Jul 28, 2025, 7:21:06 AM7/28/25
to vim/vim, Subscribed
habamax left a comment (vim/vim#17873)

Yeah, thx! It is just quite old command I have, will change it to the block.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17873/3126761004@github.com>

dkearns

unread,
Jul 28, 2025, 7:54:01 AM7/28/25
to vim/vim, Subscribed
dkearns left a comment (vim/vim#17873)

FWIW | rather than <bar> works in :command too and should be highlighted correctly. "Two out of three ain't bad", as someone once sang.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17873/3126877025@github.com>

dkearns

unread,
12:59 PM (6 hours ago) 12:59 PM
to vim/vim, Subscribed
dkearns left a comment (vim/vim#17873)

<bar> will need to be treated as a command prefix group in :command replacement strings when ex-commands are properly contained there.

It's not needed but as it's supported there's about 100 files using it on GitHub.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/17873/3848518419@github.com>

Reply all
Reply to author
Forward
0 new messages