m4xshen / hardtime.nvim

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

Detect more complicated actions / commands #10

Closed smjonas closed 1 year ago

smjonas commented 1 year ago

Thanks for the plugin! While I haven't tried it myself, it seems like the scope of this plugin is currently mostly focused around Vim movements such as hjkl. In the past, there have been other requests for a plugin that can detect more complex actions / Vim motions and suggest better alternatives. So my first question is: is that even something you would consider for this plugin or should it stay relatively simple in scope?

As an example, I could imagine things like:

While the above suggestions should be relatively simple to implement, there are many many others that can get arbitrarily more complicated since they require analyzing a part of the buffer's edit history (i.e. the last n changes). Examples:

One could even suggest plugins to simplify certain actions:

Ideally, it should be possible to dismiss certain suggestions in which case it won't be shown for the current session or never again. Let me know if you could imagine such suggestions as part of the plugin or not! :)

m4xshen commented 1 year ago

Thanks for your long feedback! I would definitely consider to add more complicated actions for detection. My first goal is to add the general delete + insert motion into change motion.

As for:

ciwsample => suggest cbs instead

This kind of detection is more complicated and I'll try to implement after finishing the first one.

btw these two are already in hardtime.nvim:

$ + a => A; ^ + i => I

juiceDeLemon commented 1 year ago

maybe f\<char>h should trigger a warning "Use t\<char> instead of f\<char>h" and the reverse ("F\<char>l" -> "T\<char>" and "t\<char>l" -> "f\<char>" and "T\<char>h" -> "F\<char>")

juiceDeLemon commented 1 year ago

ah I just thought of more. "diwi" should be shortened to "ciw". basically "d something i" -> "c something". I don't know the operator mode would work though.

m4xshen commented 1 year ago

My first goal is to add the general delete + insert motion into change motion.

Yeah this is just what I want to do first. Thanks!

m4xshen commented 1 year ago

You can now get the hints about delete + insert and f/F/t/T in the latest version! You can also write your own hints in the config. See examples