Friday, December 31, 2021

Re: :so should take a range ?


пт, 31 дек. 2021 г., 11:48 Marc Chantreux <mc@unistra.fr>:
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

--
--
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+unsubscribe@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

--
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAFsTB%2BKRyKtx9Uo5kNzFDma0xZXVguf_F%3DMbrNpJV1a925ahMw%40mail.gmail.com.

No comments: