Vim+顺风顺水,数字递增



当使用顺风时,有许多实用程序类,如px-1、py-1等。当使用Ctrl+a递增px-1时,它变为px0。如何将px-1上的Ctrl+a改为px-2?

不要。px-1中的-1被识别为负数,因此递增只能将其变为0

相反,使用<C-x>将其递减为-2或遵循此建议,在:help ctrl-a:下方发现几个屏幕

For decimals a leading negative sign is considered for incrementing/
decrementing, for binary, octal and hex values, it won't be considered.  To
ignore the sign Visually select the number before using CTRL-A or CTRL-X.

vimpx-1视为px-1。要使其成为-2,您不希望递增(-1+1=0(,而希望递减(-1-1=-2(。

递减命令为Ctrl+X:docs。

最新更新