:so should take a range ?

22 views
Skip to first unread message

Marc Chantreux

unread,
Dec 31, 2021, 3:48:28 AM12/31/21
to vim...@googlegroups.com
hello people,

Years ago, i wrote a [range]Source so you can type some viml in your
current buffer and run it. This is useful in many situations (for
exemple cd to a directory refered in a log).

https://github.com/eiro/rcfiles/blob/master/vim/vimfiles/plugin/source_range.vim

I made a demo of this to some colleagues and someone asked why isn't it
a core feature. I have to admit i never thought about that but it makes
sense:

* doesn't conflict with another feature
* sourcing viml is obviously already implemented so i imagine adding a
range shouldn't be that hard

maybe none got the idea to ask so i do now :)

happy new year everyone.

regards
marc

M

unread,
Dec 31, 2021, 9:25:37 AM12/31/21
to vim...@googlegroups.com

пт, 31 дек. 2021 г., 11:48 Marc Chantreux <m...@unistra.fr>:
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/Yc68VArXcuLwMilG%40prometheus.u-strasbg.fr.

Hello,

Builtin :source adds file into the scripts list (cf. :scriptnames) and assigns script id (aka SID) which is essential for s: scope support. It won't be easy to reuse this SID by "a ranged source". And bringing "an incomplete feature" into the core could be too much confusing.

BTW. Using getline()+execute() or simply yanking and then executing a register with :@0 looks nicer, imo, then storing data into temporary file.

Regards,
Matvey

Marc Chantreux

unread,
Jan 2, 2022, 9:53:56 AM1/2/22
to vim...@googlegroups.com
hello,

> Builtin :source adds file into the scripts list (cf. :scriptnames) and
> assigns script id (aka SID) which is essential for s: scope support. It
> won't be easy to reuse this SID by "a ranged source". And bringing "an
> incomplete feature" into the core could be too much confusing.

thanks for this answer. totally agreed!

> BTW. Using getline()+execute() or simply yanking and then executing a
> register with :@0 looks nicer, imo, then storing data into temporary file.

wow... i wasn't aware of :@ and 99% of the usage of this macro can be
solved by one of those: Y:@0<cr> or yap:@0<cr>.

i deprecate So and probably will remove it. thanks a lot.

marc
Reply all
Reply to author
Forward
0 new messages