vim: Sum numbers in a register

Tags: til vim terminal

It's handy to be able to use Vim's basic arithmetic operations to sum the contents of a register. For example, if you have copied a list of integers into the default register then this will sum them:

eval(substitute(@", '\n', '+', 'g'))
Published on: 10 Dec 2023