<分区>
当 numbers <= 0.005 递增时,vim 的 Ctrl A 行为很奇怪。
由于个人需要,想得到一组从0.005开始每次递增0.005的数字, 像这样:
0.005
0.010
0.015
...
然后我想到了vim的宏和Ctrl A。
我在vim的第一行输入0.005,用y y p Ctrl A录制一个宏。但是当我将光标移动到 5 然后连续按 Ctrl A 时,第三次,数字直接从 0.007 变成了 0.010。如果我只按 3 次,输出将变为:
0.005
0.010
0.013
0.016
...
这意味着我无法使用 vim 完成任务。
在以其他方式完成此操作后,我开始对 vim 的 Ctrl A 的行为感兴趣。
以下文字来自vim的帮助手册:
:h CTRL-A
:
Add [count] to the number or alphabetic character at or after the cursor.
和:h计数
:
An optional number that may precede the command to multiply or iterate the command.
If no number is given, a count of one is used, unless otherwise noted.
当我测试其他一些数字时,我发现从 0.01 开始行为变得很奇怪。但我仍然不知道为什么 Ctrl A 会这样。
在开始阅读 vim 的源代码之前,有谁知道为什么 vim 的 Ctrl A 在小数点上会有这样的表现?
顺便说一句,我的PC环境是Win10,我使用的是从vim官网下载的vim_only_x64。