neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

helphelp.txt (22445B)


      1 *helphelp.txt*	Nvim
      2 
      3 
      4 	  VIM REFERENCE MANUAL	  by Bram Moolenaar
      5 
      6 
      7 Help on help files					*helphelp*
      8 
      9                                      Type |gO| to see the table of contents.
     10 
     11 ==============================================================================
     12 Help tag conventions					*help-context*
     13 
     14 Get specific help:  It is possible to go directly to whatever you want help
     15 on, by giving an argument to the |:help| command. Prepend something to specify
     16 the 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 
     28 See |help-summary| for more contexts and an explanation.
     29 See |notation| for an explanation of the help syntax.
     30 
     31 SEARCH FOR HELP
     32 
     33 Type ":help word", then hit CTRL-D to see matching help entries for "word". Or
     34 use ":helpgrep word". |:helpgrep|
     35 
     36 ==============================================================================
     37 Notation						*notation*
     38 
     39 When syntax highlighting is used to read this, text that is not typed
     40 literally is often highlighted with the Special group.  These are items in [],
     41 {} and <>, and CTRL-X.
     42 
     43 Note that Vim uses all possible characters in commands.  Sometimes the [], {}
     44 and <> 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 ==============================================================================
    148 Help 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 					*{subject}* *E149* *E661*
    165 :h[elp] {subject}	Like ":help", additionally jump to the tag {subject}.
    166 		For example:  >
    167 			:help options
    168 
    169 <			{subject} can include wildcards such as "*", "?" and
    170 		"[a-z]":
    171 		   :help z?	jump to help for any "z" command
    172 		   :help z.	jump to the help for "z."
    173 		But when a tag exists it is taken literally:
    174 		   :help :?	jump to help for ":?"
    175 
    176 		If there is no full match for the pattern, or there
    177 		are several matches, the "best" match will be used.
    178 		A sophisticated algorithm is used to decide which
    179 		match is better than another one.  These items are
    180 		considered in the computation:
    181 		- A match with same case is much better than a match
    182 		  with different case.
    183 		- A match that starts after a non-alphanumeric
    184 		  character is better than a match in the middle of a
    185 		  word.
    186 		- A match at or near the beginning of the tag is
    187 		  better than a match further on.
    188 		- The more alphanumeric characters match, the better.
    189 		- The shorter the length of the match, the better.
    190 
    191 		The 'helplang' option is used to select a language, if
    192 		the {subject} is available in several languages.
    193 		To find a tag in a specific language, append "@ab",
    194 		where "ab" is the two-letter language code.  See
    195 		|help-translated|.
    196 
    197 		Note that the longer the {subject} you give, the less
    198 		matches will be found.  You can get an idea how this
    199 		all works by using commandline completion (type CTRL-D
    200 		after ":help subject" |c_CTRL-D|).
    201 		If there are several matches, you can have them listed
    202 		by hitting CTRL-D.  Example: >
    203 			:help cont<Ctrl-D>
    204 
    205 <			Instead of typing ":help CTRL-V" to search for help
    206 		for CTRL-V you can type: >
    207 			:help ^V
    208 <			This also works together with other characters, for
    209 		example to find help for CTRL-V in Insert mode: >
    210 			:help i^V
    211 <
    212 		It is also possible to first do ":help" and then
    213 		use ":tag {pattern}" in the help window.  The
    214 		":tnext" command can then be used to jump to other
    215 		matches, "tselect" to list matches and choose one. >
    216 			:help index
    217 			:tselect /.*mode
    218 
    219 <			When there is no argument you will see matches for
    220 		"help", to avoid listing all possible matches (that
    221 		would be very slow).
    222 		The number of matches displayed is limited to 300.
    223 
    224 		The `:help` command can be followed by '|' and another
    225 		command, but you don't need to escape the '|' inside a
    226 		help command.  So these both work: >
    227 			:help |
    228 			:help k| only
    229 <			Note that a space before the '|' is seen as part of
    230 		the ":help" argument.
    231 		You can also use <NL> or <CR> to separate the help
    232 		command from a following command.  You need to type
    233 		CTRL-V first to insert the <NL> or <CR>.  Example: >
    234 			:help so<C-V><CR>only
    235 <
    236 
    237 :h[elp]! [subject]	Like ":help", but in non-English help files prefer to
    238 		find a tag in a file with the same language as the
    239 		current file.  See |help-translated|.
    240 
    241 						*:helpc* *:helpclose*
    242 :helpc[lose]		Close one help window, if there is one.
    243 		Vim will try to restore the window layout (including
    244 		cursor position) to the same layout it was before
    245 		opening the help window initially.  This might cause
    246 		triggering several autocommands.
    247 
    248 						*:helpg* *:helpgrep*
    249 :helpg[rep] {pattern}[@xx]
    250 		Search all help text files and make a list of lines
    251 		in which {pattern} matches.  Jumps to the first match.
    252 		The optional [@xx] specifies that only matches in the
    253 		"xx" language are to be found.
    254 		You can navigate through the matches with the
    255 		|quickfix| commands, e.g., |:cnext| to jump to the
    256 		next one.  Or use |:cwindow| to get the list of
    257 		matches in the quickfix window.
    258 		{pattern} is used as a Vim regexp |pattern|.
    259 		'ignorecase' is not used, add "\c" to ignore case.
    260 		Example for case sensitive search: >
    261 			:helpgrep Uganda
    262 <			Example for case ignoring search: >
    263 			:helpgrep uganda\c
    264 <			Example for searching in French help: >
    265 			:helpgrep backspace@fr
    266 <			The pattern does not support line breaks, it must
    267 		match within one line.  You can use |:grep| instead,
    268 		but then you need to get the list of help files in a
    269 		complicated way.
    270 		Cannot be followed by another command, everything is
    271 		used as part of the pattern.  But you can use
    272 		|:execute| when needed.
    273 		Compressed help files will not be searched (Fedora
    274 		compresses the help files).
    275 
    276 						*:lh* *:lhelpgrep*
    277 :lh[elpgrep] {pattern}[@xx]
    278 		Same as ":helpgrep", except the location list is used
    279 		instead of the quickfix list.  If the help window is
    280 		already opened, then the location list for that window
    281 		is used.  Otherwise, a new help window is opened and
    282 		the location list for that window is set.  The
    283 		location list for the current window is not changed
    284 		then.
    285 
    286 						*:exu* *:exusage*
    287 :exu[sage]		Show help on Ex commands.  Added to simulate the Nvi
    288 		command.
    289 
    290 						*:viu* *:viusage*
    291 :viu[sage]		Show help on Normal mode commands.  Added to simulate
    292 		the Nvi command.
    293 
    294 When no argument is given to |:help| the file given with the 'helpfile' option
    295 will be opened.  Otherwise the specified tag is searched for in all "doc/tags"
    296 files in the directories specified in the 'runtimepath' option.
    297 
    298 If you would like to open the help in the current window, see this tip:
    299 |help-curwin|.
    300 
    301 The initial height of the help window can be set with the 'helpheight' option
    302 (default 20).
    303 					*help-buffer-options*
    304 When the help buffer is created, several local options are set to make sure
    305 the help text is displayed as it was intended:
    306    'iskeyword'		nearly all ASCII chars except ' ', "*", '"' and '|'
    307    'foldmethod'	"manual"
    308    'tabstop'		8
    309    'arabic'		off
    310    'binary'		off
    311    'buflisted'		off
    312    'cursorbind'	off
    313    'diff'		off
    314    'foldenable'	off
    315    'list'		off
    316    'modifiable'	off
    317    'number'		off
    318    'relativenumber'	off
    319    'rightleft'		off
    320    'scrollbind'	off
    321    'spell'		off
    322 
    323 Jump to specific subjects by using tags.  This can be done in two ways:
    324 - Use the "CTRL-]" command while standing on the name of a command or option.
    325  This only works when the tag is a keyword.  "<C-Leftmouse>" and
    326  "g<LeftMouse>" work just like "CTRL-]".
    327 - use the ":ta {subject}" command.  This also works with non-keyword
    328  characters.
    329 
    330 Use CTRL-T or CTRL-O to jump back.
    331 Use ":q" to close the help window.
    332 Use `g==` to execute the current Lua/Vimscript code block.
    333 
    334 If there are several matches for an item you are looking for, this is how you
    335 can jump to each one of them:
    336 1. Open a help window
    337 2. Use the ":tag" command with a slash prepended to the tag.  E.g.: >
    338 :tag /min
    339 3. Use ":tnext" to jump to the next matching tag.
    340 
    341 It is possible to add help files for plugins and other items.  You don't need
    342 to change the distributed help files for that.  See |add-local-help|.
    343 
    344 To write a local help file, see |write-local-help|.
    345 
    346 Note that the title lines from the local help files are automagically added to
    347 the "LOCAL ADDITIONS" section in the "help.txt" help file |local-additions|.
    348 This is done when viewing the file in Vim, the file itself is not changed.  It
    349 is done by going through all help files and obtaining the first line of each
    350 file.  The files in $VIMRUNTIME/doc are skipped.
    351 
    352 				*:helpt* *:helptags*
    353 		*E150* *E151* *E152* *E153* *E154* *E670* *E856*
    354 :helpt[ags] [++t] {dir}
    355 		Generate the help tags file(s) for directory {dir}.
    356 		When {dir} is ALL then all "doc" directories in
    357 		'runtimepath' will be used.
    358 
    359 		All "*.txt" and "*.??x" files in the directory and
    360 		sub-directories are scanned for a help tag definition
    361 		in between stars.  The "*.??x" files are for
    362 		translated docs, they generate the "tags-??" file, see
    363 		|help-translated|.  The generated tags files are
    364 		sorted.
    365 		When there are duplicates an error message is given.
    366 		An existing tags file is silently overwritten.
    367 
    368 		The optional "++t" argument forces adding the
    369 		"help-tags" tag.  This is also done when the {dir} is
    370 		equal to $VIMRUNTIME/doc.
    371 
    372 		To rebuild the help tags in the runtime directory
    373 		(requires write permission there): >
    374 			:helptags $VIMRUNTIME/doc
    375 <
    376 
    377 
    378 ==============================================================================
    379 Translated help files					*help-translated*
    380 
    381 It is possible to add translated help files, next to the original English help
    382 files.  Vim will search for all help in "doc" directories in 'runtimepath'.
    383 
    384 At this moment translations are available for:
    385 Chinese  - multiple authors
    386 French   - translated by David Blanchet
    387 Italian  - translated by Antonio Colombo
    388 Japanese - multiple authors
    389 Polish   - translated by Mikolaj Machowski
    390 Russian  - translated by Vassily Ragosin
    391 See the Vim website to find them: https://www.vim.org/translations.php
    392 
    393 A set of translated help files consists of these files:
    394 
    395 help.abx
    396 howto.abx
    397 ...
    398 tags-ab
    399 
    400 "ab" is the two-letter language code.  Thus for Italian the names are:
    401 
    402 help.itx
    403 howto.itx
    404 ...
    405 tags-it
    406 
    407 The 'helplang' option can be set to the preferred language(s).  The default is
    408 set according to the environment.  Vim will first try to find a matching tag
    409 in the preferred language(s).  English is used when it cannot be found.
    410 
    411 To find a tag in a specific language, append "@ab" to a tag, where "ab" is the
    412 two-letter language code.  Example: >
    413 :he user-manual@it
    414 :he user-manual@en
    415 The first one finds the Italian user manual, even when 'helplang' is empty.
    416 The second one finds the English user manual, even when 'helplang' is set to
    417 "it".
    418 
    419 When using command-line completion for the ":help" command, the "@en"
    420 extension is only shown when a tag exists for multiple languages.  When the
    421 tag only exists for English "@en" is omitted.  When the first candidate has an
    422 "@ab" extension and it matches the first language in 'helplang' "@ab" is also
    423 omitted.
    424 
    425 When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
    426 find the tag in the same language.  If not found then 'helplang' will be used
    427 to select a language.
    428 
    429 Help files must use latin1 or utf-8 encoding.  Vim assumes the encoding is
    430 utf-8 when finding non-ASCII characters in the first line.  Thus you must
    431 translate the header with "For Vim version".
    432 
    433 The same encoding must be used for the help files of one language in one
    434 directory.  You can use a different encoding for different languages and use
    435 a different encoding for help files of the same language but in a different
    436 directory.
    437 
    438 Hints for translators:
    439 - Do not translate the tags.  This makes it possible to use 'helplang' to
    440  specify the preferred language.  You may add new tags in your language.
    441 - When you do not translate a part of a file, add tags to the English version,
    442  using the "tag@en" notation.
    443 - Make a package with all the files and the tags file available for download.
    444  Users can drop it in one of the "doc" directories and start use it.
    445  Report to the development team, so they can add a link on www.vim.org.
    446 - Use the |:helptags| command to generate the tags files.  It will find all
    447  languages in the specified directory.
    448 
    449 ==============================================================================
    450 Writing help files					*help-writing*
    451 
    452 For ease of use, a Vim help file for a plugin should follow the format of the
    453 standard Vim help files, except for the first line.  If you are writing a new
    454 help file it's best to copy one of the existing files and use it as a
    455 template.
    456 
    457 The first line in a help file should have the following format: >
    458 
    459 *plugin_name.txt*	{short description of the plugin}
    460 
    461 The first field is a help tag where ":help plugin_name" will jump to.  The
    462 remainder of the line, after a Tab, describes the plugin purpose in a short
    463 way.  This will show up in the "LOCAL ADDITIONS" section of the main help
    464 file.  Check there that it shows up properly: |local-additions|.
    465 
    466 If you want to add a version number or last modification date, put it in the
    467 second line, right aligned.
    468 
    469 At the bottom of the help file, place a Vim modeline to set the 'textwidth'
    470 and 'tabstop' options and the 'filetype' to "help".  Never set a global option
    471 in such a modeline, that can have undesired consequences.
    472 
    473 
    474 TAGS
    475 
    476 To define a help tag, place the name between asterisks ("*tag-name*").  The
    477 tag-name should be different from all the Vim help tag names and ideally
    478 should begin with the name of the Vim plugin.  The tag name is usually right
    479 aligned on a line.
    480 
    481 When referring to an existing help tag and to create a hot-link, place the
    482 name between two bars ("|") eg. |help-writing|.
    483 
    484 When referring to a Vim option in the help file, place the option name between
    485 two single quotes, eg. 'statusline'
    486 
    487 When referring to any other technical term or symbol, such as a filename or
    488 function parameter, surround it in backticks, eg. `~/.path/to/init.vim`. This
    489 renders it as "inline" code (as opposed to a "codeblock" |help-codeblock|).
    490 
    491 
    492 HIGHLIGHTING
    493 
    494 To define a column heading, use a tilde character at the end of the line,
    495 preceded by a space. This will highlight the column heading in a different
    496 color.  E.g.
    497 
    498 Column heading ~
    499 
    500 To separate sections in a help file, place a series of '=' characters in a
    501 line starting from the first column.  The section separator line is
    502 highlighted differently.
    503 
    504 						      *help-codeblock*
    505 To quote a block of ex-commands verbatim, place a greater than (>) character
    506 at the end of the line before the block and a less than (<) character as the
    507 first non-blank on a line following the block.  Any line starting in column 1
    508 also implicitly stops the block of ex-commands before it.  E.g. >
    509 function Example_Func()
    510   echo "Example"
    511 endfunction
    512 <
    513 To enable syntax highlighting for a block of code, place a language name
    514 annotation (e.g. "vim") after a greater than (>) character.  E.g. >vim
    515 function Example_Func()
    516   echo "Example"
    517 endfunction
    518 <
    519 					*help-notation*
    520 The following are highlighted differently in a Vim help file:
    521  - a special key name expressed either in <> notation as in <PageDown>, or
    522    as a Ctrl character as in CTRL-X
    523  - anything between {braces}, e.g. {lhs} and {rhs}
    524 
    525 The word "Note", "Notes" and similar automagically receive distinctive
    526 highlighting.  So do these:
    527 Todo	something to do
    528 Error	something wrong
    529 
    530 You can find the details in $VIMRUNTIME/syntax/help.vim
    531 
    532 
    533 FILETYPE COMPLETION					*ft-help-omni*
    534 
    535 To get completion for help tags when writing a tag reference, you can use the
    536 |i_CTRL-X_CTRL-O| command.
    537 
    538 
    539 vim:tw=78:ts=8:noet:ft=help:norl: