[ADD] add man.conf, view with most.
[arrow.git] / conf_slk120 / vim / _vim / doc / utl_ref.txt
blobebe6544311b4e042cb989d456e6532f7adda626d
1 *utl_ref.txt* Plugin for executing URLs from text files (reference manual)\r
2 For Vim version 6, Version: utl-2.0, $Revision: 1.1.1.1 $\r
3 \r
4                     Utl.vim Reference Manual\r
5 \r
6                          By Stefan Bittner\r
7                         stb@bf-consulting.de\r
8 \r
9         Contents:\r
11                 1. The utl.vim reference........|utl-reference-manual|\r
12                 2. Brief refresher URL and URI..|utl-uriprim|\r
14 NOTE: At the moment (utl.vim-2.0) the reference is not complete.\r
16 References:\r
17 - see |utlusr.txt| for the user manual\r
19 ==============================================================================\r
20 1. The utl.vim reference                            *utl-reference-manual*\r
22 1.1 Fragment expression syntax                          *utl-fragexpr*\r
24 Utl.vim supports the following fragment expressions:\r
26 #tn=MySearchText      "Text Next Search"                *utl-#tn*\r
27 #MySearchText         Addresses that position in the target file, which is\r
28                       defined by searching the string "MySearchText" in\r
29                       forward direction.\r
30                       The search is done relative, i.e. beginning from the\r
31                       actual position. This typically is the start of the\r
32                       document.  MySearchText can contain White Space.  The\r
33                       searching is done in a fuzzy manner (see\r
34                       <URL:../plugin/utl.vim#r=fuzzy>).  The basic idea of the\r
35                       fuzzy search is that the semantic sequence of words\r
36                       should be sufficient, in order to minimize broken\r
37                       fragments.\r
39 #tp=MySearchText      "Text Previous Search"                *utl-#tp*\r
40                       like #tn but search backwards.\r
42 #line=MyLineNumber    e.g. line=23, line=-8.                *utl-#line*\r
43                       References the given line number in the text.\r
44                       The search is done relative, like above.\r
46 #r=MyIdentifier       ID-Reference.                         *utl-#idref*\r
47                       References the defined `anchor' id=... in the target\r
48                       document. See also |utl-fragmedtyp|. MyIdRef should be\r
49                       an identifier (not a sequence of words). Note that\r
50                       #r=foo and #r=foobar are distinguished whereas\r
51                       #tn=foo will perhaps find the wrong position if there\r
52                       also is as string foobar in the target document.\r
56 1.2. Dependency of fragment interpretation from media type  *utl-fragmedtyp*\r
58 According to RFC2396, the interpretation of fragments determined by\r
59 the type of the target document (see:\r
60 <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=is dependent on the media type )\r
62 For media types other than "text/*" fragments will be ignored (e.g. for\r
63 "image/*")\r
65 For "text/*" utl.vim makes a difference between "text/html" and all other\r
66 "text/*" subtypes.  But the interpretation of tn=, tp=, line= is the same for\r
67 _all_ text/* subtypes.  Just the IdRef interpretation is different:\r
69 text/html   IdRef interpreted as a HTML-reference (i.e. NAME="myRef")\r
71 text/*      IdRef interpreted as "txt-reference" (i.e. id=myRef)\r
75 1.3 Utl.vim internals                                   *utl-internals*\r
77 1.3.1 Definition of LocalPath\r
79 Utl.vim internally has a notion "LocalPath".  LocalPath is an absolute path\r
80 of the local file system.  A real local file (or directory) with that name\r
81 exists. A pure buffer is not possible (at the moment). Utl's is simpler due\r
82 to this restriction.  For localPath a resource mapping exists.\r
85 1.4. Mappings and Commands                   *utl-mappings* *utl-commands*\r
87 Note: The mappings below depend on the |mapleader| variable. This means,\r
88 instead of \gu it might be ,gu or whatever.\r
90 1.4.1 `Goto URL under cursor' mappings                  *utl-gourlundercurs*\r
92 The following mappings are available to execute the URL under the cursor:\r
94 \ge, \gE, \gS, \gu                            *utl-ge* *utl-gS* *utl-gu*\r
95         Goto URL under cursor. Open the target read/write.\r
96         \ge replaces the current window with the target (:edit)\r
97         \gE opens the target in a split window (:split).\r
98         \gS opens the target in a vertical split window (:vsplit)\r
99         \gu is the same as \ge. It is provided for easy mnemonics: gu = Go Url\r
100             It's the only command you really have to know in order to use\r
101             utl.vim!\r
103 \gv, \gV                                                            *utl-gv*\r
104         Goto URL under cursor. Open the target read only\r
105         \gv replaces the current window with the target (:view).\r
106         \gV opens the target in a split window (:sview).\r
108 \gr                                                                 *utl-gr*\r
109         Read the URL under cursor into the current buffer at the current\r
110         position (:read)\r
113 1.4.2 `Goto visual URL' mappings                              *utl-gourlvis*\r
115 Same as the above mappings, but the but the highlighted text is used as the\r
116 name of the URL. The visual mappings are useful when you have a text where the\r
117 URLs are not embedded. Example: "See http://vim.sf.net for useful Vim plugins"\r
119                                         *utl-v_ge* *utl-v_gs* *utl-v_gu*\r
120 {Visual}\ge, {Visual}\gE, {Visual}\gS {Visual}\gu\r
122 {Visual}\gv, {Visual}\gV                                          *utl-v_gv*\r
124 {Visual}\gr                                                       *utl-v_gr*\r
127 1.4.3. `Goto URL by command'                                  *utl-gourlcmd*\r
129 Type in an URL manually.\r
131 :Gu {URL}                                                          *utl-:gu*\r
132         Goto the typed URL.\r
133         The difference between \gu and :Gu is like in an web browser: typing\r
134         an URL versus clicking an URL in the displayed text. But there is one\r
135         important difference though. :Gu is executed in the context of the\r
136         current buffer, i.e. :Gu myurl is the same as clicking \gu on\r
137         <URL:myurl> in the text of the current buffer. That means that\r
138         relative URLs are possible! So :Gu can be used for relative editing.\r
139         See |utl-tipsguusage| or |utl-tuttypeurl| for examples of usage.\r
142 1.6.4. Other mappings and commands\r
144 \gs                                                                 *utl-gs*\r
145         Show the base URL that is associated with the current buffer in the\r
146         status line, if any.\r
147         Else shows the text `no associated URL'. That means, that the current\r
148         buffer was not invoked as a link target (i.e. was not invoked through\r
149         a utl.vim `Goto URL' command like \gu, :Gu etc).\r
150         \gs just does a lookup utl's cache (see |utl-gc|).\r
152         Tip:\r
153         If, in the `no associated URL' case, you like to know what the base\r
154         URL is, you can first issue the command\r
155             :exe ':Gu ' . expand('%')\r
156         to "urlify" the current buffer (see |utl-tutfileisdef|); a\r
157         subsequent \gs then shows the associated URL. This can be useful while\r
158         learning utl.vim. The associated URL is always an absolute URL. And\r
159         it is the base URL that would be taken when a link, containing a\r
160         relative URL, would be executed out of the current buffer, e.g. a\r
161         <URL:someUrl> is executed.\r
163 \gc                                                                 *utl-gc*\r
164         Shows utl.vim's internal cache map in a separate window.\r
165         Useful mainly to see what's going on. See |utl-tutcachemap| for\r
166         more information.\r
169 ==============================================================================\r
170 2. Brief refresher on URL and URI                       *utl-uriprim*\r
172 This chapter might be worth reading if you are thinking about designing your\r
173 own protocols. If you are going to extend Utl, it's source code will be easier\r
174 understandable if you know URLs better. But it is also intended for the\r
175 interested user to acquire a more thorough understanding of URLs and Utl in\r
176 general.\r
178 Uniform Resource Identifiers are specified in RFC 2396, see <URL:http://www.\r
179 ietf.org/rfc/rfc2396.txt>.\r
181 URI vs. URL                                             *utl-uri-uriurl*\r
182 -----------\r
183 #uu geht so nicht mehr!\r
184 ( Reference: <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=^1.2.  )\r
186 URL - Uniform Resource Locators are a subset of URI: A URL is a URI. As the\r
187 name says, a URL identifies a resource by its (network) location. Other ways\r
188 to identify a resource are suggested with "Uniform Resource Names" (URN).\r
189 URI = URL | URN.\r
191 But for the purpose of utl.vim you can ignore the difference between URIs and\r
192 URLs.\r
194 The three letters U, R, I                               *utl-uri-3letters*\r
195 -------------------------\r
196 ( Reference: <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=^1.1 Overview \r
197   The following material is directly taken from there )\r
199 URI are characterized by the following definitions:\r
201 Uniform\r
202    Uniformity provides several benefits: it allows different types of resource\r
203    identifiers to be used in the same context, even when the mechanisms used\r
204    to access those resources may differ; it allows uniform semantic\r
205    interpretation of common syntactic conventions across different types of\r
206    resource identifiers; it allows introduction of new types of resource\r
207    identifiers without interfering with the way that existing identifiers are\r
208    used; and, it allows the identifiers to be reused in many different\r
209    contexts, thus permitting new applications or protocols to leverage a\r
210    pre-existing, large, and widely-used set of resource identifiers.\r
212 Resource\r
213    A resource can be anything that has identity.  Familiar examples include an\r
214    electronic document, an image, a service (e.g., "today's weather report for\r
215    Los Angeles"), and a collection of other resources.  Not all resources are\r
216    network "retrievable"; e.g., human beings, corporations, and bound books in\r
217    a library can also be considered resources.  The resource is the conceptual\r
218    mapping to an entity or set of entities, not necessarily the entity which\r
219    corresponds to that mapping at any particular instance in time.  Thus, a\r
220    resource can remain constant even when its content---the entities to which\r
221    it currently corresponds---changes over time, provided that the conceptual\r
222    mapping is not changed in the process.\r
224 Identifier\r
225    An identifier is an object that can act as a reference to something that\r
226    has identity.  In the case of URI, the object is a sequence of characters\r
227    with a restricted syntax.\r
229 Having identified a resource, a system may perform a variety of operations on\r
230 the resource, as might be characterized by such words as `access', `update',\r
231 `replace', or `find attributes'.\r
234 URI Syntactic Components                                *utl-uri-syntcomp*\r
235 ------------------------\r
236 ( Reference: <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=^3. URI Syntactic  )\r
238 An URI goes like this:\r
240     <scheme>:<scheme-specific-part>\r
242 That means, that the thing behind the colon is specific to the scheme!\r
243 The scheme-specific-part is also known as the `opaque' component.\r
244 But many schemes have a hierarchical structure, which is also defined by\r
245 RFC 2396. The syntax for hierarchical URI is:\r
247     <scheme>://<authority><path>?<query>\r
249 The `authority' often is a host name (but can also be, say, a windows drive).\r
250 An example for a non hierarchical URI is the vimhelp scheme, e.g. `vimhelp:help'.\r
251 Another example is the mailto scheme: mailto:stb@bf-consulting.de\r
253 Each of the above components may be missing, and it's still a valid URI.\r
256 URI References                                          *utl-uri-refs*\r
257 --------------\r
258 ( Reference: <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=^4. URI References )\r
260     URI reference = URI # fragment\r
262 The fragment is not part of an URI! But it often appears in conjunction with\r
263 it, so RFC2396 deals with the fragments also. Utl.vim doesn't care much\r
264 making the correct distinction. Most often it is clear from the context.\r
267 Fragment Identifiers                                    *utl-uri-fragids*\r
268 --------------------\r
269 ( References: <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=^4.1. Fragment  )\r
271 It is very important to realize, that fragment interpretation only depends on\r
272 the media type of the "retrieved" document. Not from, say, the scheme, i.e.\r
273 the protocol.\r
275 This property is utilized by utl.vim since it defines fragment syntax for\r
276 generic, unstructured text (i.e. tn= line=).\r
279 Absolute and relative URI                               *utl-uri-relabs*\r
280 -------------------------\r
281 ( Reference:\r
282   <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=Relative URI references are distinguished  )\r
284 URI come in two forms: relative and absolute. The rule to distinguish between\r
285 the two is very simple:\r
287     Scheme component exists = It's an absolute URI\r
289 Normally, a relative URI is transformed into an absolute URI by the\r
290 application context in which the relative URI appears. Context = base URL\r
293 Escaping forbidden characters                           *utl-uri-forbchars*\r
294 -----------------------------\r
295 #uu stimmt nicht mehr so\r
296 ( Reference: <URL:http://www.ietf.org/rfc/rfc2396.txt> #tn=^2. URI Char )\r
298 Only a limited set of ascii characters are allowed in an URI.  Some other\r
299 characters, like < > ? / : for example, are reserved characters, in the sense\r
300 that they have a special meaning for the URI itself.\r
302 If you need to use a forbidden or reserved character, you have to escape it\r
303 by its hex value. Examples:\r
305     `>'         -> `%3e'\r
306     ` ' (blank) -> `%20'\r
308 Hint: Just use Vim's :asc command <URL:vimhelp:asc> to find out the hex value of\r
309 a character!\r
311 If in doubt if a character is forbidden you can also escape allowed\r
312 characters. Example: <URL:vimhelp:%61%73%63>\r
316 ==============================================================================\r
317 FOOTNOTES\r
319 -----id=foot1\r
320 Thanks for trying out utl.vim :-)\r
323  vim:tw=78:sw=4:sts=4:ts=8:ft=help:norl:\r