Questions tagged [arithmetic]

Question about ways to make quick calculations in Vim.

Filter by
Sorted by
Tagged with
0
votes
3answers
482 views

How do you sum up integers on separate lines in vim?

I have a list of integers, where each is on a separate line. I'm trying to find a quick way to sum them up directly in VIM without having to write a script that does it for me.
5
votes
1answer
1k views

How do I use a variable with an ex command?

I wrote a moderately complex routine for Vim and I need to programmatically set the height of windows. The way to do this is with :resize [N] as the help says. But my invocation didn't work until ...
15
votes
8answers
6k views

Quickly calculate the total of a column of numbers

I'm writing down a markdown table which looks like this: | 13/05/15 | 09:30-16:00 | 6.5 | | 14/05/15 | 10:00-16:30 | 6.5 | | 16/05/15 | 15:30-01:00 | 9.5 | | 21/05/15 | 09:00-16:30 | 7.5 | | 22/...
0
votes
1answer
134 views

Why is division of a negative number by 0 not the minimum number? [duplicate]

Related to Why does vim allow to divide by zero, what's going on here? :let a=-42/0 :echo a -2147483647 :let b=a - 1 :echo b -2147483648
15
votes
3answers
2k views

Why does vim allow integer division by zero?

I just discovered that vim obviously allows division by zero: :let a=42/0 :echo a prints 2147483647 (which is the value of a). Is this documented somewhere and why does vim allow division by zero?
10
votes
3answers
286 views

Like Ctrl-A and Ctrl-X but modify only the first digit

Is there a way to increase/decrease first digit after/under cursor, not the whole number. I know it's not how vim works, but is there a plugin that does that? I was unable to find it. It is very ...