Skip to content

builtin.command doesn't forward line ranges correctly #3565

@MartyMcFlyInTheSky

Description

@MartyMcFlyInTheSky

Description

I have a user command that accepts a range:

local function copy_line_url(opts)
    vim.print(vim.inspect(opts))
end

vim.api.nvim_create_user_command('CopyRemoteLink', copy_line_url, { range = true })

When I invoke the command normally via command mode the range is properly passed (e.g. opts shows something like:

{
  args = "",
  bang = false,
  count = 189,
  fargs = {},
  line1 = 183,
  line2 = 189,
  ...
}

But builtin.commands doesn't seem to do that. When I mark the same lines and invoke the command picker, I see this after selection:

{
  args = "",
  bang = false,
  count = -1,
  fargs = {},
  line1 = 189,
  line2 = 189,
  ...
}

Neovim version

NVIM v0.11.4
Build type: Release
LuaJIT 2.1.1741730670

Operating system and version

ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions