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 I employed exec
:
exe `resize `.i[1]
The following doesn't work, it always resizes to a height of 1 instead of the required i[1]
:
resize i[1]
So I understand that resize
takes a Number type and I am apparently feeding it a string, but I can't figure out how to avoid exec
.
Maybe there's a trick I can use to use the +
operator with 0
? In fact the Vim doc explicitly tells us to do this.
I tried it, but it doesn't work! It works with echo
but not res
.
Then I tried setting the value i[1] + 0
to a variable and then using that. Indeed it seems that when I use res
, it does not attempt to expand the value of variables. Really perplexing.
Is there another canonical fast way to convert an integer string into a Number? Perhaps some other thing is causing this unexpected behavior?