m4xshen / hardtime.nvim

Establish good command workflow and quit bad habit
MIT License
1.35k stars 27 forks source link

Feature: Expose state of 'enabled' #48

Closed schilkp closed 12 months ago

schilkp commented 12 months ago

Hi!

Adds a M.is_enabled() function to expose the current state of hardtime. Useful for statuslines and many different things :)

Apologies if this is already possible - I had a very quick look and did not see it.

Thanks!

m4xshen commented 12 months ago

How about just make the enabled variable exposed?

change this:

local enabled = false

to this:

M.enabled = false
schilkp commented 12 months ago

If that works - sure. I don't know lua very well. Is theM table effectively a singleton or would multiple require('hardtime')s have individual M tables? I presumed it was a local for that reason :)

Edit: Just realized M is a local as well - so that logic is flawed. They would behave the same.

m4xshen commented 12 months ago

Thank for the PR! Btw, I just rename it from M.enabled to M.is_enabled. I found that this is more clear.

schilkp commented 11 months ago

Thanks!