m4xshen / hardtime.nvim

Establish good command workflow and quit bad habit
MIT License
1.38k stars 26 forks source link

Not picking up j/k repeating when using NvChad distro #31

Closed nooproblem closed 1 year ago

nooproblem commented 1 year ago

Firstly, thanks for making this amazing plugin! I am using the NvChad distro, and I have installed hardtime.nvim using Lazy and set lazy = false so the plugin is enabled on startup. I have run into a odd situation where it hardtime.nvim does not pick up j/k repeating. I can fix this issue by running ":Hardtime toggle" twice (or ":Hardtime disable" and then ":Hardtime enable") in order to switch hardtime.nvim off/on. Any thoughts on why this might occurring would be appreciated!

m4xshen commented 1 year ago

Does hardtime.nvim not pick up only j/k repeating? How about other keys?

nosduco commented 1 year ago

Also running NvChad and am having this issue. I am wondering if it is due to NvChad's j/k mapping https://github.com/NvChad/NvChad/blob/v2.0/lua/core/mappings.lua#L40

m4xshen commented 1 year ago

Please delete the NvChad's j/k mapping and move them into keys setting of hardtime.nvim. This should make sure the keymap is loaded before the pluglin.

{
    "m4xshen/hardtime.nvim",
    dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
    lazy = false,
    keys = {
      { "j", 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"' },
      { "k", 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"' }
    },
    opts = {}
}
nooproblem commented 1 year ago

Thank you!