m4xshen / hardtime.nvim

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

Restricting <UP>, <DOWN>, <LEFT>, <RIGHT> does not work. #29

Closed Zhaith-Izaliel closed 1 year ago

Zhaith-Izaliel commented 1 year ago

Hi!

Describe the bug Setting up <UP>, <DOWN>, <LEFT> or <RIGHT> as restricted does not restrict them.

To Reproduce Steps to reproduce the behavior:

  1. Enable <UP>, <DOWN>, <LEFT> or <RIGHT> in setup.disabled_keys
  2. Restrict <UP>, <DOWN>, <LEFT> or <RIGHT> in setup.restricted_keys
  3. Open a file
  4. Move around with <UP>, <DOWN>, <LEFT> or <RIGHT>
  5. See no notification popping up or restriction applied on <UP>, <DOWN>, <LEFT> or <RIGHT>

Expected behavior Setting up <UP>, <DOWN>, <LEFT> or <RIGHT> in setup.restricted_keys should trigger the count mechanism.

Additional context Here is my configuration triggering the issue:

-- Hardtime
require('hardtime').setup {
  allow_different_key = true,
  enabled = true;
  restricted_keys = {
    ['<UP>'] = { 'n', 'x' },
    ['<DOWN>'] = { 'n', 'x' },
    ['<LEFT>'] = { 'n', 'x' },
    ['<RIGHT>'] = {'n', 'x' },
    ['+'] = {},
    ['-'] = {},
    ['g<UP>'] = { 'n', 'x' },
    ['g<DOWN>'] = { 'n', 'x' },
  },
  disabled_keys = {
    ['<UP>'] = {},
    ['<DOWN>'] = {},
    ['<LEFT>'] = {},
    ['<RIGHT>'] = {},
  },
}

Have a nice day!

m4xshen commented 1 year ago

Thanks for the feedback!

m4xshen commented 1 year ago

@Zhaith-Izaliel I just refactored the code of the plugin and I found that my old config contained incorrect key name. Now you should use <Up> <Down> <Left> <Right> instead of <UP> <DOWN> <LEFT> <RIGHT>.