Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement 2 pairs of inc/dec commands: one shall pad with zeros, another shall not #6

Open
maximbaz opened this issue Jan 5, 2015 · 2 comments

Comments

@maximbaz
Copy link

maximbaz commented Jan 5, 2015

searches for number up to eol and then increments or decrements and keep zero padding up (unlike in vim)

@cofi, out of curiosity, what was the rationale behind this decision?

I'm sure there are pros and cons in both approaches, and padding doesn't always suit as well (see @mlf176f2's PR for just one of many examples).

I think it makes sense to have 2 pairs of commands, one shall pad with zeros, another shall not.
And no need to implement fancy rules to determine, when to use padding.


P.S. This may be better discussed in a separate thread, but currently padding works only for positive numbers, e.g. decrement from 10 gives 09, while increment from -10 gives -9.

@maximbaz maximbaz changed the title Make padding with zeros optional Implement 2 pairs of inc/dec commands: one shall pad with zeros, another shall not Jan 5, 2015
@dieggsy
Copy link

dieggsy commented Jan 3, 2017

I think I've implemented this in the padding-tests branch of my fork. It has evil-numbers/inc-at-pt-pad and evil-numbers/dec-at-pt-pad that preserve padding (consistently for negatives too, I think), where the original functions do not preserve it.

I'm pretty sure it still has some kinks to work out, though.

Edit: pulled into master of my fork, for now. I think most if not all of the "kinks" were present even before my changes.

@juliapath
Copy link

juliapath commented Nov 12, 2018

My fork has this. There is a variable evil-numbers/padDefault (off by default), which enables or disables padding globally and in addition every command takes an optional padded argument, so you could easily make a commands inc-at-pt-pad and inc-at-pt-nopad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants