blob: eea639fd218f0fde8bdb172dd761b4f4e2a31e3d [file] [log] [blame]
Bram Moolenaar91604412010-06-03 20:25:18 +02001*helphelp.txt* For Vim version 7.3a. Last change: 2008 Jul 21
2
3
4 VIM REFERENCE MANUAL by Bram Moolenaar
5
6
7Help on help files *helphelp*
8
91. Help commands |online-help|
102. Translating help files |help-translated|
113. Writing help files |help-writing|
12
13==============================================================================
141. Help commands *online-help*
15
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}
28
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.
49
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|.
55
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>
63< To use a regexp |pattern|, first do ":help" and then
64 use ":tag {pattern}" in the help window. The
65 ":tnext" command can then be used to jump to other
66 matches, "tselect" to list matches and choose one. >
67 :help index| :tse z.
68< When there is no argument you will see matches for
69 "help", to avoid listing all possible matches (that
70 would be very slow).
71 The number of matches displayed is limited to 300.
72
73 This command can be followed by '|' and another
74 command, but you don't need to escape the '|' inside a
75 help command. So these both work: >
76 :help |
77 :help k| only
78< Note that a space before the '|' is seen as part of
79 the ":help" argument.
80 You can also use <LF> or <CR> to separate the help
81 command from a following command. You need to type
82 CTRL-V first to insert the <LF> or <CR>. Example: >
83 :help so<C-V><CR>only
84< {not in Vi}
85
86:h[elp]! [subject] Like ":help", but in non-English help files prefer to
87 find a tag in a file with the same language as the
88 current file. See |help-translated|.
89
90 *:helpg* *:helpgrep*
91:helpg[rep] {pattern}[@xx]
92 Search all help text files and make a list of lines
93 in which {pattern} matches. Jumps to the first match.
94 The optional [@xx] specifies that only matches in the
95 "xx" language are to be found.
96 You can navigate through the matches with the
97 |quickfix| commands, e.g., |:cnext| to jump to the
98 next one. Or use |:cwindow| to get the list of
99 matches in the quickfix window.
100 {pattern} is used as a Vim regexp |pattern|.
101 'ignorecase' is not used, add "\c" to ignore case.
102 Example for case sensitive search: >
103 :helpgrep Uganda
104< Example for case ignoring search: >
105 :helpgrep uganda\c
106< Example for searching in French help: >
107 :helpgrep backspace@fr
108< The pattern does not support line breaks, it must
109 match within one line. You can use |:grep| instead,
110 but then you need to get the list of help files in a
111 complicated way.
112 Cannot be followed by another command, everything is
113 used as part of the pattern. But you can use
114 |:execute| when needed.
115 Compressed help files will not be searched (Fedora
116 compresses the help files).
117 {not in Vi}
118
119 *:lh* *:lhelpgrep*
120:lh[elpgrep] {pattern}[@xx]
121 Same as ":helpgrep", except the location list is used
122 instead of the quickfix list. If the help window is
123 already opened, then the location list for that window
124 is used. Otherwise, a new help window is opened and
125 the location list for that window is set. The
126 location list for the current window is not changed.
127
128 *:exu* *:exusage*
129:exu[sage] Show help on Ex commands. Added to simulate the Nvi
130 command. {not in Vi}
131
132 *:viu* *:viusage*
133:viu[sage] Show help on Normal mode commands. Added to simulate
134 the Nvi command. {not in Vi}
135
136When no argument is given to |:help| the file given with the 'helpfile' option
137will be opened. Otherwise the specified tag is searched for in all "doc/tags"
138files in the directories specified in the 'runtimepath' option.
139
140The initial height of the help window can be set with the 'helpheight' option
141(default 20).
142
143Jump to specific subjects by using tags. This can be done in two ways:
144- Use the "CTRL-]" command while standing on the name of a command or option.
145 This only works when the tag is a keyword. "<C-Leftmouse>" and
146 "g<LeftMouse>" work just like "CTRL-]".
147- use the ":ta {subject}" command. This also works with non-keyword
148 characters.
149
150Use CTRL-T or CTRL-O to jump back.
151Use ":q" to close the help window.
152
153If there are several matches for an item you are looking for, this is how you
154can jump to each one of them:
1551. Open a help window
1562. Use the ":tag" command with a slash prepended to the tag. E.g.: >
157 :tag /min
1583. Use ":tnext" to jump to the next matching tag.
159
160It is possible to add help files for plugins and other items. You don't need
161to change the distributed help files for that. See |add-local-help|.
162
163To write a local help file, see |write-local-help|.
164
165Note that the title lines from the local help files are automagically added to
166the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
167This is done when viewing the file in Vim, the file itself is not changed. It
168is done by going through all help files and obtaining the first line of each
169file. The files in $VIMRUNTIME/doc are skipped.
170
171 *help-xterm-window*
172If you want to have the help in another xterm window, you could use this
173command: >
174 :!xterm -e vim +help &
175<
176
177 *:helpfind* *:helpf*
178:helpf[ind] Like |:help|, but use a dialog to enter the argument.
179 Only for backwards compatibility. It now executes the
180 ToolBar.FindHelp menu entry instead of using a builtin
181 dialog. {only when compiled with |+GUI_GTK|}
182< {not in Vi}
183
184 *:helpt* *:helptags*
185 *E154* *E150* *E151* *E152* *E153* *E670*
186:helpt[ags] [++t] {dir}
187 Generate the help tags file(s) for directory {dir}.
188 All "*.txt" and "*.??x" files in the directory are
189 scanned for a help tag definition in between stars.
190 The "*.??x" files are for translated docs, they
191 generate the "tags-??" file, see |help-translated|.
192 The generated tags files are sorted.
193 When there are duplicates an error message is given.
194 An existing tags file is silently overwritten.
195 The optional "++t" argument forces adding the
196 "help-tags" tag. This is also done when the {dir} is
197 equal to $VIMRUNTIME/doc.
198 To rebuild the help tags in the runtime directory
199 (requires write permission there): >
200 :helptags $VIMRUNTIME/doc
201< {not in Vi}
202
203
204==============================================================================
2052. Translated help files *help-translated*
206
207It is possible to add translated help files, next to the original English help
208files. Vim will search for all help in "doc" directories in 'runtimepath'.
209This is only available when compiled with the |+multi_lang| feature.
210
211At this moment translations are available for:
212 Chinese - multiple authors
213 French - translated by David Blanchet
214 Italian - translated by Antonio Colombo
215 Polish - translated by Mikolaj Machowski
216 Russian - translated by Vassily Ragosin
217See the Vim website to find them: http://www.vim.org/translations.php
218
219A set of translated help files consists of these files:
220
221 help.abx
222 howto.abx
223 ...
224 tags-ab
225
226"ab" is the two-letter language code. Thus for Italian the names are:
227
228 help.itx
229 howto.itx
230 ...
231 tags-it
232
233The 'helplang' option can be set to the preferred language(s). The default is
234set according to the environment. Vim will first try to find a matching tag
235in the preferred language(s). English is used when it cannot be found.
236
237To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
238two-letter language code. Example: >
239 :he user-manual@it
240 :he user-manual@en
241The first one finds the Italian user manual, even when 'helplang' is empty.
242The second one finds the English user manual, even when 'helplang' is set to
243"it".
244
245When using command-line completion for the ":help" command, the "@en"
246extension is only shown when a tag exists for multiple languages. When the
247tag only exists for English "@en" is omitted.
248
249When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
250find the tag in the same language. If not found then 'helplang' will be used
251to select a language.
252
253Help files must use latin1 or utf-8 encoding. Vim assumes the encoding is
254utf-8 when finding non-ASCII characters in the first line. Thus you must
255translate the header with "For Vim version".
256
257The same encoding must be used for the help files of one language in one
258directory. You can use a different encoding for different languages and use
259a different encoding for help files of the same language but in a different
260directory.
261
262Hints for translators:
263- Do not translate the tags. This makes it possible to use 'helplang' to
264 specify the preferred language. You may add new tags in your language.
265- When you do not translate a part of a file, add tags to the English version,
266 using the "tag@en" notation.
267- Make a package with all the files and the tags file available for download.
268 Users can drop it in one of the "doc" directories and start use it.
269 Report this to Bram, so that he can add a link on www.vim.org.
270- Use the |:helptags| command to generate the tags files. It will find all
271 languages in the specified directory.
272
273==============================================================================
2743. Writing help files *help-writing*
275
Bram Moolenaar945e2db2010-06-05 17:43:32 +0200276For ease of use, a Vim help file for a plugin should follow the format of the
277standard Vim help files. If you are writing a new help file it's best to copy
278one of the existing files and use it as a template.
279
280The first line in a help file should have the following format:
281
282*helpfile_name.txt* For Vim version 7.3 Last change: 2010 June 4
283
284The first field is a link to the help file name. The second field describes
285the applicable Vim version. The last field specifies the last modification
286date of the file. Each field is separated by a tab.
287
288At the bottom of the help file, place a Vim modeline to set the 'textwidth'
289and 'tabstop' options and the 'filetype' to 'help'. Never set a global option
290in such a modeline, that can have consequences undesired by whoever reads that
291help.
292
293
294TAGS
295
296To define a help tag, place the name between asterisks (*tag-name*). The
297tag-name should be different from all the Vim help tag names and ideally
298should begin with the name of the Vim plugin. The tag name is usually right
299aligned on a line.
300
301When referring to an existing help tag and to create a hot-link, place the
302name between two bars (|) eg. |help-writing|.
303
304When referring to a Vim option in the help file, place the option name between
305two single quotes. eg. 'statusline'
306
307
308HIGHLIGHTING
309
310To define a column heading, use a tilde character at the end of the line. This
311will highlight the column heading in a different color. E.g.
312
313Column heading~
314
315To separate sections in a help file, place a series of '=' characters in a
316line starting from the first column. The section separator line is highlighted
317differently.
318
319To quote a block of ex-commands verbatim, place a greater than (>) character
320at the end of the line before the block and a less than (<) character as the
321first non-blank on a line following the block. Any line starting in column 1
322also implicitly stops the block of ex-commands before it. E.g. >
323 function Example_Func()
324 echo "Example"
325 endfunction
326<
327
328The following are highlighted differently in a Vim help file:
329 - a special key name expressed either in <> notation as in <PageDown>, or
330 as a Ctrl character as in CTRL-X
331 - anything between {braces}, e.g. {lhs} and {rhs}
332
333The word "Note", "Notes" and similar automagically receive distinctive
334highlighting. So do these:
335 *Todo something to do
336 *Error something wrong
337
338You can find the details in $VIMRUNTIME/syntax/help.vim
Bram Moolenaar91604412010-06-03 20:25:18 +0200339
340 vim:tw=78:ts=8:ft=help:norl: