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: registers ui shouldn't trigger on @ #466

Closed
3 tasks done
glyh opened this issue Jun 19, 2023 · 5 comments · Fixed by #467
Closed
3 tasks done

bug: registers ui shouldn't trigger on @ #466

glyh opened this issue Jun 19, 2023 · 5 comments · Fixed by #467
Labels
bug Something isn't working

Comments

@glyh
Copy link

glyh commented Jun 19, 2023

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.9.1 Build type: Release LuaJIT 2.1.0-beta3

Operating system/version

Linux arch 6.3.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 10 Jun 2023 00:35:35 +0000 x86_64 GNU/Linux

Describe the bug

Currently if you do some operation on both macros and registers, they will modify the same map and it results in weird behaviors.

Steps To Reproduce

  1. nvim -u repro.lua repro.lua
  2. select any line, press "+yy to yank
  3. press @, now the register for macros are weirdly intertwined with copy registers.

Expected Behavior

They are separated, o.w. I can't repeat macros( like @20a)

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {"folke/which-key.nvim",
    lazy = false,
    init = function()
      vim.o.timeout = true
      vim.o.timeoutlen = 300
    end,
    config = function()
      local wk = require('which-key')
      wk.register({
        hp = { 'help' , 'Ask for help' },
      }, { mode = 'c' })
    end
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@glyh glyh added the bug Something isn't working label Jun 19, 2023
@glyh
Copy link
Author

glyh commented Jun 19, 2023

Is there a quick fix that I can utilize by disabling the map on @?

@glyh
Copy link
Author

glyh commented Jun 19, 2023

Okay looks like this is intended as in 01b6676, then I think it's better to delete this map, or is there a specific reason to override it?

@glyh glyh closed this as completed Jun 19, 2023
@folke folke reopened this Jun 19, 2023
@folke folke closed this as completed in 65b36cc Jun 19, 2023
@glyh
Copy link
Author

glyh commented Jun 19, 2023

I was about to open a new one because the description on this is not correct at all. But thank you for being very responsive.

@folke
Copy link
Owner

folke commented Jun 19, 2023

You're right. Didn't think that through at the time. I've removed that mapping. Thank you for reporting this!

@folke folke changed the title bug: Macros are mixed with registers bug: registers ui shouldn't trigger on @ Jun 19, 2023
@glyh
Copy link
Author

glyh commented Jun 19, 2023

I think it is related to #65. It should be totally fine to use @ to show registers(that's how it work in neovim internally) but with one exception. number registers shouldn't be available when using @, o.w. we can't repeat macros.

It still feels wrong to me because they should have been separated in my mind, but that's how vim is designed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants