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

Increment zero-padded decimal #172

Open
digitalillusions opened this issue Apr 5, 2024 · 1 comment
Open

Increment zero-padded decimal #172

digitalillusions opened this issue Apr 5, 2024 · 1 comment

Comments

@digitalillusions
Copy link

digitalillusions commented Apr 5, 2024

First of all, thanks for the great plugin! I'm using codemirror through the Joplin note taking application, which also includes the ability to enable this vim plugin.

What I've noticed, is that the <Ctrl+a> operator does not seem to like my zero-padded numbers very much, and skips from "07", directly to "010". I dug a little into the source code and found that here

https://github.com/replit/codemirror-vim/blob/master/src/vim.js#L3280 ,

zero-padded numbers are assumed to be octal numbers. I'm not familiar with this notation convention as to me it seems almost more common to encounter 0 padded decimals than to assume an octal number. For the other cases in the list 0b and 0x the handling is obviously less ambiguous.

Just wanted to share my thoughts on this issue. I completely understand if the behavior is intentional, but (based on my very limited experience) I believe a large number of people would find handling 0 padded numbers as decimals to be more intuitive than handling them as octals.

EDIT: After further research, I've found that this is absolutely in line with the way vim handles this operation by default. However, vim allows the user to disable this by set nrformats-=octal. Is there maybe a way to add such a setting to this plugin?

@Lattay
Copy link

Lattay commented May 3, 2024

Hi,
Zero padded numbers denotes octal in C and JS (and yes it's a dumb legacy feature), so I don't see this changing, as JS is probably the number one target of codemirror.

Just passing by though, I am not a contributor of the project.

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

2 participants