goldfeld / vim-seek

Seek makes navigating long lines effortless, acting like f but taking two characters.
MIT License
467 stars 20 forks source link

Made falling back to substitute configurable & added count to seek motion #8

Closed simu closed 11 years ago

simu commented 11 years ago

Added functionality for seeking with counts (e.g. 2sco will go to the 2nd occurrence of 'co' in the same line) while sacrificing the ability to use 's' for substitution (I never use it). Also added a configuration option (g:seek_subst_disable) which defaults to 0. The default leaves the behaviour of seek.vim unchanged.

goldfeld commented 11 years ago

Hey, this is cool! We need to mind a few things before a merger. First note I have added new functions, so ideally count would work with all of them. Also mind the indentation, it's all 2 spaces, no tabs. Finally, only the s seek needs to check for subst_disable, and actually I would suggest checking at mapping's time, and mapping to either seek (takes a count) or to seekOrSubst (passes count to substitute as currently). This would avoid an extra if check for every seek for people who don't use it.

simu commented 11 years ago

Hi,

thanks for the feedback. I've updated my changes to use two functions (find_target_fwd and find_target_bwd) to calculate the amount of characters to jump. This makes it easier to use counts in any functions that might be added. Also, I checked that there are no tab-indents (there weren't afaict).

Regarding the checking of the configuration flag, I've made the change you suggested, although there is the argument of leaving it in s:seek because then you can change the behaviour by just running :let g:seek_subst_disable = [01] in an open vim session.

goldfeld commented 11 years ago

Sorry about the delay, and thanks so much, great code! I wanted to merge this cleanly through a rebase, and I'm not yet completely at home with the workflow, so it took a bit getting around to it. I've also done some tweak commits on top of it, if you wanna look through--simple stuff. Let me know if I broke anything for you, but it seemed to be all working here.