Open E5ten opened 5 years ago
Using the characters 'y' and 'n' as values is so such a nice way to do this! After thinking about this, a simple approach that scales well might be to make pressed_g a usize
that just tracks the number of successive g keys in a row. So each non-g command would reset it to 0, while pressing g increments it. And if it equals 2, the scroll to top occurs, and it gets reset to 0 as well. If that makes sense.
@tcr That definitely sounds like a good way to do it, I'll try to see if I can figure that out.
Does this look like what you were talking about?
@tcr Is there anything keeping this open?
@tcr ?
The pressed_g value is used for pressing "gg" to go to the top of the page, given that I don't know rust I probably didn't use the best practices here, but the value is set from
n
toy
the first timeg
is pressed, and reset ton
after any other letter is pressed, on second press it will trigger going to the top of the page. All the other keybinds are just their non-vim counterpart with the key replaced.