m4xshen / hardtime.nvim

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

Prompt / force exiting Insert mode if found idling for x seconds #111

Closed csessh closed 3 weeks ago

csessh commented 1 month ago

I have struggled for a little while to shake old habits from VSCode days, including navigating mid-edit.

This means I (still) occasionally navigate while in Insert mode, which isn't recommended. Redditors seem to unanimously agree on "Don't navigate in Insert mode, exit as soon as you're done typing/editing".

So that's a shift in mind set I have been working on. I'm happy to submit a PR for this feature if accepted.

The gist of it would be:

Cheers,

m4xshen commented 1 month ago

Hi @csessh, that's an interesting feature. However, hardtime.nvim by default disables the arrow key in insert mode, so I think this is enough for user to quit the habit of navigating in insert mode. Could you please provide some example situation when you still navigate in insert mode?

csessh commented 1 month ago

I haven't used arrow keys in a while now, thanks to hardtime.nvim. re the navigation in Insert: Quite often I found myself do this with brackets/quotes:

foo()j

the j key is my attempt to go back in between ().

Or

config = function()
endk

the k is my attempt to go up a line to write this function.

Or

often times, I find myself just sitting in Insert mode without returning to normal mode. So as soon as I need to navigate, I just do without checking to see if I'm in Normal mode. The requires multiple additional keys pressed to undo before I can resume navigating.

csessh commented 1 month ago

@m4xshen It's a good/fun bit of practice for me anyway, so I created a PR. any feedback would be welcome