/share/vim/vim73/doc/helphelp.txt

https://code.google.com/ · Plain Text · 349 lines · 284 code · 65 blank · 0 comment · 0 complexity · c274415f817a04955078b24a6b2e2ee3 MD5 · raw file

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