文本编辑器和基于文本文件的超链接
背景:
一些文本编辑器和 IDE 的功能似乎开始变得更加“类似于浏览器”。具体来说,这样的功能之一就是能够将打开的文本缓冲区中的普通文本视为另一个文件、资源甚至可运行命令的超链接。
将其编程为编辑器插件或宏
由于这似乎是一个好主意,我已经开始编写一些脚本和编辑器插件来完成这种事情,以便文本编辑器的用户可以打开或对以下样式的链接进行操作:
href="c:/files/foobar.txt" (click to open file)
href="c:/files/foobar.txt" jumpto="34" (jump to a line number)
href="c:/files/foobar.txt" find="Lorem" (jump to 1st line containing word)
href="find_in_files://c:/files" find="Lorem" (show all matching lines)
[[find_in_files://find=Lorem;exten=*.htm*]] (alternate syntax option)
href="redir://c:/files/feebar.txt" (replace current edit buffer)
href="run://c:/files/foobar.jpg" (open in default image editor)
[[run://c:/files/foobar.jpg;runwith=foo.exe]] (alternate syntax option)
问题:
- 是否有任何类型的新兴约定用于形成基于文本的超链接?
- 如果有此类事情的约定,是否有已发布的规范?
- 您最喜欢的编辑器/IDE 中有这个想法的实现吗?
- 对于这个想法,是否有一种不使用超链接的替代现有方法?
- “祖父”编辑器如何处理此功能? (Vim,Emacs)
更新:
看起来这个问题可以得到澄清,但事实证明 Emacs Org 模式是我正在寻找的一个具体示例,可以回答我的所有问题。
Background:
It seems that some text editors and IDEs are starting to get more "browser-like" in their features. Specifically, one such feature is the ability to treat ordinary text in an open text buffer as a hyperlink to another file, resource, or even a runnable command.
Programming this as an editor plugin or macro
Since this seems like a good idea, I have started programming some scripts and editor addons to do this very kind of thing, so that the user of a text editor can open or operate on links of the following style:
href="c:/files/foobar.txt" (click to open file)
href="c:/files/foobar.txt" jumpto="34" (jump to a line number)
href="c:/files/foobar.txt" find="Lorem" (jump to 1st line containing word)
href="find_in_files://c:/files" find="Lorem" (show all matching lines)
[[find_in_files://find=Lorem;exten=*.htm*]] (alternate syntax option)
href="redir://c:/files/feebar.txt" (replace current edit buffer)
href="run://c:/files/foobar.jpg" (open in default image editor)
[[run://c:/files/foobar.jpg;runwith=foo.exe]] (alternate syntax option)
Questions:
- Is there any kind of emerging convention for forming text-based hyperlinks?
- If there is a convention for this kind of thing, is there a published specification?
- Is there an implementation of this idea in your favorite editor/IDE?
- Is there an alternate pre-existing approach for this idea that does not use hyperlinks?
- How is this feature handled in the "grand-daddy" editors? (Vim, Emacs)
Update:
It looks like the question could have been clarified, but it turns out that Emacs Org mode is one specific example of what I was looking for that answers all of my questions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Emacs 的 Org-Mode 支持各种超链接。
Emacs' Org-Mode has support for all kinds of Hyperlinks.
Vim 有几个添加超链接和标记的脚本。其中最受欢迎的一个是 Viki。
There are several script for Vim that add hyperlinks and markup. One of the most popular is Viki.
大多数情况下,听起来你正在尝试解决一个不存在的问题。
Mostly it sounds like you're trying to solve a problem that doesn't exist.
jumpto="34"
和find="Lorem"
肯定可以替换为网络浏览器风格的#
和吗?< /code> 标记。
所以你的第二个和第三个例子看起来像这样:
尽管,正如罗杰·佩特上面所说,听起来你正在解决一个不存在的问题。
Surely the
jumpto="34"
andfind="Lorem"
could be replaced with web-browser-style#
and?
marks.So your second and third example would look like so:
Although, as Roger Pate says above, it does sound like you're solving a problem that doesn't exist.
Emacs 还具有“find-file-at-point”功能,您可以使用 Mx ffap 调用它
Emacs also has "find-file-at-point", which you can invoke with M-x ffap
另请参阅 LinkD。没有什么比 Org 更花哨的了。简单,小。
See also LinkD. Nothing fancy like Org. Simple, small.