smjonas / live-command.nvim

Easily create previewable commands in Neovim.
MIT License
499 stars 2 forks source link

No range allowed when using Preview command with visual selection #37

Closed jdhao closed 2 days ago

jdhao commented 3 days ago

I do not have special settings, this is my config using lazy nvim:

  {
    "smjonas/live-command.nvim",
    -- live-command supports semantic versioning via Git tags
    -- tag = "2.*",
    config = function()
      require("live-command").setup()
    end,
  },

If you select a range, then use Preview command, I am seeing the following error:

E481: no range allowed.

smjonas commented 3 days ago

This is intentional. The Preview command is meant to preview the argument passed to it exactly as provided.

So you could do pass the range like :Preview 5,10norm daw instead of :5,10Preview norm daw. On the Reddit post, someone posted about this as well. Maybe I should Change this behavior as I agree it can be unintuitive, especially in visual mode.

jdhao commented 3 days ago

Thanks for the reply, my confusion comes from the usage section: https://github.com/smjonas/live-command.nvim?tab=readme-ov-file#basic-usage

There it specifically says you can use Preview command with ranges. Maybe it should be updated as well 😄

smjonas commented 3 days ago

Oh thanks, I'll update the documentation

smjonas commented 2 days ago

I decided to add support for ranges in the :Preview command so you can now simply select lines in visual mode and apply the command more easily