PracticalVim Tip10 - yszheda/wiki GitHub Wiki

Tip 10: Use Counts to Do Simple Arithmetic

Return to the top: <>

  • ``: addition on number
  • ``: subtraction on number

Example:

Naive way to change 0 into -180:

A better way using ``:

Vim interprets numerals with a leading zero to be in octal notation rather than in decimal.

For example: `` on `007`, you will obtain `010` rather than `008`.

To disable this feature, add the following line to your `vimrc`:

References:

⚠️ **GitHub.com Fallback** ⚠️