Install vim74
[msysgit.git] / share / vim / vim74 / doc / helphelp.txt
blob87f095e56d77c640ea5b837ce3b0f96c040c4a6b
1 *helphelp.txt*  For Vim version 7.4.  Last change: 2012 Nov 28
4                   VIM REFERENCE MANUAL    by Bram Moolenaar
7 Help on help files                                      *helphelp*
9 1. Help commands                |online-help|
10 2. Translated help files        |help-translated|
11 3. Writing help files           |help-writing|
13 ==============================================================================
14 1. Help commands                                        *online-help*
16                         *help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
17 <Help>          or
18 :h[elp]                 Open a window and display the help file in read-only
19                         mode.  If there is a help window open already, use
20                         that one.  Otherwise, if the current window uses the
21                         full width of the screen or is at least 80 characters
22                         wide, the help window will appear just above the
23                         current window.  Otherwise the new window is put at
24                         the very top.
25                         The 'helplang' option is used to select a language, if
26                         the main help file is available in several languages.
27                         {not in Vi}
29                                                 *{subject}* *E149* *E661*
30 :h[elp] {subject}       Like ":help", additionally jump to the tag {subject}.
31                         {subject} can include wildcards like "*", "?" and
32                         "[a-z]":
33                            :help z?     jump to help for any "z" command
34                            :help z.     jump to the help for "z."
35                         If there is no full match for the pattern, or there
36                         are several matches, the "best" match will be used.
37                         A sophisticated algorithm is used to decide which
38                         match is better than another one.  These items are
39                         considered in the computation:
40                         - A match with same case is much better than a match
41                           with different case.
42                         - A match that starts after a non-alphanumeric
43                           character is better than a match in the middle of a
44                           word.
45                         - A match at or near the beginning of the tag is
46                           better than a match further on.
47                         - The more alphanumeric characters match, the better.
48                         - The shorter the length of the match, the better.
50                         The 'helplang' option is used to select a language, if
51                         the {subject} is available in several languages.
52                         To find a tag in a specific language, append "@ab",
53                         where "ab" is the two-letter language code.  See
54                         |help-translated|.
56                         Note that the longer the {subject} you give, the less
57                         matches will be found.  You can get an idea how this
58                         all works by using commandline completion (type CTRL-D
59                         after ":help subject" |c_CTRL-D|).
60                         If there are several matches, you can have them listed
61                         by hitting CTRL-D.  Example: >
62                                 :help cont<Ctrl-D>
64 <                       Instead of typing ":help CTRL-V" to search for help
65                         for CTRL-V you can type: >
66                                 :help ^V
67 <                       This also works together with other characters, for
68                         example to find help for CTRL-V in Insert mode: >
69                                 :help i^V
71                         To use a regexp |pattern|, first do ":help" and then
72                         use ":tag {pattern}" in the help window.  The
73                         ":tnext" command can then be used to jump to other
74                         matches, "tselect" to list matches and choose one. >
75                                 :help index| :tse z.
77 <                       When there is no argument you will see matches for
78                         "help", to avoid listing all possible matches (that
79                         would be very slow).
80                         The number of matches displayed is limited to 300.
82                         This command can be followed by '|' and another
83                         command, but you don't need to escape the '|' inside a
84                         help command.  So these both work: >
85                                 :help |
86                                 :help k| only
87 <                       Note that a space before the '|' is seen as part of
88                         the ":help" argument.
89                         You can also use <LF> or <CR> to separate the help
90                         command from a following command.  You need to type
91                         CTRL-V first to insert the <LF> or <CR>.  Example: >
92                                 :help so<C-V><CR>only
93 <                       {not in Vi}
95 :h[elp]! [subject]      Like ":help", but in non-English help files prefer to
96                         find a tag in a file with the same language as the
97                         current file.  See |help-translated|.
99                                                         *:helpg* *:helpgrep*
100 :helpg[rep] {pattern}[@xx]
101                         Search all help text files and make a list of lines
102                         in which {pattern} matches.  Jumps to the first match.
103                         The optional [@xx] specifies that only matches in the
104                         "xx" language are to be found.
105                         You can navigate through the matches with the
106                         |quickfix| commands, e.g., |:cnext| to jump to the
107                         next one.  Or use |:cwindow| to get the list of
108                         matches in the quickfix window.
109                         {pattern} is used as a Vim regexp |pattern|.
110                         'ignorecase' is not used, add "\c" to ignore case.
111                         Example for case sensitive search: >
112                                 :helpgrep Uganda
113 <                       Example for case ignoring search: >
114                                 :helpgrep uganda\c
115 <                       Example for searching in French help: >
116                                 :helpgrep backspace@fr
117 <                       The pattern does not support line breaks, it must
118                         match within one line.  You can use |:grep| instead,
119                         but then you need to get the list of help files in a
120                         complicated way.
121                         Cannot be followed by another command, everything is
122                         used as part of the pattern.  But you can use
123                         |:execute| when needed.
124                         Compressed help files will not be searched (Fedora
125                         compresses the help files).
126                         {not in Vi}
128                                                         *:lh* *:lhelpgrep*
129 :lh[elpgrep] {pattern}[@xx]
130                         Same as ":helpgrep", except the location list is used
131                         instead of the quickfix list.  If the help window is
132                         already opened, then the location list for that window
133                         is used.  Otherwise, a new help window is opened and
134                         the location list for that window is set.  The
135                         location list for the current window is not changed.
137                                                         *:exu* *:exusage*
138 :exu[sage]              Show help on Ex commands.  Added to simulate the Nvi
139                         command. {not in Vi}
141                                                         *:viu* *:viusage*
142 :viu[sage]              Show help on Normal mode commands.  Added to simulate
143                         the Nvi command. {not in Vi}
145 When no argument is given to |:help| the file given with the 'helpfile' option
146 will be opened.  Otherwise the specified tag is searched for in all "doc/tags"
147 files in the directories specified in the 'runtimepath' option.
149 The initial height of the help window can be set with the 'helpheight' option
150 (default 20).
152 Jump to specific subjects by using tags.  This can be done in two ways:
153 - Use the "CTRL-]" command while standing on the name of a command or option.
154   This only works when the tag is a keyword.  "<C-Leftmouse>" and
155   "g<LeftMouse>" work just like "CTRL-]".
156 - use the ":ta {subject}" command.  This also works with non-keyword
157   characters.
159 Use CTRL-T or CTRL-O to jump back.
160 Use ":q" to close the help window.
162 If there are several matches for an item you are looking for, this is how you
163 can jump to each one of them:
164 1. Open a help window
165 2. Use the ":tag" command with a slash prepended to the tag.  E.g.: >
166         :tag /min
167 3. Use ":tnext" to jump to the next matching tag.
169 It is possible to add help files for plugins and other items.  You don't need
170 to change the distributed help files for that.  See |add-local-help|.
172 To write a local help file, see |write-local-help|.
174 Note that the title lines from the local help files are automagically added to
175 the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
176 This is done when viewing the file in Vim, the file itself is not changed.  It
177 is done by going through all help files and obtaining the first line of each
178 file.  The files in $VIMRUNTIME/doc are skipped.
180                                                         *help-xterm-window*
181 If you want to have the help in another xterm window, you could use this
182 command: >
183         :!xterm -e vim +help &
186                         *:helpfind* *:helpf*
187 :helpf[ind]             Like |:help|, but use a dialog to enter the argument.
188                         Only for backwards compatibility.  It now executes the
189                         ToolBar.FindHelp menu entry instead of using a builtin
190                         dialog.  {only when compiled with |+GUI_GTK|}
191                         {not in Vi}
193                                         *:helpt* *:helptags*
194                                 *E154* *E150* *E151* *E152* *E153* *E670*
195 :helpt[ags] [++t] {dir}
196                         Generate the help tags file(s) for directory {dir}.
197                         All "*.txt" and "*.??x" files in the directory and
198                         sub-directories are scanned for a help tag definition
199                         in between stars.  The "*.??x" files are for
200                         translated docs, they generate the "tags-??" file, see
201                         |help-translated|.  The generated tags files are
202                         sorted.
203                         When there are duplicates an error message is given.
204                         An existing tags file is silently overwritten.
205                         The optional "++t" argument forces adding the
206                         "help-tags" tag.  This is also done when the {dir} is
207                         equal to $VIMRUNTIME/doc.
208                         To rebuild the help tags in the runtime directory
209                         (requires write permission there): >
210                                 :helptags $VIMRUNTIME/doc
211 <                       {not in Vi}
214 ==============================================================================
215 2. Translated help files                                *help-translated*
217 It is possible to add translated help files, next to the original English help
218 files.  Vim will search for all help in "doc" directories in 'runtimepath'.
219 This is only available when compiled with the |+multi_lang| feature.
221 At this moment translations are available for:
222         Chinese  - multiple authors
223         French   - translated by David Blanchet
224         Italian  - translated by Antonio Colombo
225         Japanese - multiple authors
226         Polish   - translated by Mikolaj Machowski
227         Russian  - translated by Vassily Ragosin
228 See the Vim website to find them: http://www.vim.org/translations.php
230 A set of translated help files consists of these files:
232         help.abx
233         howto.abx
234         ...
235         tags-ab
237 "ab" is the two-letter language code.  Thus for Italian the names are:
239         help.itx
240         howto.itx
241         ...
242         tags-it
244 The 'helplang' option can be set to the preferred language(s).  The default is
245 set according to the environment.  Vim will first try to find a matching tag
246 in the preferred language(s).  English is used when it cannot be found.
248 To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
249 two-letter language code.  Example: >
250         :he user-manual@it
251         :he user-manual@en
252 The first one finds the Italian user manual, even when 'helplang' is empty.
253 The second one finds the English user manual, even when 'helplang' is set to
254 "it".
256 When using command-line completion for the ":help" command, the "@en"
257 extension is only shown when a tag exists for multiple languages.  When the
258 tag only exists for English "@en" is omitted.
260 When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
261 find the tag in the same language.  If not found then 'helplang' will be used
262 to select a language.
264 Help files must use latin1 or utf-8 encoding.  Vim assumes the encoding is
265 utf-8 when finding non-ASCII characters in the first line.  Thus you must
266 translate the header with "For Vim version".
268 The same encoding must be used for the help files of one language in one
269 directory.  You can use a different encoding for different languages and use
270 a different encoding for help files of the same language but in a different
271 directory.
273 Hints for translators:
274 - Do not translate the tags.  This makes it possible to use 'helplang' to
275   specify the preferred language.  You may add new tags in your language.
276 - When you do not translate a part of a file, add tags to the English version,
277   using the "tag@en" notation.
278 - Make a package with all the files and the tags file available for download.
279   Users can drop it in one of the "doc" directories and start use it.
280   Report this to Bram, so that he can add a link on www.vim.org.
281 - Use the |:helptags| command to generate the tags files.  It will find all
282   languages in the specified directory.
284 ==============================================================================
285 3. Writing help files                                   *help-writing*
287 For ease of use, a Vim help file for a plugin should follow the format of the
288 standard Vim help files.  If you are writing a new help file it's best to copy
289 one of the existing files and use it as a template.
291 The first line in a help file should have the following format:
293 *helpfile_name.txt*     For Vim version 7.3     Last change: 2010 June 4
295 The first field is a link to the help file name.  The second field describes
296 the applicable Vim version.  The last field specifies the last modification
297 date of the file.  Each field is separated by a tab.
299 At the bottom of the help file, place a Vim modeline to set the 'textwidth'
300 and 'tabstop' options and the 'filetype' to 'help'.  Never set a global option
301 in such a modeline, that can have consequences undesired by whoever reads that
302 help.
305 TAGS
307 To define a help tag, place the name between asterisks (*tag-name*).  The
308 tag-name should be different from all the Vim help tag names and ideally
309 should begin with the name of the Vim plugin.  The tag name is usually right
310 aligned on a line.
312 When referring to an existing help tag and to create a hot-link, place the
313 name between two bars (|) eg. |help-writing|.
315 When referring to a Vim option in the help file, place the option name between
316 two single quotes, eg. 'statusline'
319 HIGHLIGHTING
321 To define a column heading, use a tilde character at the end of the line.
322 This will highlight the column heading in a different color.  E.g.
324 Column heading~
326 To separate sections in a help file, place a series of '=' characters in a
327 line starting from the first column.  The section separator line is highlighted
328 differently.
330 To quote a block of ex-commands verbatim, place a greater than (>) character
331 at the end of the line before the block and a less than (<) character as the
332 first non-blank on a line following the block.  Any line starting in column 1
333 also implicitly stops the block of ex-commands before it.  E.g. >
334     function Example_Func()
335         echo "Example"
336     endfunction
339 The following are highlighted differently in a Vim help file:
340   - a special key name expressed either in <> notation as in <PageDown>, or
341     as a Ctrl character as in CTRL-X
342   - anything between {braces}, e.g. {lhs} and {rhs}
344 The word "Note", "Notes" and similar automagically receive distinctive
345 highlighting.  So do these:
346         *Todo   something to do
347         *Error  something wrong
349 You can find the details in $VIMRUNTIME/syntax/help.vim
351  vim:tw=78:ts=8:ft=help:norl: