Questions tagged [arithmetic]
Question about ways to make quick calculations in Vim.
7
questions
3
votes
1
answer
371
views
Expression register and fractions
I tried to use the arithmetic register with a fraction (7/8) and it returned 0! How do I exert better control over the register so that it gives me what I want?
The literal sequence I used, while in ...
6
votes
4
answers
3k
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.
7
votes
1
answer
2k
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 ...
27
votes
11
answers
17k
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
1
answer
154
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
17
votes
3
answers
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
3
answers
397
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 ...