Date Tags vim

Vim can do some arithmetic for you. The simplest one are ctrl+a (add) and ctrl+x (subtract) actions. They find nearest digital number in the current line and add/subtract one to/from this number. You can prepend them with count to add/subtract more than one. It’s not very sophisticated but proves to be useful, especially in macros.

That’s not all, however. Vim has a special = arithmetic register. Unlike other registers, you can’t save any text inside of it - it’s read-only. After you press =, you will be dropped in a last line where you can put an expression that will be evaluated. So to paste 180, you can use for example "=3*60<ENTER>p.

You can paste content of any register without quitting insert mode using <ctrl-r>X (where X is the register name). This is very handy when combined with arithmetic register. When in insert mode, you can use <ctrl-r>=3*60<ENTER> to enter 180.

Unfortunately you can’t to extended math using arithmetic register. You can use bc to do this, however. You can send current line to bc and replace it with bcs output using !!bc (equivalent to :.!bc) command. So for example, to insert value of 2^64 to vim, use o2^64<ESC>!!bc.