m4xshen / hardtime.nvim

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

The recent update that addresses gk and gj #5

Closed directormac closed 1 year ago

directormac commented 1 year ago

LazyVim Discussion Reference image

directormac commented 1 year ago

I removed the "d" keys on hint and resetting keys did the trick for now but hoing youd have a fiix on it.

m4xshen commented 1 year ago

Please try out the latest version and try whether it works now.

directormac commented 1 year ago

The default config works smooth now, but the "gk" and "gj" isn't triggering the hardtime for some unknown reasons, was working sometimes like a week ago.

the "d" now shows which-key menu but i think reset is triggering from what "dd" should do.

m4xshen commented 1 year ago

The default config works smooth now, but the "gk" and "gj" isn't triggering the hardtime for some unknown reasons, was working sometimes like a week ago.

Do you mean pressing gkgkgk doesn't trigger hardtime?

directormac commented 1 year ago

Pressing gk and gj directly triggers hard time, but on some frameworks they remapped j to gj and and k to gk. The yanking yy and deleting entire line with dd only opens the whichkey menu now but not doing any actions.

m4xshen commented 1 year ago

Can you provide your mapping of gj and gk? Or are you using the default config of LazyVim?

directormac commented 1 year ago

The default one from lazyvim, i believe this is it.

-- better up/down
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
m4xshen commented 1 year ago

This mapping works for me. Do you have any other config that might override this?

directormac commented 1 year ago

I will check it out soon and setup a fresh install with lazyvim and only use your plugin.

m4xshen commented 1 year ago

Thanks a lot.

directormac commented 1 year ago

d and key are doing its job, it's just not showing the whichkey menu, maybe its because of the delays set on which-key by default at lazyvim i am not sure tho, Thank you for fixing that! 🤖

I tried remapping j and k but hardtime isn't detecting it. vim.keymap.set({ "n", "v" }, "j", "j", { noremap = true }) vim.keymap.set({ "n", "v" }, "k", "k", { noremap = true })

m4xshen commented 1 year ago

Do you set the keymap before the plugin's setup? If yes, try to set the keymap after that.

lbiaggi commented 1 year ago

@m4xshen, just to let you know, I'm facing the same problem.

m4xshen commented 1 year ago

Do you mean that gj and gk don't trigger hardtime? Do you also use LazyVim or use custom map for j and k?

m4xshen commented 1 year ago

@directormac please try out the latest version. Thanks.

lbiaggi commented 1 year ago

Do you mean that gj and gk don't trigger hardtime? Do you also use LazyVim or use custom map for j and k?

I just use a custom map


vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true })
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true })
m4xshen commented 1 year ago

I just use a custom map

vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true })
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true })

After setting the keymap, the j and k don't trigger hardtime?

thenbe commented 1 year ago

I just use a custom map

vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true })
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true })

After setting the keymap, the j and k don't trigger hardtime?

Trying out hardline for the first time now. Hardtime fails to trigger with this keymap.

m4xshen commented 1 year ago

Trying out hardline for the first time now. Hardtime fails to trigger with this keymap.

What Neovim version are you using? I can't reproduce the issue. Also do you load the plugin first or set the keymap first?

thenbe commented 1 year ago

Also do you load the plugin first or set the keymap first?

Yup, that was the issue. Good shout.

This fixes it by making hardtime load after my keymaps:

return {
    {
        "m4xshen/hardtime.nvim",
+       event = "VeryLazy",
        opts = {}
    },
}
m4xshen commented 1 year ago

Thank you very much!

directormac commented 1 year ago

Also do you load the plugin first or set the keymap first?

Yup, that was the issue. Good shout.

This fixes it by making hardtime load after my keymaps:

return {
  {
      "m4xshen/hardtime.nvim",
+     event = "VeryLazy",
      opts = {}
  },
}

I tried doing this still j and k with gk and gj rebinding from lazyvim does not trigger hardtime, thanks @m4xshen you fixed it finally i mised hardtime for the past few days.