robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 1dc9728daa1d8a2702

master
22.9 KiB571 linesraw
1*helphelp.txt*	Nvim
2
3
4		  VIM REFERENCE MANUAL	  by Bram Moolenaar
5
6
7Help on help files					*helphelp*
8
9                                      Type |gO| to see the table of contents.
10
11==============================================================================
12Help tag conventions					*help-context*
13
14Get specific help:  It is possible to go directly to whatever you want help
15on, by giving an argument to the |:help| command. Prepend something to specify
16the context: >
17
18	  WHAT			PREPEND    EXAMPLE
19      Normal mode command		   :help x
20      Visual mode command	  v_	   :help v_u
21      Insert mode command	  i_	   :help i_<Esc>
22      Command-line command	  :	   :help :quit
23      Command-line editing	  c_	   :help c_<Del>
24      Vim command argument	  -	   :help -r
25      Option			  '	   :help 'textwidth'
26      Regular expression	  /	   :help /[
27
28See |help-summary| for more contexts and an explanation.
29See |notation| for an explanation of the help syntax.
30
31SEARCH FOR HELP
32
33Type ":help word", then hit CTRL-D to see matching help entries for "word". Or
34use ":helpgrep word". |:helpgrep|
35
36==============================================================================
37Notation						*notation*
38
39When syntax highlighting is used to read this, text that is not typed
40literally is often highlighted with the Special group.  These are items in [],
41{} and <>, and CTRL-X.
42
43Note that Vim uses all possible characters in commands.  Sometimes the [], {}
44and <> are part of what you type, the context should make this clear.
45
46
47- []            Characters in square brackets are optional.
48
49                                                    *count* *[count]*
50- [count]       An optional number that may precede the command to multiply
51                or iterate the command.  If no number is given, a count of one
52                is used, unless otherwise noted.  Note that in this manual the
53                [count] is not mentioned in the description of the command,
54                but only in the explanation.  This was done to make the
55                commands easier to look up.  If the 'showcmd' option is on,
56                the (partially) entered count is shown at the bottom of the
57                window.  You can use <Del> to erase the last digit (|N<Del>|).
58
59                                                        *[quotex]*
60- ["x]          An optional register designation where text can be stored.
61                See |registers|.  The x is a single character between 'a' and
62                'z' or 'A' and 'Z' or '"', and in some cases (with the put
63                command) between '0' and '9', '%', '#', or others.  The
64                uppercase and lowercase letter designate the same register,
65                but the lowercase letter is used to overwrite the previous
66                register contents, while the uppercase letter is used to
67                append to the previous register contents.  Without the ""x" or
68                with """" the stored text is put into the unnamed register.
69
70                                                        *{}*
71- {}            Curly braces denote parts of the command which must appear,
72                but which can take a number of different values.  The
73                differences between Vim and Vi are also given in curly braces
74                (this will be clear from the context).
75
76                                                        *{char1-char2}*
77- {char1-char2} A single character from the range char1 to char2.  For
78                example: {a-z} is a lowercase letter.  Multiple ranges may be
79                concatenated.  For example, {a-zA-Z0-9} is any alphanumeric
80                character.
81
82                                                *{motion}* *movement*
83- {motion}      A command that moves the cursor.  These are explained in
84                |motion.txt|.
85                - Examples:
86                  - `w`           to start of next word
87                  - `b`           to begin of current word
88                  - `4j`          four lines down
89                  - `/The<CR>`    to next occurrence of "The"
90                - This is used after an |operator| command to move over the
91                  text that is to be operated upon.
92                  - If the motion includes a count and the operator also has
93                    a count, the two counts are multiplied.  For example:
94                    "2d3w" deletes six words.
95                  - The motion can be backwards, e.g. "db" to delete to the
96                    start of the word.
97                  - The motion can also be a mouse click.  The mouse is not
98                    supported in every terminal though.
99                  - The ":omap" command can be used to map characters while an
100                    operator is pending.
101                  - Ex commands can be used to move the cursor.  This can be
102                    used to call a function that does some complicated motion.
103                    The motion is always charwise exclusive, no matter what
104                    ":" command is used.  This means it's impossible to
105                    include the last character of a line without the line
106                    break (unless 'virtualedit' is set). If the Ex command
107                    changes the text before where the operator starts or jumps
108                    to another buffer the result is unpredictable.  It is
109                    possible to change the text further down.  Jumping to
110                    another buffer is possible if the current buffer is not
111                    unloaded.
112
113                                                        *{Visual}*
114- {Visual}      A selected text area.  It is started with the "v", "V", or
115                CTRL-V command, then any cursor movement command can be used
116                to change the end of the selected text.
117                This is used before an |operator| command to highlight the
118                text that is to be operated upon.
119                See |Visual-mode|.
120
121                                                        *<character>*
122- <character>   A special character from the table below, optionally with
123                modifiers, or a single ASCII character with modifiers.
124
125                                                        *'character'*
126- 'c'           A single ASCII character.
127
128                                                        *CTRL-{char}*
129- CTRL-{char}   {char} typed as a control character; that is, typing {char}
130                while holding the CTRL key down.  The case of {char} is
131                ignored; thus CTRL-A and CTRL-a are equivalent.  But in
132                some terminals and environments, using the SHIFT key will
133                produce a distinct code (e.g. CTRL-SHIFT-a); in these
134                environments using the SHIFT key will not trigger commands
135                such as CTRL-A.
136
137                                                        *'option'*
138- 'option'      An option, or parameter, that can be set to a value, is
139                enclosed in single quotes.  See |options|.
140
141                                                        *quotecommandquote*
142- "command"     A reference to a command that you can type is enclosed in
143                double quotes.
144- `command`     New style command, this distinguishes it from other quoted
145                text and strings.
146
147==============================================================================
148Help commands						*online-help*
149
150			*help* *<Help>* *:h* *:help* *<F1>* *i_<F1>* *i_<Help>*
151<Help>		or
152:h[elp]			Open a window and display the help file in read-only
153			mode.  If there is a help window open already, use
154			that one.  Otherwise, if the current window uses the
155			full width of the screen or is at least 80 characters
156			wide, the help window will appear just above the
157			current window.  Otherwise the new window is put at
158			the very top.
159			The 'helplang' option is used to select a language, if
160			the main help file is available in several languages.
161
162			Type |gO| to see the table of contents.
163
164							*:help!*
165:h[elp]!		Guesses a help tag from the |WORD| at cursor, in DWIM ("Do
166			What I Mean") fashion: trims punctuation using various
167			heuristics until a valid help tag is found.
168
169			For example, move the cursor anywhere in this code,
170			then run `:help!`: >
171
172				local v = vim.version.parse(vim.system({'foo'}):wait().stdout)
173<
174			Then compare to `:exe 'help' expand('<cword>')`.
175
176						*{subject}* *E149* *E661*
177:h[elp] {subject}	Like ":help", additionally jump to the tag {subject}.
178			For example:  >
179				:help options
180
181<			{subject} can include wildcards such as "*", "?" and
182			"[a-z]":
183			   :help z?	jump to help for any "z" command
184			   :help z.	jump to the help for "z."
185			But when a tag exists it is taken literally:
186			   :help :?	jump to help for ":?"
187
188			If there is no full match for the pattern, or there
189			are several matches, the "best" match will be used.
190			A sophisticated algorithm is used to decide which
191			match is better than another one.  These items are
192			considered in the computation:
193			- A match with same case is much better than a match
194			  with different case.
195			- A match that starts after a non-alphanumeric
196			  character is better than a match in the middle of a
197			  word.
198			- A match at or near the beginning of the tag is
199			  better than a match further on.
200			- The more alphanumeric characters match, the better.
201			- The shorter the length of the match, the better.
202
203			The 'helplang' option is used to select a language, if
204			the {subject} is available in several languages.
205			To find a tag in a specific language, append "@ab",
206			where "ab" is the two-letter language code.  See
207			|help-translated|.
208
209			Note that the longer the {subject} you give, the less
210			matches will be found.  You can get an idea how this
211			all works by using commandline completion (type CTRL-D
212			after ":help subject" |c_CTRL-D|).
213			If there are several matches, you can have them listed
214			by hitting CTRL-D.  Example: >
215				:help cont<Ctrl-D>
216
217<			Instead of typing ":help CTRL-V" to search for help
218			for CTRL-V you can type: >
219				:help ^V
220<			This also works together with other characters, for
221			example to find help for CTRL-V in Insert mode: >
222				:help i^V
223<
224			It is also possible to first do ":help" and then
225			use ":tag {pattern}" in the help window.  The
226			":tnext" command can then be used to jump to other
227			matches, "tselect" to list matches and choose one. >
228				:help index
229				:tselect /.*mode
230
231<			When there is no argument you will see matches for
232			"help", to avoid listing all possible matches (that
233			would be very slow).
234			The number of matches displayed is limited to 300.
235
236			The `:help` command can be followed by '|' and another
237			command, but you don't need to escape the '|' inside a
238			help command.  So these both work: >
239				:help |
240				:help k| only
241<			Note that a space before the '|' is seen as part of
242			the ":help" argument.
243			You can also use <NL> or <CR> to separate the help
244			command from a following command.  You need to type
245			CTRL-V first to insert the <NL> or <CR>.  Example: >
246				:help so<C-V><CR>only
247<
248
249:h[elp]! {subject}	Like ":help", but prefers tags with the same
250			|help-translated| language as the current file.
251
252			Unrelated to |:help!| (no {subject}).
253
254							*:helpc* *:helpclose*
255:helpc[lose]		Close one help window, if there is one.
256			Vim will try to restore the window layout (including
257			cursor position) to the same layout it was before
258			opening the help window initially.  This might cause
259			triggering several autocommands.
260
261							*:helpg* *:helpgrep*
262:helpg[rep] {pattern}[@xx]
263			Search all help text files and make a list of lines
264			in which {pattern} matches.  Jumps to the first match.
265			The optional [@xx] specifies that only matches in the
266			"xx" language are to be found.
267			You can navigate through the matches with the
268			|quickfix| commands, e.g., |:cnext| to jump to the
269			next one.  Or use |:cwindow| to get the list of
270			matches in the quickfix window.
271			{pattern} is used as a Vim regexp |pattern|.
272			'ignorecase' is not used, add "\c" to ignore case.
273			Example for case sensitive search: >
274				:helpgrep Uganda
275<			Example for case ignoring search: >
276				:helpgrep uganda\c
277<			Example for searching in French help: >
278				:helpgrep backspace@fr
279<			The pattern does not support line breaks, it must
280			match within one line.  You can use |:grep| instead,
281			but then you need to get the list of help files in a
282			complicated way.
283			Cannot be followed by another command, everything is
284			used as part of the pattern.  But you can use
285			|:execute| when needed.
286			Compressed help files will not be searched (Fedora
287			compresses the help files).
288
289							*:lh* *:lhelpgrep*
290:lh[elpgrep] {pattern}[@xx]
291			Same as ":helpgrep", except the location list is used
292			instead of the quickfix list.  If the help window is
293			already opened, then the location list for that window
294			is used.  Otherwise, a new help window is opened and
295			the location list for that window is set.  The
296			location list for the current window is not changed
297			then.
298
299							*:exu* *:exusage*
300:exu[sage]		Show help on Ex commands.  Added to simulate the Nvi
301			command.
302
303							*:viu* *:viusage*
304:viu[sage]		Show help on Normal mode commands.  Added to simulate
305			the Nvi command.
306
307When no argument is given to |:help| the file given with the 'helpfile' option
308will be opened.  Otherwise the specified tag is searched for in all "doc/tags"
309files in the directories specified in the 'runtimepath' option.
310
311If you would like to open the help in the current window, see this tip:
312|help-curwin|.
313
314The initial height of the help window can be set with the 'helpheight' option
315(default 20).
316						*help-buffer-options*
317When the help buffer is created, several local options are set to make sure
318the help text is displayed as it was intended:
319    'iskeyword'		nearly all ASCII chars except ' ', "*", '"' and '|'
320    'foldmethod'	"manual"
321    'tabstop'		8
322    'arabic'		off
323    'binary'		off
324    'buflisted'		off
325    'cursorbind'	off
326    'diff'		off
327    'foldenable'	off
328    'list'		off
329    'modifiable'	off
330    'number'		off
331    'relativenumber'	off
332    'rightleft'		off
333    'scrollbind'	off
334    'spell'		off
335
336Jump to specific subjects by using tags.  This can be done in two ways:
337- Use the "CTRL-]" command while standing on the name of a command or option.
338  This only works when the tag is a keyword.  "g<LeftMouse>" works just like
339  "CTRL-]".
340- use the ":ta {subject}" command.  This also works with non-keyword
341  characters.
342
343Use CTRL-T or CTRL-O to jump back.
344Use ":q" to close the help window.
345Use `g==` to execute the current Lua/Vimscript code block.
346
347If there are several matches for an item you are looking for, this is how you
348can jump to each one of them:
3491. Open a help window
3502. Use the ":tag" command with a slash prepended to the tag.  E.g.: >
351	:tag /min
3523. Use ":tnext" to jump to the next matching tag.
353
354It is possible to add help files for plugins and other items.  You don't need
355to change the distributed help files for that.  See |add-local-help|.
356
357To write a local help file, see |write-local-help|.
358
359Note that the title lines from the local help files are automagically added to
360the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
361This is done when viewing the file in Vim, the file itself is not changed.  It
362is done by going through all help files and obtaining the first line of each
363file.  The files in $VIMRUNTIME/doc are skipped.
364
365					*:helpt* *:helptags*
366			*E150* *E151* *E152* *E153* *E154* *E670* *E856*
367:helpt[ags] [++t] {dir}
368			Generate the help tags file(s) for directory {dir}.
369			When {dir} is ALL then all "doc" directories in
370			'runtimepath' will be used.
371
372			All "*.txt" and "*.??x" files in the directory and
373			sub-directories are scanned for a help tag definition
374			in between stars.  The "*.??x" files are for
375			translated docs, they generate the "tags-??" file, see
376			|help-translated|.  The generated tags files are
377			sorted.
378			When there are duplicates an error message is given.
379			An existing tags file is silently overwritten.
380			Requires the "vimdoc" |treesitter| parser.
381
382			The optional "++t" argument forces adding the
383			"help-tags" tag.  This is also done when the {dir} is
384			equal to $VIMRUNTIME/doc.
385
386			To rebuild the help tags in the runtime directory
387			(requires write permission there): >
388				:helptags $VIMRUNTIME/doc
389<
390
391
392==============================================================================
393Translated help files					*help-translated*
394
395It is possible to add translated help files, next to the original English help
396files.  Vim will search for all help in "doc" directories in 'runtimepath'.
397
398At this moment translations are available for:
399	Chinese  - multiple authors
400	French   - translated by David Blanchet
401	Italian  - translated by Antonio Colombo
402	Japanese - multiple authors
403	Polish   - translated by Mikolaj Machowski
404	Russian  - translated by Vassily Ragosin
405See the Vim website to find them: https://www.vim.org/translations.php
406
407A set of translated help files consists of these files:
408
409	help.abx
410	howto.abx
411	...
412	tags-ab
413
414"ab" is the two-letter language code.  Thus for Italian the names are:
415
416	help.itx
417	howto.itx
418	...
419	tags-it
420
421The 'helplang' option can be set to the preferred language(s).  The default is
422set according to the environment.  Vim will first try to find a matching tag
423in the preferred language(s).  English is used when it cannot be found.
424
425To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
426two-letter language code.  Example: >
427	:he user-manual@it
428	:he user-manual@en
429The first one finds the Italian user manual, even when 'helplang' is empty.
430The second one finds the English user manual, even when 'helplang' is set to
431"it".
432
433When using command-line completion for the ":help" command, the "@en"
434extension is only shown when a tag exists for multiple languages.  When the
435tag only exists for English "@en" is omitted.  When the first candidate has an
436"@ab" extension and it matches the first language in 'helplang' "@ab" is also
437omitted.
438
439When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
440find the tag in the same language.  If not found then 'helplang' will be used
441to select a language.
442
443Help files must use latin1 or utf-8 encoding.  Vim assumes the encoding is
444utf-8 when finding non-ASCII characters in the first line.  Thus you must
445translate the header with "For Vim version".
446
447The same encoding must be used for the help files of one language in one
448directory.  You can use a different encoding for different languages and use
449a different encoding for help files of the same language but in a different
450directory.
451
452Hints for translators:
453- Do not translate the tags.  This makes it possible to use 'helplang' to
454  specify the preferred language.  You may add new tags in your language.
455- When you do not translate a part of a file, add tags to the English version,
456  using the "tag@en" notation.
457- Make a package with all the files and the tags file available for download.
458  Users can drop it in one of the "doc" directories and start use it.
459  Report to the development team, so they can add a link on www.vim.org.
460- Use the |:helptags| command to generate the tags files.  It will find all
461  languages in the specified directory.
462
463==============================================================================
464Writing help files					*help-writing*
465
466For ease of use, a Vim help file for a plugin should follow the format of the
467standard Vim help files, except for the first line.  If you are writing a new
468help file it's best to copy one of the existing files and use it as a
469template.
470
471The first line in a help file should have the following format: >
472
473	*plugin_name.txt*	{short description of the plugin}
474
475The first field is a help tag where ":help plugin_name" will jump to.  The
476remainder of the line, after a Tab, describes the plugin purpose in a short
477way.  This will show up in the "LOCAL ADDITIONS" section of the main help
478file.  Check there that it shows up properly: |local-additions|.
479
480If you want to add a version number or last modification date, put it in the
481second line, right aligned.
482
483At the bottom of the help file, place a Vim modeline to set the 'textwidth'
484and 'tabstop' options and the 'filetype' to "help".  Never set a global option
485in such a modeline, that can have undesired consequences.
486
487
488STYLE
489
490If your Vim has 'modeline' enabled, Vim should follow the preferred style
491automatically when editing built-in help files.
492
493Vim help files should be formatted for a 'textwidth' of 78 characters, so they
494look good in a typical 80 x 24 terminal window.
495
496Use two spaces between the final dot of a sentence of the first letter of the
497next sentence.  Like this.
498
499Use tab characters for aligning content, with a 'tabstop' setting of 8.
500This also helps reduce the file size.
501
502Always use |:retab| after you have finished editing.  Don't blindly use
503|:retab!|, always review what will be changed to avoid unwanted changes.
504
505
506TAGS
507
508To define a help tag, place the name between asterisks ("*tag-name*").  The
509tag-name should be different from all the Vim help tag names and ideally
510should begin with the name of the Vim plugin.  The tag name is usually right
511aligned on a line.
512
513When referring to an existing help tag and to create a hot-link, place the
514name between two bars ("|") eg. |help-writing|.
515
516When referring to a Vim option in the help file, place the option name between
517two single quotes, eg. 'statusline'
518
519When referring to any other technical term or symbol, such as a filename or
520function parameter, surround it in backticks, eg. `~/.path/to/init.vim`. This
521renders it as "inline" code (as opposed to a "codeblock" |help-codeblock|).
522
523
524HIGHLIGHTING
525
526To define a column heading, use a tilde character at the end of the line,
527preceded by a space. This will highlight the column heading in a different
528color.  E.g.
529
530Column heading ~
531
532To separate sections in a help file, place a series of '=' characters in a
533line starting from the first column.  The section separator line is
534highlighted differently.
535
536							      *help-codeblock*
537To quote a block of ex-commands verbatim, place a greater than (>) character
538at the end of the line before the block and a less than (<) character as the
539first non-blank on a line following the block.  Any line starting in column 1
540also implicitly stops the block of ex-commands before it.  E.g. >
541	function Example_Func()
542	  echo "Example"
543	endfunction
544<
545To enable syntax highlighting for a block of code, place a language name
546annotation (e.g. "vim") after a greater than (>) character.  E.g. >vim
547	function Example_Func()
548	  echo "Example"
549	endfunction
550<
551						*help-notation*
552The following are highlighted differently in a Vim help file:
553  - a special key name expressed either in <> notation as in <PageDown>, or
554    as a Ctrl character as in CTRL-X
555  - anything between {braces}, e.g. {lhs} and {rhs}
556
557The word "Note", "Notes" and similar automagically receive distinctive
558highlighting.  So do these:
559	Todo	something to do
560	Error	something wrong
561
562You can find the details in $VIMRUNTIME/syntax/help.vim
563
564
565FILETYPE COMPLETION					*ft-help-omni*
566
567To get completion for help tags when writing a tag reference, you can use the
568|i_CTRL-X_CTRL-O| command.
569
570
571 vim:tw=78:ts=8:noet:ft=help:norl: