helphelp.txt 15 KB

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