scripting language for immediate use

62 views
Skip to first unread message

rameo

unread,
Mar 24, 2012, 5:40:49 AM3/24/12
to vim_dev
Would it be possible in a next release to use vim scripting language
without putting it in menu.vim or .vimrc?
For immediate, temporary scripting.
p.e.in a little window beside the vim window.

This gives the possibility to do little things very quickly without
the use of macros.
p.e.

for i in range (3,30)
print (put) "2**".i."=".2**i
endfor


output:

2**3 = 8
2**4 = 16
...
etc

Gary Johnson

unread,
Mar 24, 2012, 8:00:29 PM3/24/12
to vim_dev
On 2012-03-24, rameo wrote:
> Would it be possible in a next release to use vim scripting language
> without putting it in menu.vim or .vimrc?
> For immediate, temporary scripting.
> p.e.in a little window beside the vim window.
>
> This gives the possibility to do little things very quickly without
> the use of macros.

You can already do this.

:new
<type your little thing>
ggyG
:@"

See

:help :@

Regards,
Gary

John Little

unread,
Mar 24, 2012, 11:42:01 PM3/24/12
to vim...@googlegroups.com
On Saturday, March 24, 2012 10:40:49 PM UTC+13, rameo wrote:

> p.e.in a little window beside the vim window.

Well, if you type exactly

:for i in range(3,30)
put ='2**' . i . ' = '.printf('%-10.0f',pow(2,i))
endfor

That's exactly what will appear, in a few lines at the bottom of the vim "screen". Admittedly, it will disappear when you press enter after the endfor, but you can see it again if you open the "command-line-window", see
:h command-line-window

regards, John

Marcin Szamotulski

unread,
Mar 25, 2012, 4:51:37 AM3/25/12
to vim...@googlegroups.com
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.

What about using the ':help Ex-mode' (for example with gQ).

Best,
Marcin

John Little

unread,
Mar 25, 2012, 5:41:09 PM3/25/12
to vim...@googlegroups.com
On Saturday, March 24, 2012 10:40:49 PM UTC+13, rameo wrote:

> This gives the possibility to do little things very quickly without
> the use of macros.

One can already do such things very quickly, just using the existing command mode prompt. If you type exactly (ending each line with enter)

:for i in range(3,30)
put ='2**' . i . ' = '.printf('%-10.0f',pow(2,i))
endfor

it will run there and then. You could check out the command-line-window, too, see :h cmdwin

Regards, John

John Little

unread,
Mar 25, 2012, 5:52:26 PM3/25/12
to vim...@googlegroups.com
Sorry guys, the new google groups web interface appeared to have lost my first post; it did not show when I reviewed the thread. Cursing, I retyped it, then the first one popped back. Perhaps some interaction with my browser cache; I've noticed that when I uncheck "Let pages override these settings" in my colour preferences, some threads that have had new replies show as the colour for a visited link, which in the old google groups indicated I'd read it up to date, and was a more reliable indication than the "new of" legend.

Regards, John

mattn

unread,
Mar 25, 2012, 9:35:02 PM3/25/12
to vim...@googlegroups.com

:call setline('.', map(range(3,30), 'printf("2**%d = %-10.0f", v:val, pow(2, v:val))'))

lilydjwg

unread,
Mar 26, 2012, 1:03:14 AM3/26/12
to vim...@googlegroups.com
On Sat, Mar 24, 2012 at 02:40:49AM -0700, rameo wrote:
> Would it be possible in a next release to use vim scripting language
> without putting it in menu.vim or .vimrc?
> For immediate, temporary scripting.
> p.e.in a little window beside the vim window.
>
> This gives the possibility to do little things very quickly without
> the use of macros.
> p.e.
>
> for i in range (3,30)
> print (put) "2**".i."=".2**i
> endfor

Would you try my 'Rcode' plugin[1]? You can type the code in a temporary
small buffer and run it.

[1]: http://www.vim.org/scripts/script.php?script_id=3705

--
Best regards,
lilydjwg

Linux Vim Python 我的博客:
http://lilydjwg.is-programmer.com/
--
A: Because it obfuscates the reading.
Q: Why is top posting so bad?

rameo

unread,
Mar 27, 2012, 3:49:51 AM3/27/12
to vim...@googlegroups.com
Thank you all.
Thanks also for the Rcode plugin.
I'll check it out.
Reply all
Reply to author
Forward
0 new messages