Skip to content

lines read by a command are read as commands while skipping - #21349

Closed
h-east wants to merge 1 commit into
vim:masterfrom
h-east:skip-command-block
Closed

h-east wants to merge 1 commit into
vim:masterfrom
h-east:skip-command-block

Conversation

@h-east

@h-east h-east commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor
Problem:  Inside a block that is not executed, "if 0" for one, the
          lines that ":command", ":autocmd", ":class", ":interface",
          ":enum" and ":loadkeymap" read are read as commands, since
          none of them is executed while skipping.  An interface with
          "def M(): number" in it ends the script with E1057, and a
          line of a keymap with E488.  A ":source ++dryrun" hits this
          at the script level.
Solution: Execute those commands while skipping, like ":function",
          and only read the lines they own then.

related: #21331

Problem:  Inside a block that is not executed, "if 0" for one, the
          lines that ":command", ":autocmd", ":class", ":interface",
          ":enum" and ":loadkeymap" read are read as commands, since
          none of them is executed while skipping.  An interface with
          "def M(): number" in it ends the script with E1057, and a
          line of a keymap with E488.  A ":source ++dryrun" hits this
          at the script level.
Solution: Execute those commands while skipping, like ":function",
          and only read the lines they own then.

Assisted-by: Claude
Signed-off-by: Hirohito Higashi <[email protected]>
@h-east h-east changed the title a command block in a block that is not executed is read as commands lines read by a command are read as commands while skipping Sep 20, 2026
@chrisbra

Copy link
Copy Markdown
Member

thanks

@chrisbra chrisbra closed this in f3dc0fe Sep 25, 2026
@h-east
h-east deleted the skip-command-block branch September 25, 2026 22:10
zeertzjq added a commit to neovim/neovim that referenced this pull request Sep 26, 2026
… commands (#42102)

Problem:  "if 0" condition not correctly skipped for :command, :autocmd,
          :class, :interface, :enum and :loadkeymap
Solution: Skip those commands and discard the blocks they read
          (Hirohito Higashi).

closes: vim/vim#21349

vim/vim@f3dc0fe

Co-authored-by: Hirohito Higashi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants