为什么在 Vim 中使用 CTRL-A 递增会使我从“07"?到“10"? [英] Why does incrementing with CTRL-A in Vim take me from "07" to "10"?

查看:24
本文介绍了为什么在 Vim 中使用 CTRL-A 递增会使我从“07"?到“10"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac Terminal Vim 中有一系列数字,我通过按 CTRL-A 来增加这些数字.Strangley,当我在 07 时,数字跳到 010 而不是 08.我刚刚尝试了 MacVim 并发生了相同的行为.有谁知道为什么?

I have a series of numbers in Mac Terminal Vim which I am incrementing by pressing CTRL-A. Strangley, when I am at 07, the number skips up to 010 instead of 08. I just tried MacVim and had the same behavior occur. Does anyone know why?

注意:两种 Vim 都适用于 7.

Note: Both Vim's work perfectly for 7.

推荐答案

因为前导零是一种广泛使用的八进制表示法,其中 7 后面的数字是 10.根据 维基百科,在 C 编程语言、Python、Perl、Unix shell bash 和其他语言中使用前缀 0 来指定八进制数".

Because a leading zero is a widely used notation for octal, in which the number that comes after 7 is 10. According to Wikipedia, "a prefix 0 is used in the C programming language, Python, Perl, the Unix shell bash, and other languages to specify octal numbers".

这篇关于为什么在 Vim 中使用 CTRL-A 递增会使我从“07"?到“10"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆