Home Explore Blog CI



neovim

10th chunk of `runtime/doc/starting.txt`
bc0f1042674042223cb452eb7e2c55ba16df532008e20c9b0000000100000fa4
 removed from the end.

After doing this once, Nvim sets the $VIMRUNTIME environment variable.

In case you need the value of $VIMRUNTIME in a shell (e.g., for a script that
greps in the help files) you might be able to use this: >

	VIMRUNTIME="$(nvim --clean --headless --cmd 'echo $VIMRUNTIME|q')"

==============================================================================
Suspending						*suspend*

					*CTRL-Z* *v_CTRL-Z*
CTRL-Z			Suspend Nvim, like ":stop".
			Works in Normal and in Visual mode.  In Insert and
			Command-line mode, the CTRL-Z is inserted as a normal
			character.  In Visual mode Nvim goes back to Normal
			mode.

:sus[pend][!]	or			*:sus* *:suspend* *:st* *:stop*
:st[op][!]		Suspend Nvim using OS "job control"; it will continue
			if you make it the foreground job again.  Triggers
			|VimSuspend| before suspending and |VimResume| when
			resumed.
			If "!" is not given and 'autowrite' is set, every
			buffer with changes and a file name is written out.
			If "!" is given or 'autowrite' is not set, changed
			buffers are not written, don't forget to bring Nvim
			back to the foreground later!

In the GUI, suspending is implementation-defined.

==============================================================================
Exiting							*exiting*

There are several ways to exit Vim:
- Close the last window with `:quit`.  Only when there are no changes.
- Close the last window with `:quit!`.  Also when there are changes.
- Close all windows with `:qall`.  Only when there are no changes.
- Close all windows with `:qall!`.  Also when there are changes.
- Use `:cquit`.  Also when there are changes.

When using `:cquit` or when there was an error message Vim exits with exit
code 1.  Errors can be avoided by using `:silent!` or with `:catch`.

==============================================================================
Saving settings						*save-settings*

Mostly you will edit your vimrc files manually.  This gives you the greatest
flexibility.  There are a few commands to generate a vimrc file automatically.
You can use these files as they are, or copy/paste lines to include in another
vimrc file.

							*:mk* *:mkexrc*
:mk[exrc] [file]	Write current key mappings and changed options to
			[file] (default ".exrc" in the current directory),
			unless it already exists.

:mk[exrc]! [file]	Always write current key mappings and changed
			options to [file] (default ".exrc" in the current
			directory).

						*:mkv* *:mkvi* *:mkvimrc*
:mkv[imrc][!] [file]	Like ":mkexrc", but the default is ".nvimrc" in the
			current directory.  The ":version" command is also
			written to the file.

These commands will write ":map" and ":set" commands to a file, in such a way
that when these commands are executed, the current key mappings and options
will be set to the same values.  The options 'columns', 'endofline',
'fileformat', 'lines', 'modified', and 'scroll' are not included, because
these are terminal or file dependent.
Note that the options 'binary', 'paste' and 'readonly' are included, this
might not always be what you want.

When special keys are used in mappings, the 'cpoptions' option will be
temporarily set to its Vim default, to avoid the mappings to be
misinterpreted.  This makes the file incompatible with Vi, but makes sure it
can be used with different terminals.

Only global mappings are stored, not mappings local to a buffer.

A common method is to use a default |config| file, make some modifications
with ":map" and ":set" commands and write the modified file.  First read the
default vimrc in with a command like ":source ~piet/.vimrc.Cprogs", change
the settings and then save them in the current directory with ":mkvimrc!".  If
you want to make this file your default |config|, move it to
$XDG_CONFIG_HOME/nvim.  You could also use autocommands |autocommand| and/or
modelines |modeline|.

						*vimrc-option-example*
If you only want to add a single option setting to your vimrc, you can use
these steps:
1. Edit your

Title: Suspending, Exiting, and Saving Settings in Nvim
Summary
This section covers how to suspend Nvim using CTRL-Z or the ':suspend' command, including the implications of 'autowrite' setting. It explains various methods to exit Nvim, such as ':quit', ':qall', and ':cquit', highlighting the importance of saving changes. Finally, it discusses how to save your Nvim settings by creating vimrc files using commands like ':mkexrc' and ':mkvimrc', noting which options are included and excluded.