dreftymac
dreftymac

Reputation: 32360

Text editor and text-file-based hyperlinks

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:

  1. Is there any kind of emerging convention for forming text-based hyperlinks?
  2. If there is a convention for this kind of thing, is there a published specification?
  3. Is there an implementation of this idea in your favorite editor/IDE?
  4. Is there an alternate pre-existing approach for this idea that does not use hyperlinks?
  5. 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.

Upvotes: 6

Views: 5162

Answers (6)

Drew
Drew

Reputation: 30701

See also LinkD. Nothing fancy like Org. Simple, small.

Upvotes: 1

offby1
offby1

Reputation: 6983

Emacs also has "find-file-at-point", which you can invoke with M-x ffap

Upvotes: 1

Dave Kirby
Dave Kirby

Reputation: 26552

There are several script for Vim that add hyperlinks and markup. One of the most popular is Viki.

Upvotes: 4

huaiyuan
huaiyuan

Reputation: 26519

Emacs' Org-Mode has support for all kinds of Hyperlinks.

Upvotes: 5

ℳ                            .
ℳ  .

Reputation: 361

Surely the jumpto="34" and find="Lorem" could be replaced with web-browser-style # and ? marks.

So your second and third example would look like so:

href="c:/files/foobar.txt#34"       (jump to a line number)
href="c:/files/foobar.txt?Lorem"    (jump to 1st line containing word)

Although, as Roger Pate says above, it does sound like you're solving a problem that doesn't exist.

Upvotes: 2

Roger Pate
Roger Pate

Reputation:

  1. URLs, such as http://example.com/ (notice SO automatically links that), and sometimes a "www." prefix, just because it's so common. Email addresses are another example commonly recognized.
    • But not this quasi-xml-attribute stuff you have.
  2. Of course not; once you try and make plain text follow some convention, you no longer have plain text.
  3. Yes, see #5.
  4. Yes, see #5.
  5. It's extremely common for editors, especially programmers' editors, to have scripts, macros, tools, or whatever-they-want-to-call-it. Usually these are not controlled directly by the text in the file, but may use the file, filename, selection, cursor position, directory of the current file, etc. I expect many good programmers use such features without thinking about them anymore.

Mostly it sounds like you're trying to solve a problem that doesn't exist.

Upvotes: 3

Related Questions