inc-rename.nvim icon indicating copy to clipboard operation
inc-rename.nvim copied to clipboard

[feat] Support modes other than insert for input_buffer_type = "dressing"

Open fnune opened this issue 2 years ago • 1 comments

Here's my setup using lazy.nvim:

  {
    "smjonas/inc-rename.nvim",
    dependencies = { "stevearc/dressing.nvim" },
    config = function()
      local inc_rename = require("inc_rename")
      inc_rename.setup({ input_buffer_type = "dressing" })

      vim.keymap.set("n", "<leader>rn", function()
        return ":IncRename " .. vim.fn.expand("<cword>")
      end, { expr = true })
    end,
  },

inc-rename.nvim works just fine. However, I like to use dressing with these settings:

input = { insert_only = false }

(see the dressing README)

It seems like dressing's settings are ignored by inc-rename.nvim. When I press escape, the prompt just exits.

Could inc-rename.nvim inherit from the configuration passed to dressing's setup function? Or perhaps support passing an independent set of options?

fnune avatar May 21 '23 09:05 fnune

Unfortunately, adding support for insert_only is currently not possible to implement. Support for dressing.nvim is implemented as follows:

  • the dressing window is opened with a "fake cursor" (i.e. I just put a highlight in the dressing buffer)
  • the real cursor still stays in the command line because the preview of the LSP renaming must take place from command line mode due to the way cmd-preview works in Neovim

So a setting like insert_only does not make sense because you are not actually moving around in the dressing window. You can, however, override settings globally using dressing's setup function as shown in the readme. I hope that clears things up!

smjonas avatar Jun 09 '23 11:06 smjonas