Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Files renaming issue on Windows 11 Pro #18

Open
pidgeon777 opened this issue May 6, 2024 · 0 comments
Open

[Bug] Files renaming issue on Windows 11 Pro #18

pidgeon777 opened this issue May 6, 2024 · 0 comments

Comments

@pidgeon777
Copy link

I'm on Windows 11 Pro, using Lazyvim.

Config:

return {
  {
    "gabrielpoca/replacer.nvim",
    keys = {
      {
        "<leader>hr",
        function()
          require("replacer").run()
        end,
        desc = "run replacer.nvim",
      },
      {
        "<leader>hs",
        function()
          require("replacer").save({})
        end,
        desc = "save replacer.nvim",
      },
    },
    opts = function(_, opts)
      local def_opts = {
        save_on_write = true,
        rename_files = true,
      }

      local my_opts = {
        save_on_write = false,
        rename_files = true,
      }

      opts = vim.tbl_deep_extend("force", opts or {}, my_opts)

      return opts
    end,
    enabled = true,
  },

  -- Which-key sub-menus
  {
    "folke/which-key.nvim",
    optional = true,
    opts = {
      defaults = {
        mode = { "n", "v" },
        ["<leader>h"] = { name = "+replacer.nvim" },
      },
    },
  },
}

I have a buffer named work.csv with this content:

work,InternalComponent.vhd
work,InternalEntity.vhd
work,TestEntity.vhd

pwd returns: C:\Work\Test.

I populate the quickfix list with the buffer content so that I obtain:

work.csv|1 col 1| work,InternalComponent.vhd
work.csv|2 col 1| work,InternalEntity.vhd
work.csv|3 col 1| work,TestEntity.vhd

Then I execute require("replacer").run() to make the quickfix list editable.

I edit it this way:

aaaawork.csv|1 col 1| work,InternalComponent.vhd
aaaawork.csv|2 col 1| work,InternalEntity.vhd
aaaawork.csv|3 col 1| work,TestEntity.vhd

Finally, I execute require("replacer").save({}) to save the changes.

As a result, the buffer filename is not updated to aaaawork.csv, which would be the expected behavior.

Also, what would happen to the final buffer filename if I edited the quickfix list this way?

aaaa\work.csv|1 col 1| work,InternalComponent.vhd
bbbb\work.csv|2 col 1| work,InternalEntity.vhd
cccc\test.csv|3 col 1| work,TestEntity.vhd

Finally, what should the path separator on Windows be in the quickfix list before saving it, so that the new buffer filename/location is updated correctly?

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

No branches or pull requests

1 participant