1 *utl_usr.txt* Plugin for executing URLs in plain text files
\r
3 For Vim version 6, Version: utl-2.0, $Revision: 1.1.1.1 $
\r
13 1. Intro........................|utl-intro|
\r
14 2. Getting started..............|utl-getstart|
\r
15 3. Tutorial.....................|utl-tutorial|
\r
16 4. Examples of use..............|utl-examples|
\r
17 5. Tips, details, pittfalls.....|utl-tipsdetails|
\r
18 7. Changes since Utl/Thlnk-1.2..|utl-changes|
\r
19 8. Todo list....................|utl-todolist|
\r
20 9. Credits......................|utl-credits|
\r
23 See |utl_ref.txt| for some reference material.
\r
24 See http://vim.sf.net/script.php?script_id=293 for installation instructions
\r
26 See |utl-changes| for things that have changed in this version.
\r
28 Any comments, bug reports, pachtes, fixes and suggestions are welcome, and
\r
29 sometimes needed for my motivation. See |utl-todolist| if you want to
\r
33 Stefan Bittner <URL:mailto:stb@bf-consulting.de>
\r
35 ==============================================================================
\r
36 1. Intro *utl-intro*
\r
43 * It brings the benefits of URL-based hyperlinking to the realm of plain text,
\r
44 extending the URL syntax for plain text needs, in accordance with the RFC 2396
\r
47 * It's a handy utility for you right away
\r
50 surfing text files, executing text ...
\r
53 What is it good for?
\r
54 --------------------
\r
56 * Enables Vim to be your central desktop application, for instance:
\r
58 - Easily navigate in collections of related text files via hyperlinks
\r
59 - Call web browser and email client on URLs (configurable protocol handlers)
\r
60 - Call MS-Word on .doc files, Acrobat Reader on .pdf, Windows Explorer on
\r
61 directories, IrfanView on .jpg etc. (configurable media type handlers)
\r
62 - Maintain pictures from your digicam based on a text file
\r
63 - Maintain a personal info file containing hotlinks
\r
65 * Use it for project management, software development, report preparation and
\r
66 technical writings. For instance:
\r
68 - Reference emails from text files
\r
69 - Reference bug tracker database from a text file
\r
71 * Smart usages. For instance:
\r
73 - Embed vim commands in text files and source code.
\r
74 - Use it as light weight spell checker,
\r
75 - or for dictionary lookups.
\r
76 - Start programs using Utl.
\r
77 - Use it for relative editing and
\r
78 - for navigating HTML source code.
\r
80 * Use it for quality commenting of source code. For instance:
\r
82 - Reference related code with hot links, e.g. reference the definition of a
\r
84 - Reference design papers, UML diagrams, man pages etc from source code
\r
85 - Turn references like "see below" and "type zR to open the folds" into
\r
92 * You only need to know one single command to get started: \gu = Go URL
\r
94 1. Type :help utl-getstart
\r
95 2. Hit \gu on the live examples given there
\r
97 As a reader of texts containing URLs that's all! As an author you have to
\r
98 know how to write URLs. But utl.vim gives you a training. And what you
\r
99 will learn is 90% general knowlegde about URLs that you can use elsewhere.
\r
101 * Utl.vim is friendly:
\r
102 No side effects, fits seamlessly into your Vim Session, well documented.
\r
104 Want to give Utl a try? Fine, so lets just dive into the live examples:
\r
107 ==============================================================================
\r
108 2. Getting started *utl-start*
\r
110 Utl.vim's basic mapping is \gu which stands for "Go Url". That's all you need!
\r
112 Note: If you have changed the mapleader string your actual mapping might also
\r
113 be ,gu or _gu or whatever, see |mapleader|.
\r
115 Live Examples now!!!
\r
117 Position the cursor on the next line:
\r
119 Then hit `\gu'. This should take you ...
\r
122 You just executed your first link!
\r
123 `#r=abc' refers to a position in the document, that looks like `id=abc'. (If
\r
124 you know HTML: that's analogues to a <A HREF="#abc"> which refers to
\r
125 ID="abc".) The `r' in the expression stands for `reference'.
\r
127 Hitting `\gu' on <URL:#tn=some text> takes you to ... some text.
\r
129 The special syntax `tn=' just means that the target of the link is defined by
\r
130 searching the denoted string (some text) in forward direction (tn stands for
\r
131 Text Next). You can leave away the `tn=' prefix and just write <URL:#some
\r
132 text> because the tn= is the default prefix.
\r
134 Hitting `\gu' on <URL:utl_ref.txt> takes you to the file utl_ref.txt.
\r
136 Please come back here again after having executed the link!
\r
138 Hitting `\gu' on <URL:utl_ref.txt#tn=^thanks for> takes you to a specific
\r
139 position in the file utl_ref.txt. This example can be seen as the combination
\r
140 of the two previous examples: URL + #xxx
\r
142 The #xxx suffix is called a fragment expression in URL lingo.
\r
144 Hitting `\gu' on <URL:http://www.vim.org> will invoke your web browser with
\r
145 that URL. Just try it, Utl will assist you to set up your favorite browser.
\r
147 You can leave away the <URL:...> embedding. Try for example:
\r
151 or even +------- This is also a link which you should execute :-)
\r
153 www.vim.org [#r=foot1]
\r
155 An advantage of embeddingless links is that normally you will find URLs in
\r
156 given documents in this form. Also, some people find the <URL:...> embedding
\r
157 too clunky. The disadvantage is that there is no safe parsing for "naked" URLs
\r
158 and as one consequence of this, no syntax highlighting.
\r
160 You can also type an URL in the command line:
\r
162 :Gu utl_ref.txt # Edit file in same directory as current file
\r
163 :Gu www.google.com # Start web browser from within vim. Sometimes
\r
164 # faster than from desktop :-)
\r
166 If you feel it's now time for a "hello world" test, just go ahead and write
\r
167 your own links. There is no meta data and no tags file needed. Its nothing
\r
170 Before you seriously start using utl.vim it is recommended to continue with
\r
171 reading the next chapter, 3, Tutorial. If you are in doubt if Utl valuable for
\r
172 you, have a look at chapter 5, Examples of use, |utl-examples| first.
\r
175 ==============================================================================
\r
176 3. Tutorial *utl-tutorial*
\r
179 3.1 Forth and back *utl-tutforthback*
\r
181 From the previous chapter you already know how to follow links by hitting \gu
\r
182 when a link is under the cursor.
\r
184 The following link, as you know, takes you to another file:
\r
188 Try this now! ... No, Wait! To come back here again, just use the regular
\r
189 vim command CTRL-O. That's the BACK-Button in the "Vim browser" - and it might
\r
190 need to be typed more than once.
\r
193 Hope you are back again.
\r
196 3.2 Relative and absolute URLs *utl-tutrelabs*
\r
198 The following URLs are all equivalent:
\r
201 <URL:./utl_ref.txt>
\r
202 <URL:../doc/utl_ref.txt>
\r
204 These are all _relative_ URLs. This means that the path given in the URL is
\r
205 relative to the path of the document containing the URL. Note that this is
\r
206 different to Vim's :e command where file names are relative to the current
\r
207 working directory (see |:pwd|). Whenever possible you should use relative
\r
208 URLs. But sometimes you need _absolute_ URLs, just as you sometimes need
\r
209 absolute path names with Vim's :e command. Here is an absolute URL[#r=foot3]:
\r
211 <url:file:///home/stb/.vim/doc/utl_ref.txt>
\r
213 An absolute URL _always_ has a so called scheme (also called protocol) in
\r
214 front, e.g. file: , http:, mailto: . (And, if there is a protocol in front it
\r
215 always is an absolute URL.) What also makes sense is to write the above URL
\r
216 without the protocol:
\r
218 <url:/home/stb/.vim/doc/utl_ref.txt> # equivalent to above
\r
220 This is a relative URL (because there is no protocol) ... containing an
\r
221 absolute path. The contrary does not make sense: An absolute URL with a
\r
224 <url:file:./utl_ref.txt> # WRONG!!! Absolute URL with relative path
\r
225 # makes an invalid URL.
\r
227 Under Windows you can specify drive letters like this:
\r
229 <url:file://d:/path/to/foo.txt> or, which is the same,
\r
230 <url://d:/path/to/foo.txt>
\r
232 This is in conformance with URL specifications. Note that you always should use
\r
233 forward slashes, no matter on what OS you are; URLs are universal and are
\r
234 independent of the OS.
\r
237 3.3 Fragments *utl-tutfrags*
\r
239 Now lets add fragments to the URL.
\r
240 The next link again references the same file as in the above examples, but is
\r
241 extended by a fragment expression. That way a specific position in the target
\r
242 file can be jumped to. Try to execute the link:
\r
244 <URL:utl_ref.txt#tn=thanks for>
\r
246 and come back again with CTRL-O. The next link specifies the same file, but
\r
247 the fragment expression is different:
\r
249 <URL:utl_ref.txt#r=foot1>
\r
251 Execute it and come back again! It took you to about the same position as the
\r
252 previous link, but by other means. The fragment `#r=foot1' means, that the
\r
253 file utl_ref.txt is searched for the ID reference `foot1'. What follows r=
\r
254 should be a simple string (an identifier to be exact).
\r
256 The #tn fragment has one big advantage over #r= fragments. It allows to
\r
257 refer to specific positions in the target document without the need to
\r
258 modify that target document, either because you don't want it or because you
\r
259 don't have write access. The advantage of the ID reference fragment is that
\r
260 the link is more robust.
\r
262 #tn= and #r= are the most important fragment specifiers in utl.vim. As
\r
263 already said, the #tn= prefix is the default prefix, i.e. you can leave it
\r
264 away. Thus the link above ( #tp=thanks ) will normally be written shorter:
\r
266 <URL:utl_ref.txt#thanks for>
\r
268 This is also called a naked fragment identifier because there is no `key='
\r
271 Here is an overview of the available fragment expressions:
\r
273 #tn=text Same as #text
\r
274 #tp=text Stand for `t'ext `p'revious, i.e. define position by
\r
275 searching first occurance of `text' in backward direction.
\r
276 #line=123 Position defined by line number. Most useful for documents
\r
278 #r=identifier Position defined by the id `identifier'
\r
280 See |utl-fragexpr| for some explanation.
\r
283 3.4 Other media types *utl-tutmtypes*
\r
285 URLs are not restricted to .txt files or web pages. You can, for instance,
\r
286 reference a MS-Word document:
\r
290 To make this work you have to define a handler for .doc type files. Utl tries
\r
291 to make this a painless as possible through a smart setup facility. Go and
\r
292 execute the above link to see how this works. In URL and Utl terms a .doc type
\r
293 file is said to be of media type "application/msword". You can define a
\r
294 handler for any media type you like. See the explanations under
\r
295 <URL:config:#r=mediaTypeHandlers>. Here is a list of other typical media
\r
296 types for which you might want to set up handlers:
\r
298 <url:foo.pdf> # PDF documents
\r
299 <url:foo.rtf> # Rich text format documents (emails)
\r
300 <url:foo.ppt> # Powerpoint documents
\r
301 <url:foo.xls> # Excel sheets
\r
302 <url:img_0108.jpg> # All kinds of images
\r
303 <url:path/to/some/directory>
\r
304 # Call Vim explorer, Windows explorer, shell etc. on
\r
308 3.5 Typing an URL *utl-tuttypeurl*
\r
310 In a web browser there are two ways to go to a page:
\r
312 1. You follow a hyperlink from the page you are in.
\r
313 2. You type an URL yourself.
\r
315 Possibility 1 corresponds to \gu in utl.vim. Possibility 2 corresponds to an
\r
316 utl.vim command :Gu
\r
320 You can use the :Gu command for editing another file which is in the same
\r
321 directory as the current file. Example:
\r
323 gvim /really/an/annoying/long/path/to/src/main.c
\r
326 I myself use :Gu for a lot for this purpose.
\r
329 3.6 Other commands to execute a link *utl-tutothercmds*
\r
332 Normal mode commands
\r
334 Until now we have used \gu to execute a link. That's the most important one.
\r
335 Utl.vim defines several other command. \gu corresponds to Vim's :edit. The
\r
336 other commands correspond to :view :sview etc. For example, the command \gE
\r
337 opens the URL under the cursor in a separate Vim window. Position the
\r
338 cursor on the following line and hit \gE to try this:
\r
340 See |utl-commands| for the list of mappings and commands.
\r
345 There are also visual commands |utl-gourlvis|. But you will rarely need this.
\r
346 An example might be: `(see www.vim.org)', i.e. an URL without embedding which
\r
347 is surrounded by characters which confuse Utl's URL parsing (the ')' in this
\r
348 case. Highlight the URL (see |visual-use| if you don't know how) and execute
\r
353 3.6 Supported schemes *utl-tutsuppscms*
\r
355 Currently utl.vim supports the following protocols:
\r
357 file: # Protocol for accessing local files.
\r
358 # If machine is given works like `ftp:'
\r
359 ftp: # Delegates to http, assuming that the browser handles this.
\r
360 http: # Delegates call to your web browser
\r
361 https: # Delegates call to your web browser
\r
362 mailto: # Delegates call to your mail client
\r
363 man: # Unix Man Pages scheme (see |utl-usesourcecode| for usage)
\r
364 scp: # If you have a scp command
\r
365 vimscript: # Vim specific. A scheme for executing vim commands. See
\r
366 # |utl-exvs| for usage.
\r
367 vimhelp: # Vim specific. About the same as vimscript:help. See
\r
368 # |utl-exvimhelp| for usage.
\r
369 config: # Protocol for accessing Utl's setup file
\r
371 You can easily implement your own schemes or define new ones. You just define
\r
372 a Vim function somewhere. Utl.vim dynamically calls those functions. Have a
\r
373 look at <URL:../plugin/utl_scm.vim#r=implscmfunc>. I recommend that you read
\r
374 chapter 5, Tips, details, pitfalls, before you write your own scheme handler.
\r
377 3.7 Miscellaneous *utl-tutmisc*
\r
380 Creating files using Utl
\r
382 If you execute an URL which points to a non existing file, this file (more
\r
383 exact: its Vim buffer) will be created. This is very useful when authoring:
\r
384 You write the URL in your document and then execute it. You can try this with
\r
385 the URL <URL:utl_foobar.txt>. People told me that this feature is useful for
\r
391 You can spread URLs across several lines like this: <URL:../plu
\r
392 gin/utl_uri.vim>. This is sometimes useful for long URL, see examples
\r
393 below at #r=lu. When typing an URL and Vim breaks it (beacuse it contains a
\r
394 space and Vim's 'tw' option set) you have to be careful: Utl eliminates all
\r
395 spaces around the line break. The above link is thus equivalent to <URL:../plu
\r
396 gin/utl_uri.vim>. In order to preserve the space, you could escape it with
\r
397 %20 (see |utl-uri-forbchars| about escaping), e.g. <url:this filename
\r
398 %20contains blanks.txt>. But you could also just split at another position:
\r
400 e contains blanks.txt>
\r
406 You can use the ~ (tilde) character in URLs. Example: <URL:~/.vim/plugin/utl.
\r
407 vim>. The ~ is replaced by the contents of the $HOME environment variable.
\r
408 On Unix system ~user also works. See |$HOME|.
\r
411 ==============================================================================
\r
412 4. Examples of use *utl-examples*
\r
414 Here comes a rich collection of Utl examples, usage patterns and smart little
\r
415 examples. If you go another example it would be nice you mail it to me.
\r
418 4.1 Use Vim as your central desktop application *utl-usedesktop*
\r
420 4.1.1 Index File *utl-useindex*
\r
422 One usage is to maintain one or more text files which serve as an index or as
\r
423 a central point of references. Basically like this:
\r
425 ---index.txt-----------------------{
\r
426 <url:./foo/bar.txt>
\r
427 <url:../docs/foo2.doc>
\r
428 <url:../../quote/times.xls>
\r
431 Many people like to load such a file as buffer #1 when starting up Vim and
\r
432 then browse from there. Well, I do not use Utl for this, I rather work with a
\r
433 self written tags file for this purpose or with a session file (see
\r
434 vimhelp:mks) where a file always pertains to the same buffer number.
\r
437 4.1.2 Project Management
\r
439 Here is a real example. The following is the root file for a software project
\r
440 where the task is technical subproject management. The # comments are only for
\r
441 explanation and not in the original file. It looks something like this:
\r
443 --- poland_project.txt ------------{
\r
444 file: poland_project.txt - Poland Install project
\r
449 # Link to architecture working document
\r
450 <url:../i/rcinstall_arch.txt>
\r
452 # Link to installation instructions
\r
453 <url:../../data/PL Installation Procedure - IMS Installation.doc>
\r
455 <url:cr.txt> # Link to my change requests notes
\r
456 <url:vers.txt> # Link to SCM related stuff
\r
457 <url:t.txt> # Link to test reports
\r
458 <url:t.txt#r=act> # ... direct link to current test there
\r
460 # Link to root in document management system
\r
461 <url:http://kstbx032.ww010.siemens.net/livelink/livelink.exe?func=ll&
\r
462 objId=1007014&objAction=browse&sort=name> (id=lu)
\r
464 Iinstall: # Link to a specific document there
\r
465 <url:http://kstbx032.ww010.siemens.net/livelink/livelink.exe/RC_D_
\r
466 INSTALLATION_COMPONENT_IF_SPEC.doc?func=doc.Fetch&nodeId=1017472&
\r
467 docTitle=RC_D_INSTALLATION_COMPONENT_IF_SPEC%2Edoc&vernum=1>
\r
469 # Hot link to the current installation CD
\r
470 <url://q:/projekt_511/infrastructure/installation/polen/polen-cd>
\r
473 Correspondance # Threads of project specific correspondance
\r
477 <url:corr/20041219_RE FormXtra 2.6 question.rtf> # Reference to a RTF email
\r
478 <url:corr/20041220_RE FormXtra 2.6 question.txt> # Reference to a .txt email
\r
479 <url:corr/20041221_RE FormXtra 2.6 question.htm> # Reference to a HTML email
\r
482 -----------------------------------}
\r
484 The referenced files also contain links. I guess I do not have even one
\r
485 selfwritten file which does not contain URLs.
\r
488 4.1.3 Personal Info File *utl-useinfofile*
\r
490 Quite many people maintain something like a personal info file (I also do).
\r
491 They note there for example:
\r
493 - Installation of tools they use on the job
\r
494 - Usage of tools they use, for instance CVS usage and commands
\r
495 - Links to network drives, resources and documentation
\r
496 - Web links (instead or additional to bookmarks/favorites in web browser)
\r
498 This file is much more useful if enriched with URLs!
\r
504 Address book *utl-useaddressbook*
\r
506 I maintain all my contacts in a Vim written XML file. A Perl program parses
\r
507 this file and generates a Vim tags file. This tag file serves as the database
\r
508 for quick lookup of phone numbers, emails and addresses (contact me if you
\r
509 would like to try this). I use URLs in this file:
\r
511 - to add references to contacts. Like order information, and emails
\r
512 - to execute email addresses (which normally are part of the contact
\r
514 - to execute web pages related to the contact
\r
515 - link between addresses
\r
516 - link to encrypted login and passwords
\r
521 Link Source Code Files *utl-usesourcecode*
\r
523 This is an Utl usage of big potential in my opinion. But as Utl is currently
\r
524 only implemented for the Vim Editor (not for Emacs etc) this usage might be of
\r
525 real benefit only for people who have an own interest in quality source code.
\r
526 You can use Utl to:
\r
528 - link between the source code files using fragment addressing. For
\r
529 instance point to a C/C++ header file where a structure/class is defined.
\r
531 - link from a source code file to Man pages using the man: scheme (Unix only).
\r
532 See #r=foot5 for an example
\r
534 - link from a source code file to design documents, illustration pictures
\r
537 The Utl source code uses URLs itself, see for instance: <URL:../plugin/utl.vim
\r
538 #URL:vimhelp:cmdline-special>).
\r
544 - Is useful for technical writers.
\r
545 Compile changes and references for a (MS-Word) document in a text file
\r
548 - Make a photo index file.
\r
549 Reference you photos from within text files which contain links to your
\r
550 pictures plus annotation text for the photos.
\r
552 - Bug Tracker database.
\r
553 Maintain a text file which has bug tracker IDs (or change requests more
\r
554 generally) as entries:
\r
556 CR001 Error 8 from replace_client_c.bat
\r
558 status: implemented
\r
560 text describing the problem...
\r
561 text analyzing the problem...
\r
562 ...including links to requirements documents, links to to emails
\r
563 concerning the problem, e.g. <URL:corr/Re FormXtra 2.6 question.htm>,
\r
564 cross references to other CR's
\r
568 I maintain such a file for Utl development for instance. The Change Request
\r
569 IDs I choose freely. On my job I also use such files, but the IDs are given
\r
570 by the Bug Tracker database which we use there. Normally everything should
\r
571 go into the bug tracker itself (says the upper management) but reality is
\r
572 different. The Bug Tracker IDs have the form `BT12345' and I can execute
\r
573 them as an UTL hotlink (see <URL:../plugin/utl.vim#r=heur_example>). Very
\r
577 4.2 Smart examples *utl-smartexamples*
\r
580 Spell Checker *utl-spellchecker*
\r
582 You can use Utl's web browser integration for spell checking of words. With
\r
583 the following in your .vimrc file:
\r
585 nmap ,l :exe "Gu http://dict.leo.org/?search=" . expand("<cword>")
\r\r
587 you can lookup the word under the cursor in a web dictionary with the command
\r
588 ,l . I use this quite often and this is my lightweight spell checking tool
\r
589 (especially when I have to write english text).
\r
593 Dictionary Lookup *utl-dictlookup*
\r
595 The above mapping above is also useful as dictionary lookup translation
\r
596 english into german or vice versa. You can also make a similar mapping:
\r
598 " Lookup of expression given on command line.
\r
599 " Of benefit because often faster than click click on desktop
\r
600 " Use %20 or \ or + to escape blanks, example:
\r
601 " for%20that%matter
\r
602 " for\ that\ matter
\r
604 nmap ,m :Gu http://dict.leo.org/?search=
\r
606 In this form you type the word to lookup in the command line.
\r
610 Gu with dot dir *utl-gudotdir*
\r
612 The following command is short but very useful:
\r
616 invokes the file browser for the directory where the current file resides. The
\r
617 file browser will typically be either Vim's file browser or Windows Explorer
\r
618 (or Konqueror on Linux), depending on how you configured the directory
\r
619 handler, see Config:#r=mt_dir. Both handlers are of benefit, depending on
\r
620 what you want to do. If the Vim file explorer is configured, the following is
\r
626 i.e. you execute the command 'c' in the Vim file explorer to change the
\r
627 current working directory ( see vimhelp:current-directory ) accordingly. This
\r
628 enables you to use file name completion to edit files which are in the same
\r
629 directory as the previously edited file.
\r
633 Invoke Utl's media type handlers in file browser *utl-fbcallmt*
\r
635 If you are in Vim's file browser you can use \gu to invoke the files and
\r
636 directories presented there with the Utl-defined media type handlers! For
\r
637 example open a MS Word document with MS Word, open a picture with irfanview,
\r
638 open a directory with Windows Explorer (if directory handler configured to
\r
639 Windows Explorer) etc. That's very convenient. Seems like magic first, but
\r
640 isn't, is completely straight forward and no special treatment by the utl.vim
\r
641 plugin (utl.vim is just lucky on one point: concerning directories, that they
\r
642 are presented with forward slashes even under Windows). It might be worth to
\r
643 note that you do not execute self written URLs here.
\r
647 Starting a program *utl-startprog*
\r
649 The following starts a vncviewer client for me:
\r
651 <url://q:/projekt_511/Iberl/vnc3.3.3R2/vnc_x86_win32/vncviewer/vncviewer.exe?>
\r
653 The question mark at the end denotes that the path in front of it should be
\r
654 interpreted as a program to be executed. This is straight forward URL
\r
655 techniques, Utl applies the general URL query concept to programs which are
\r
656 directly accessible by your file system. See |utl-filequery| for some specs.
\r
658 You can also supply the server IP address to connect to:
\r
660 <url://q:/projekt_511/Iberl/vnc3.3.3R2/vnc_x86_win32/vncviewer/vncviewer.exe?89.11.11.242>
\r
662 Or you only link to the directory in order to start the program from
\r
665 <url://q:/projekt_511/Iberl/vnc3.3.3R2/vnc_x86_win32/vncviewer>
\r
667 Starting programs is especially useful in case of long, strange paths to the
\r
668 program which you either forget or which is simply to ennoying to type. This
\r
669 can be an alternative to one liner programs. A good place to keep such links
\r
670 might be your info file, see |utl-useinfofile|.
\r
672 Here is another example using a slightly different form of query:
\r
674 <url:my-decrypt.pl?stb-cellphone-pin%3e>
\r
676 This link is contained in my address book. It looks up the PIN number of my
\r
677 cellphone which is GPG encrypted. My-decrypt is a small Perl program which
\r
678 asks for the password and then writes the PIN to standard output. The %3e at
\r
679 the end is the '>' character in escaped form (see |utl-uri-forbchars|). The
\r
680 '>' as the last character means the following to Utl: Execute the given
\r
681 program synchronously and write the output into a temporary file. The
\r
682 temporary file is then displayed in Vim. In the above vncviewer example the
\r
683 program is started asynchronously and no output is awaited.
\r
687 The vimscript scheme *utl-exvs*
\r
689 The vimscript scheme is a nice example for a non standard protocol. Utl.vim
\r
690 introduces it in the hope it will be helpful and also as a demonstration for
\r
691 the URL concept. This URL definition is in full compliance to the URL/URI
\r
692 specification! Try the folowing examples:
\r
696 1. <URL:vimscript:let g:utl_sav=g:colors_name>
\r
697 2. <URL:vimscript:colors peachpuff>
\r
698 3. <URL:vimscript:exe "colors ".g:utl_sav>
\r
700 <URL:vimscript:help uganda>
\r
702 Here is an example which is derived from the minibufexpl.vim ( see
\r
703 http://www.vim.org/scripts/script.php?script_id=159 ). This file
\r
704 contains folds and the following hint:
\r
706 Hint: Type zR if you don't know how to use folds
\r
708 Using UTL this could be turned into a hotlink:
\r
710 Hint: Execute <URL:vimscript:normal zR> if you don't know how to use folds
\r
712 Execute the above URL to see how this works...and to see another example :-)
\r
714 Yet another vimscript example {{{
\r
715 This example is derived from the vimspell.vim, see <URL:http://www.vim.org/
\r
716 scripts/script.php?script_id=465>. This file contains the following:
\r
718 " Section: Documentation
\r
719 "----------------------------
\r
721 " Documentation should be available by ":help vimspell" command, once the
\r
722 " script has been copied in your .vim/plugin directory.
\r
724 " You still can read the documentation at the end of this file. Locate it by
\r
725 " searching the "vimspell-contents" string (and set ft=help to have
\r
726 " appropriate syntaxic coloration).
\r
728 Using UTL this can be turned into a hotlinked version:
\r
730 " Section: Documentation
\r
731 "----------------------------
\r
733 " Documentation should be available by <url:vimhelp:vimspell> command, once the
\r
734 " script has been copied in your .vim/plugin directory.
\r
736 " You still can read the documentation at the end of this file, see
\r
737 " <url:#vimspell-contents> (and execute <URL:vimscript:set ft=help> to have
\r
738 " appropriate syntaxic coloration).
\r
740 }}} Execute <URL:vimscript:normal zM> to close the fold again
\r
742 Regarding the above examples you might agree with me that the possibility to
\r
743 embed vim commands and hotlinks in a document is nice and smart.
\r
745 Obviously there is one issue: As long as plain text URLs are not standard, the
\r
746 standard user who reads the above given samples in minibufexpl.vim or
\r
747 vimspell.vim would not be able to actually execute the URLs. But the plugin
\r
748 authors could utilize the URL version anyway since their meaning is obvious to
\r
749 the user. The user can execute still manually.
\r
751 Potentially vimscript URLs could also be of benefit for a community, for
\r
752 instance in the vim@vim.org mailing list where often vim commands are
\r
753 exchanged. Can be used at hot links for those people who can directly switch
\r
754 to vim while reading mail.
\r
756 A historical note:
\r
757 The vimscript URL was inspired by the javascript scheme, which is supported by
\r
758 Mozilla/Firefox and MS Internet Explorer for example (try
\r
759 <URL:javascript:window.alert(%27hello, worldddd%27)> for a javascript
\r
760 example). Consider the current vimscript protocol support ( which is actually
\r
761 one line of code, see ../plugin/utl_scm.vim#r=vimscript ) as a demo. Much more
\r
762 sophisticated things could be achieved.
\r
766 The vimhelp scheme *utl-exvimhelp*
\r
768 Linking to the Vim Help is especially useful. So Utl provides a a shorter form
\r
769 for that. Instead <URL:vimscript:help design-documented> you can write:
\r
771 <URL:vimhelp:design-documented>
\r
773 using the special non standard protocol vimhelp. Obviously this is the same as
\r
774 the Vim-help reference notation |design-documented|. But with the advantage
\r
775 that the URL version also works if the file containing the link is not part of
\r
776 the Vim help! Another advantage is that you can use fragments in conjunction
\r
779 <URL:vimhelp:design-documented#line=4>.
\r
781 That's 4 lines downwards from the position which the URL without the fragment
\r
782 yields. (Not 4 lines downwards from the top of the file which contains that
\r
783 help item.) This is useful for instance for documenting Vim scripts! See
\r
784 <URL:../plugin/utl.vim#vimhelp:expr-==> for an example. It could also be useful
\r
785 in the Vim mailing list when Utl.vim or plain text URLs become common enough.
\r
791 Utl supports the mailto: protocol. Try for example to execute the following
\r
794 <URL:mailto:stb@bf-consulting.de> # with embedding
\r
795 mailto:stb@bf-consulting.de # without embedding
\r
796 stb@bf-consulting.de # without embedding and mailto:
\r
798 Especially the latter form is useful for directly using email addresses. I
\r
799 keep my email addresses in my text based address book and often start writing
\r
800 emails from there. I do not maintain the address book of my mail client
\r
803 If your mail client supports extended mailto syntax according to RFC2368 you
\r
804 can also execute URLs like
\r
806 <URL:mailto:stb@bf-consulting.de?Subject=mysubject&
\r
807 Cc=bf@bf-consulting.de&
\r
808 Bcc=stb2@t-email.de&>
\r
810 You might want use something like:
\r
812 <URL:mailto:stb@bf-consulting.de?
\r
813 To=hans.mueller@web.de&To=martin.schmidt@t-online.de&To=otto.andres@web.de>
\r
815 to directly mail to a group of people.
\r
821 Most people prefer to have a hot key to execute \gu. For instance you could
\r
822 use the function key F4 to execute an URL with the mapping:
\r
824 :nmap <F4> <Leader>gu
\r
826 Or do you prefer the "real link" feeling and execute a hyperlink with double
\r
827 click left mouse button?
\r
829 :nmap <2-LeftMouse> <Leader>gu
\r
831 Execute <URL:vimscript:nmap %3c2-LeftMouse%3e %3cLeader%3egu> to try this
\r
832 mapping. Execute <URL:vimscript:nunmap %3c2-LeftMouse%3e> to unmap it again.
\r
836 4.3 Referencing Emails
\r
838 Referencing emails from within a text file can be very useful (see for
\r
839 example #r=emailex above). There is not yet a proper Utl solution, but some
\r
840 people (including me) find already useful what is currently possible.
\r
843 The desired solution?
\r
845 The desired solution, in my opinion, would be to have a specific scheme for
\r
846 referencing emails which reside in one of your mail folders, something like
\r
849 <url:mbox:[filter expression to select one or more specific email]>
\r
853 <url:mbox:subject=abc> # Display the thread related to subject abc
\r
854 <url:mbox:date=20.12.2004+12:21> # Specify a mail by date+time
\r
855 <url:mbox:id=20001025234042.A29199@smith.com>
\r
856 # Specify a mail by its message ID
\r
858 The latter would probably be the most important case: to identify an email by
\r
859 its unique message ID (RFC 822 header field "Message-ID:"). Unfortunately not
\r
860 every mail system supports the message ID, most notably Outlook consortes. For
\r
861 Outlook, even worse, until now I did not find any possibility to savely
\r
862 identify an email in a way which can be used for automated lookup. I tried for
\r
863 example to write a Windows Scripting Host (WSH) script, but it seems you
\r
864 cannot even identify an email by date/time received because you can only
\r
865 define filters for time ranges. Who can help here??? Perhaps can be solved
\r
869 Experimental solution for mbox formatted mail boxes:
\r
871 For the mbox style mail box format with the Message-ID: header field present
\r
872 in the emails I work with the following experimental to handle my private
\r
873 emails. It uses a query URL like this:
\r
875 <url:file:///home/stb/Mail/search?20001025234042.A29199@smith.com>
\r
877 It searches some mail folders for the email with the given Message-Id,
\r
878 extracts it, and displays it in a Vim window. The program `search' is little
\r
879 self written perl script (the Vim plugin <URL:http://www.vim.org/scripts/
\r
880 script.php?script_id=25> performs a similar task.) Using existing
\r
881 programming interfaces to access mail boxes would probably be a smarter
\r
885 Referring to copies
\r
887 Here comes what I am doing over and over with my Outlook emails on the job. I
\r
888 save important emails with "Save as" in a project specific "correspondance"
\r
889 folder. Mostly in .rtf or .txt format. For the file name I prefix the date of
\r
890 the email, for instance '20041204 RE MDAC 2.6 installation problem.txt'. The
\r
891 link containing this reference looks something like:
\r
893 <url:corr/20041220 RE MDAC 2.6 installation problem.rtf>
\r
895 The link appears for example in the bug tracker data base. Or in a text file
\r
896 which contains items for the next revision of a technical documentation.
\r
897 Compilation of requirements of a software engineering project is another
\r
900 Depite the annoying step of saving the email to a file (could probably be
\r
901 automated if I was a WSH or VBS programmer) this procedure proved to be very
\r
902 powerful during the last years.
\r
905 ==============================================================================
\r
906 5. Tips, details, pitfalls *utl-tipsdetails*
\r
909 5.1 Associated Base URL and Cache Mapping *utl-tdassbcachem*
\r
912 Associated Base URL *utl-tdassb*
\r
918 and when you ARE in the other file, utl_ref.txt, then type the utl.vim
\r
923 that shows you the associated base URL in Vim's message line.
\r
924 It looks something like:
\r
926 URL=file:///path/to/.vim/doc/utl_ref.txt
\r
928 This is the base URL, denoting the context for resolving relative URLs.
\r
929 If \gs shows you a message which starts with `no associated URL', this means
\r
930 that the buffer was not invoked by utl.vim, e.g. was invoked by a user
\r
931 command like :e xyz.
\r
933 You normally do not need the \gs command. But it is sometimes useful to figure
\r
934 out what's going on.
\r
938 The `file:' protocol is the default *utl-tdfileisdef*
\r
940 When \gs shows `URL= ' (empty value) you nevertheless can execute relative
\r
941 URLs. Given a relative URL, say utl_ref.txt, utl.vim just assumes the
\r
942 `file:' protocol, i.e. file:///path/to/currentBuffer.
\r
944 This behaviour normally gets the thing started: you are in a normal Vim
\r
945 session and encounter a link somewhere. Just type \gu to follow the link.
\r
947 This behaviour to "urlify" the current resource is usual for systems that
\r
948 support both, URL oriented and file system oriented resources. For example
\r
949 Linux/KDE's web and file browser konqueror. For the konqueror the http:
\r
950 protocol is the default.
\r
954 Cache Mapping *utl-tdcachemap*
\r
956 Type now the utl.vim command:
\r
960 Utl.vim shows you it's internal cache-mapping: The mapping between local
\r
961 files and their URL. That grows up more and more when you continue to
\r
962 follow links to different URLs. At the moment \gc, like the \gs command, is
\r
963 mainly useful to see whats going on when learning utl.vim. The cache map is
\r
964 always looked up first when utl.vim needs a base URL. URLs that are passed
\r
965 directly to the web browser or to the mail client are an exception. They are
\r
966 passed to these applications before lookup and will not be visible in the
\r
969 When working with local files, the URL may seem quite academic. But with
\r
970 remote resources this changes[#r=foot4].
\r
973 5.2 Writing correct URLs *utl-tdwriteurls*
\r
975 As already mentioned, understanding URLs is essential for using utl.vim as
\r
976 an _author_. Using utl.vim for the _reader_ who only executes URLs requires
\r
977 not much understanding; you just hit \gu when you encounter a link. That's a
\r
978 difference between authoring/editing/writing on one side and
\r
979 reading/browsing/viewing on the other side.
\r
981 Have you already read the URI primer |utl-uriprim|? Strongly recommended!
\r
982 OK, enough moralizing. Here are some rules and hints:
\r
984 - Always use forward slashes! *utl-usefwslashes*
\r
986 Even on MS Windows do not write:
\r
988 <url:file:D:\htdocs\corephp\kalender\WebCalendar\index.php> # bad!!!
\r
992 <url:file://D:/htdocs/corephp/kalender/WebCalendar/index.php> # good!
\r
994 Note that the windows drive appears where you normally expect a machine
\r
995 name. That is according to URI specifications. Try it out from within your
\r
996 web browser if you do not believe it!
\r
999 - Use relative URLs instead of absolute URLs whenever possible. For example,
\r
1002 <url:sub_dir/foo.txt> or
\r
1003 <url:./sub_dir/foo.txt> # same as previous line
\r
1007 <URL:file:/full/path/to/sub_dir/foo.txt>
\r
1009 Other example with file which is in a directory with is parallel to the
\r
1010 directory where the current file is in:
\r
1012 <URL:../sibbling_dir/foo.txt>
\r
1014 Normally there is no need for an explicit `file:' protocol!
\r
1017 - How relative URLs are combined *utl-howrelscombine*
\r
1019 Say you have a file foo.txt which lives in the directory /full/path/to .
\r
1020 Thus the full pathname of foo.txt is:
\r
1022 /full/path/to/foo.txt
\r
1024 Further assume foo.txt contains an URL:
\r
1029 <URL:sub_dir/bar.txt>
\r
1034 When this URL is executed by utl.vim, the following happens:
\r
1036 - The URL "sub_dir/bar.txt" is recognized as a relative URL (because it does
\r
1037 not contain a protocol).
\r
1039 - Every relative URL has to be transformed into an absolute URL. This is
\r
1040 achieved by combining it with the base URL. The base URL is the URL of the
\r
1041 containing document minus its file name. In our case:
\r
1043 "file:///full/path/to/"
\r
1045 (When foo.txt itself was retrieved through, say, the scp: protocol,
\r
1046 then the base URL might read something like "scp://host.de/.../".
\r
1047 Utl.vim's \gs command shows you the absolute URL of the current
\r
1050 absolute URL of file
\r
1051 containing the URL: file:///full/path/to/foo.txt
\r
1052 - file component: foo.txt
\r
1053 --------------------------------------------------------------------
\r
1054 = base URL: file:///full/path/to/
\r
1055 + relative URL: sub_dir/bar.txt
\r
1056 --------------------------------------------------------------------
\r
1057 = absolute URL: file:///full/path/to/sub_dir/bar.txt
\r
1059 It's always an absolute URL which is executed by utl.vim. Relative
\r
1060 URLs are never executed directly! They are transformed into absolute
\r
1061 URLs in order to get executed.
\r
1064 5.3 Common Pitfalls *utl-commonpitfalls*
\r
1067 Absolute URLs do not combine!!!!!! *utl-absdontcombine*
\r
1069 The following makes no sense:
\r
1071 <URL:file:../do/not/do/this> # VERY BAD
\r
1073 Here is the easy rule to keep in mind: When the protocol -- `file:' in our
\r
1074 case -- is present, then it's an absolute URL! If it is absent, then it is a
\r
1075 relative URL. Be aware of this rule... although bad URLs as the above one
\r
1076 might seduce you :-)
\r
1078 An absolute URL is taken as it is! The ../ in the example suggests a
\r
1079 relative path. But since the URL is absolute, the path will _not_ be
\r
1080 combined with the path of the document containing that URL. Executing this
\r
1081 link is about the same as when you type the Vim command:
\r
1083 :edit ../do/not/do/this
\r
1085 That means: the result depends on the current directory, not on
\r
1086 the directory of the file containing the URL. Not what you want!
\r
1088 The moral of the story is:
\r
1089 1. When you use a protocol like file: or http: in your URL, then you have
\r
1090 to give the complete path in the URL!
\r
1091 2. Use relative URLs whenever possible!
\r
1094 Protocol and file type are different things *utl-protvsftype*
\r
1096 This is something which is important to understand, especially if you are
\r
1097 going to extend Utl by your owne protocol and media type handlers.
\r
1099 Linking to a HTML file does not mean that you necessarily need the http:
\r
1100 protocol then! Protocol and file type (= media type) of the link target are
\r
1101 completely independent.
\r
1103 You can have http: to retrieve a txt file:
\r
1105 <URL:http://www.ietf.org/rfc/rfc2396.txt>
\r
1107 Or you can have file: to retrieve a (normally, but not necessarily local) HTML
\r
1110 <URL:file:///usr/local/apache/htdocs/index.html>
\r
1112 This second example is more important for normal utl.vim usage: for
\r
1113 example, when using utl.vim for editing your website. Utl.vim can
\r
1114 directly execute links in HTML files and it normally does that by implicitly
\r
1115 using the `file:' protocol. See also |utl-footnote-htmledit| and
\r
1120 5.4 Embedding and fragment interpretation depend on the media-type
\r
1122 As you already know, Utl introduces the embedding `<URL:myUrl>' for plain
\r
1123 text files. For HTML files (.html or .htm), it makes sense to support HTML's
\r
1124 embedding, i.e. something like `<A HREF="myUrl">'. This means that when you
\r
1125 are editing a HTML file and execute \gu to follow a link, utl.vim expects the
\r
1126 pattern `<A HREF...>' under the cursor.
\r
1128 The URL embedding syntax relates to the media type of the source of the link.
\r
1129 The fragment expression syntax relates to the media type of the target of the
\r
1130 link. The semantics of the fragment expression depends on the media-type.
\r
1132 When the target is a HTML file, with an IdRef expression like `#myFrag' then
\r
1133 Utl finds the position `<A NAME="myFrag">' (it will not parse the HTML file
\r
1134 though, merely search it; but in practice it functions as expected). When
\r
1135 the target is any other file type (utl.vim only distinguishes HTML from all
\r
1136 others) then Utl finds the position of `id=myFrag' (case never matters).
\r
1138 So you can really use Utl as a HTML-Source-Browser! That's useful
\r
1139 especially for editing and browsing your "under construction" web site.
\r
1141 The other fragment expressions like line=, tn= do not depend on the file
\r
1142 type (= media-type) in utl.vim.
\r
1145 ==============================================================================
\r
1146 6. Setup and Customization *utl-customization*
\r
1148 Setup of web browser, mail client, media type handlers etc is triggered
\r
1149 dynamically by Utl.vim when first requested. All settings are in the file
\r
1150 <URL:../plugin/utl_rc.vim>. Refer to the explanations in the header of this
\r
1151 file. The design goal was to make getting started with Utl easy.
\r
1153 Besides these setup items there is one pure customization item. You can switch
\r
1154 off Utl's syntax highlighting of URL with the following setting in your vimrc
\r
1157 let g:utl_config_highl = 'off'
\r
1158 " values: 'on', 'off'. Variable undefined is the same as 'on'
\r
1161 ==============================================================================
\r
1162 7. Changes from Utl-1.2 (Thlnk-1.2) *utl-changes*
\r
1166 Incompatible Changes *utl-chgincompat*
\r
1168 - #tn= fragment is now default, i.e. #tn=foo is same as #foo
\r
1170 Previously the ID-reference fragment #r=foo was the default. If you have
\r
1171 used the naked fragment with the previous version you might want to convert
\r
1172 your links. Use the search pattern /<URL:.*#[^=>]*> to find the links
\r
1173 which need to be converted (the pattern works within Vim as well as with the
\r
1174 grep program) and change # --into--> #r= . If I receive more than five
\r
1175 complains I will supply a converting utility :-)
\r
1177 The reason for this change was that #tn= semantics is used more often by
\r
1181 Changed *utl-chgchanged*
\r
1183 - Create documents on non existent local URLs (Wiki support).
\r
1184 No longer complain. Perhaps this should be customizable. For a set of
\r
1185 read-only documents complaining mighgt be better.
\r
1187 - On http URLs no longer use the wget utility for retrieving files on the web.
\r
1188 Instead delegate to your web browser.
\r
1191 Added *utl-chgadded*
\r
1193 - Call web browser on http URLs and email client on mailto URLs (configurable
\r
1196 - Call MS-Word on .doc files, Acrobat Reader on .pdf, IrfanView on .jpg etc.
\r
1197 (configurable media type handlers)
\r
1199 - Syntax highlighting for URLs (can be switched off)
\r
1201 - Support URL heuristics, e.g. allow www.vim.org, not only http://www.vim.org
\r
1203 - Support exeuction of URLs without <URL:...> embedding (e.g. execute URLs as they
\r
1204 mostly appear in not specifically written text like "see www.vim.org for Vim plugin"
\r
1206 - Support multiline URLs
\r
1208 - Smart setup and customization facility
\r
1210 - Tilde Support, e.g. allow <URL:~/foo/bar> and <URL:~user/foo/bar>
\r
1212 - Automatically open file in split window if current buffer cannot be
\r
1213 abandonned (e.g. is not written)
\r
1218 - Yes, about 10 bugs... but probably more new bugs came in :-)
\r
1221 ==============================================================================
\r
1222 8. Todo list *utl-todo*
\r
1227 Please let me know which feature you would like to see in the next release.
\r
1229 - Support for URL creation (authoring support)
\r
1230 See #foot6 for an approach.
\r
1232 - Dynamic call of handlers.
\r
1233 There should be a possibility to choose media type and scheme handlers
\r
1234 dynamically. This is most useful perhaps for links to local directories,
\r
1235 i.e. URLs like <URL:../doc>: one time you want to call Vim's own file
\r
1236 explorer, one time the file explorer of the system (e.g. Windows Explorer),
\r
1237 one time the shell (or DOS box on Windows) with proper cwd. Currently you
\r
1238 have to always invoke the setup <URL:config:#r=mt_dir> and change it.
\r
1240 - Allow wget to retrieve http documents.
\r
1241 There should be a possibility to handle http URLs in Vim (using the wget
\r
1242 utility) as version 1.2 offered it. Currently http URLs are always delegated
\r
1243 to an external program (normally your web browser). The issue probably
\r
1244 depends on the previous one.
\r
1246 - Make colors of URL syntax highlighting configurable.
\r
1248 - Check for dangling links
\r
1249 There should be a function to check whether all links points to existing
\r
1250 targets. Actually I already have a hack solution. Please email if you think
\r
1251 this would be a nice feature.
\r
1253 - Follow links when searching.
\r
1254 Add a function which searches the file tree which is defined by a file
\r
1255 containing file URLs.
\r
1258 Known bugs *utl-knownbugs*
\r
1260 - The mappings \gE, \gV which split the screen when executing an URL
\r
1261 are not respected for a reference to the same document; e.g. executing
\r
1262 \gV on <URL:#tn=this> doesn't split the screen. The same is true
\r
1263 when the file is the current file: e.g. <URL:utl_usr.txt#tn=this>.
\r
1265 - Highlighting Bug
\r
1266 The syntax highlighting gets confused in case of a split window, both
\r
1267 containing the same file with URLs. Perhaps a Vim bug.
\r
1270 ==============================================================================
\r
1271 9. Credits *utl-credits*
\r
1273 Wolfgang Fleig, my partner for his for his help, co-authoring, dialectical
\r
1274 antithesis and sponsoring.
\r
1277 Bram Moolenaar <Bram at moolenaar.net>
\r
1278 for the Vim editor.
\r
1279 Barrie Stott <G.B.Stott at bolton.ac.uk>
\r
1280 for helping a lot with the documentation
\r
1281 REKellyIV <Feral at FireTop.Com>
\r
1282 Klaus Horsten <horsten at gmx.at>.
\r
1283 Patrik Nyman <patrik.nyman at orient.su.se>
\r
1284 Engelhard Heß <Engelhard.Hess at artofbits.de>
\r
1285 Grant Bowman <grantbow at grantbow.com>
\r
1286 Ward Fuller <wfuller at SeeBeyond.com>
\r
1287 Mark S. Thomas <Mark.Thomas at SWFWMD.STATE.FL.US>
\r
1288 William Natter <wnatter at nortelnetworks.com>
\r
1289 Alex Jakushev <Alex.Jakushev at kemek.lt>
\r
1290 Geoff Caplan <geoff at advantae.com>
\r
1291 Bruno Díaz <bruno.diaz at gmx.net>
\r
1292 Michael Lesniak <ich at mlesniak.de>
\r
1293 Janek Kozicki <janek at thenut.eti.pg.gda.pl>
\r
1296 ==============================================================================
\r
1300 An URL like www.vim.org or stb@bf-consulting.de works via a simple heuristic
\r
1301 support of Utl which is similar to what you know from your web browser.
\r
1302 Utl completes www.xxx.domain into http://www.xxx.domain or
\r
1303 stb@bf-consulting.de into mailto:stb@bf-consulting.de. See <URL:../pl
\r
1304 ugin/utl.vim#r=Utl_checkHeuristicAbsUrl> for supported heuristics. You can
\r
1305 extend the heuristics defined there.
\r
1308 This only works if you have configured Windows Explorer as text/directory
\r
1309 handler, see <URL:config:#r=mt_dir>).
\r
1312 I try to use lower case notations <url:xxx> for URLs that cannot be executed
\r
1313 right away, whereas upper case samples <URL:xxx> should all be directly
\r
1314 executable. Note that this is only a convention used in this document, the
\r
1315 case does not matter. URL: url: Url: are all fine.
\r
1318 In the current version of Utl the cache actually is really somewhat academic.
\r
1319 The previous version, which was Thlnk-1.2, handled web URLs (http://...) using
\r
1320 a web file retriever ( wget, see http://www.gnu.org/software/wget/wget.html ).
\r
1321 HTML files were downloaded using wget into a local cache file and displayed
\r
1322 using Vim, i.e. were always displayed as text. This was very cool for text
\r
1323 files on the web because #tn= fragment addressing could be used. Example:
\r
1324 <URL:http://www.ietf.org/rfc/rfc2396.txt#tn=^1.2.>. Within html files, which
\r
1325 were readable enough in the text-view (in Vim) relative HTML hyperlinks could
\r
1326 be executed directly through the cache. Now web URLs are handled in the
\r
1327 mainstream manner by calling the web browser. Also people had to download
\r
1328 wget. But I would like to reactivate the wget possibilities in a next version.
\r
1329 Dynamic handler selection capabilities need to be added to Utl then.
\r
1332 You can use the man: protocol to hotlink from a program source code file to
\r
1333 the relevant man page. This makes use of the Man plugin, see |man-plugin|.
\r
1340 /* Opens file "filename".
\r
1341 * See <URL:man:open#tn=flags is one of> for possible values of the `flags'
\r
1343 * The restrictions described under <URL:man:open#tn=^RESTRICTIONS> also
\r
1344 * apply to this function.
\r
1347 myopen(char* filename, int flags)
\r
1350 open(filename, flags, mode);
\r
1359 You might want to try the following code:
\r
1361 :map ,m :call Mark()<cr>
\r
1363 let g:file = Utl_utilSlash_ExpandFullPath()
\r
1364 "echo "DBG: g:ins= " . g:ins
\r
1365 let g:text = getline(".")
\r
1368 :iab XF <C-R>=g:file<cr>
\r
1369 :imap XT #tn=<C-R>=g:text<cr>
\r
1371 Position the cursor at the intended target of the link and then execute the
\r
1372 command ,m . For inserting a link to this position type XF to insert the
\r
1373 file name and perhaps also XT to insert a fragment.
\r
1376 vim:tw=78:ts=8:ft=help:norl:fdm=marker:fen
\r