[vim/vim] can't run `normal! n` in a command block (Issue #18605)

6 views
Skip to first unread message

Maxim Kim

unread,
Oct 19, 2025, 9:43:58 PM (2 days ago) Oct 19
to vim/vim, Subscribed
habamax created an issue (vim/vim#18605)

Steps to reproduce

  1. vim --clean
  2. source following vimscript
command! -nargs=? Search {
    var needle = escape(<q-args>, '\')
    if !empty(needle)
        @/ = $'\V{needle}'
        normal! n
    endif
}
  1. run :Search needle

Expected behaviour

needle should be searched. Instead command line mode is activated where some input is expected.

As a workaround, exe "normal! n" works (or not using command block)

command! -nargs=? Search {
    var needle = escape(<q-args>, '\')
    if !empty(needle)
        @/ = $'\V{needle}'
        exe "normal! n"
    endif
}

Version of Vim

9.1.1868

Environment

debian13, 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/18605@github.com>

zeertzjq

unread,
Oct 19, 2025, 11:23:21 PM (2 days ago) Oct 19
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#18605)

Related #14491


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/18605/3420401136@github.com>

Reply all
Reply to author
Forward
0 new messages