Home Explore Blog CI



neovim

5th chunk of `runtime/doc/starting.txt`
7de8b82e2102d9180126484e08871bab11549df67d5aaf990000000100000fae
 |diff-mode|.

							*-u* *E282*
-u {vimrc}	The file {vimrc} is read for initializations.  Most other
		initializations are skipped; see |initialization|.

		This can be used to start Vim in a special mode, with special
		mappings and settings.  A shell alias can be used to make
		this easy to use.  For example, in a C shell descendant: >
			alias vimc 'nvim -u ~/.config/nvim/c_init.vim \!*'
<		And in a Bash shell: >
			alias vimc='nvim -u ~/.config/nvim/c_init.vim'
<		Also consider using autocommands; see |autocommand|.

		When {vimrc} is "NONE" (all uppercase), all initializations
		from files and environment variables are skipped.  Plugins and
		syntax highlighting are also skipped.

		When {vimrc} is "NORC" (all uppercase), this has the same
		effect as "NONE", but plugins and syntax highlighting are not
		skipped.

							*-i*
-i {shada}	The file {shada} is used instead of the default ShaDa
		file.  If the name "NONE" is used (all uppercase), no ShaDa
		file is read or written, even if 'shada' is set or when
		":rsh" or ":wsh" are used.  See also |shada-file|.

							*-s*
-s {scriptin}	Read script file {scriptin}, interpreting characters as
		Normal-mode input.  The same can be done with ":source!": >
			:source! {scriptin}
<		Reads from stdin if {scriptin} is "-": >
			echo "ifoo" | nvim -s -
<		If the end of the file is reached before Nvim exits, further
		characters are read from the keyboard.

		Does not work with |-es|.  See also |complex-repeat|.

							*-w_nr*
-w {number}
-w{number}	Set the 'window' option to {number}.

							*-w*
-w {scriptout}	All keys that you type are recorded in the file "scriptout",
		until you exit Vim.  Useful to create a script file to be used
		with "vim -s" or ":source!".  Appends to the "scriptout" file
		if it already exists. {scriptout} cannot start with a digit.
		See also |vim.on_key()|.
		See also |complex-repeat|.

							*-W*
-W {scriptout}	Like -w, but do not append, overwrite an existing file.

							*--api-info*
--api-info	Print msgpack-encoded |api-metadata| and exit.

							*--embed*
--embed		Use stdin/stdout as a msgpack-RPC channel, so applications can
		embed and control Nvim via the RPC |API|. If the channel is
		closed (except by |:detach|), Nvim exits.

		Waits for the client ("embedder") to call |nvim_ui_attach()|
		before sourcing startup files and reading buffers, so that UIs
		can deterministically handle (display) early messages,
		dialogs, etc.  The client can do other requests before
		`nvim_ui_attach` (e.g. `nvim_get_api_info` for feature-detection).
		During this pre-startup phase the user config is of course not
		available (similar to `--cmd`).

		Non-UI embedders must pass |--headless|, then startup will
		continue without waiting for `nvim_ui_attach`: >
		    nvim --embed --headless
<		which is equivalent to: >
		    nvim --headless --cmd "call stdioopen({'rpc': v:true})"
<
		UI embedders that want the UI protocol on a socket (instead of
		stdio) must pass |--listen| as well as |--embed|: >
		    nvim --embed --listen addr

<		See also: |ui-startup| |channel-stdio|

							*--headless*
--headless	Start without UI, and do not wait for `nvim_ui_attach`. The
		builtin TUI is not used, so stdio works as an arbitrary
		communication channel. |channel-stdio|

		Also useful for scripting (tests) to see messages that would
		not be printed by |-es|.

		To detect if a UI is available, check if |nvim_list_uis()| is
		empty during or after |VimEnter|.

		To read stdin as text, "-" must be given explicitly:
		--headless cannot assume that stdin is just text. >
			echo foo | nvim --headless +"%print" +"q!" -
<
		See also |--embed|.
		See also |-es|, which also disables most messages.

--listen {addr}						*--listen*
		Start |RPC| server on pipe or TCP address {addr}. Sets the
		primary listen address |v:servername| to {addr}. |serverstart()|

		To start the server on-demand with systemd, use a systemd
		socket unit and associated service unit running: >
		systemd-socket-proxyd

Title: Nvim Startup Options: ShaDa Files, Scripting, Window Settings, API Info, Embedding, Headless Mode, and Listening
Summary
This section continues to elaborate on Nvim startup options. It describes using custom ShaDa files, reading input from script files, setting window options, retrieving API metadata, embedding Nvim for programmatic control, running in headless mode, and starting an RPC server to listen for connections.