sponsor Vim development Vim logo Vim Book Ad

textlink.vim : Another way to hyperlink plain text files. |FileName|@|SearchString| notation...

 script karma  Rating 16/4, Downloaded by 2570  Comments, bugs, improvements  Vim wiki

created by
Robert KellyIV
script type
This is (yet?) another way to implement hypertext styling linking in plain text files (a.k.a. source code).

The notation is extremely simple and easy to type (and comprehend at a glance): |FileName|@|SearchString| (even easier to understand at a glance with highlighting: see the Colors section of textlink.vim for details)

The format of a textlink is | filename to load_fullpath |@| text to search for |

Basically this is just :split FileName, gg, /SearchString. (ok very basically). You can omit loading of the file or searching for the SearchString if you like via the provided commands. You may also :vsplit if you like.

    Mnemonic: test text link
    Test text link. (echos the found FileName and SearchString)

    Mnemonic: text link
    :split, :edit FileName, gg, /SearchString (basically). This is to say splits the current window and loads the specified file name then searches for the specified SearchString from the top of the file.

    Mnemonic: text link file
    Like :TL save ignores the SearchString... basically a short cut to :split and gf

    Mnemonic: text link string (or search)
    Like :TL save ignores the FileName... useful when FileName is |T|
    (this file) and you do not want to split the window.

    Mnemonic: test text link
    Test text link. (echos the found FileName and SearchString)

    Same as the above commands save :vsplit vs :split.

    This will search for 'Examples:' in this file (T for this). useful with either :TL or :TLS

    This will search for 'Examples:' in the AlternateFile (A for alternate) from a.vim, see NOTE below. ? Wonderful for leaving notes about a function in a header file for instance.

|$VIM/vimfiles/plugin/textlink.vim|@|" Examples:|
    Environmental variables are expanded in the FileName portion, thanks to VIM :) In fact any(?) valid vim filename will work for FileName, I believe.

See: |~\cvs.html|@|if(somenum < 25 || somenum > 15)|, pretty cool eh?
    Although there can only be a single TextLink on any given line, it can appear anywhere in that line. (this is due to the greedy matching of the searchstring bars... to allow such a search string as this example..

Please see the comments in the file for more information and stuffs.

Also this can (and is setup to) use a.vim by Mike Sharpe (http://vim.sourceforge.net/scripts/script.php?script_id=31)

This works well enough to use everyday (I do) however there are probably a few quirks in it yet. (we all know how that goes ;) )

I hope this is as useful to you as it is to me :)

Also of note (text hyperlinking) see  Stefan Bittner's http://vim.sourceforge.net/scripts/script.php?script_id=293

Happy VIMing!

Removed buggy/broken versions below, as there was no reason to use them (they were buggy!). I believe 1.32 is (finaly stable, sorry for all the bugs in the first place!)
install details
To install simply drop into your plug in directory.
Load VIM and add text links (|Filename|@|searchstring|) to your files...
Then place your cursoe on the line (anywhere on the line) and :TL (or one of the other commands) when you want to transverse the textlink.

To remove, simple delete or rename textlink.vim from ye plugin directory.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
textlink.vim 1.4 2002-10-07 6.0 Robert KellyIV Should now accept absolute or full paths
You can now omit the T of for this file, i.e. || is valid and is the same as |T|.
Fixed one or two typos.
textlink.vim 1.32 2002-07-31 6.0 Robert KellyIV Added documentation on what to do with the color definitions and the like, small bug fix in the textlink-fragment.vim file. (embeded in textlink.vim)
textlink.vim 1.0 2002-07-21 6.0 Robert KellyIV Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.