m4xshen / hardtime.nvim

Establish good command workflow and quit bad habit
MIT License
1.5k stars 25 forks source link

Feature: `cond` function #44

Closed dtomvan closed 1 year ago

dtomvan commented 1 year ago

I don't want hardtime in the way when recording macros, at all. The macro pressure is enough, you know :)

My solution is at follows: introduce a cond configuration function. It could be used as follows.

require('hardtime').setup {
    cond = function(_key)
        return #vim.fn.reg_recording() == 0
    end,
}
m4xshen commented 1 year ago

I already consider the condition of executing macro. You can just open a pr to add the condition of recording. I think it is much simpler.

dtomvan commented 1 year ago

Alright, but I wanted to consider any other reasons to specify a condition. What if you wanted to disable it for any other non builtin reason? Then cond could be used.

m4xshen commented 1 year ago

I understand your concern, but I haven't thought of any other reasons to disable it.

dtomvan commented 1 year ago

Alright, PR'ing somewhere tonight, then 😅