Home Explore Blog CI



neovim

7th chunk of `runtime/doc/starting.txt`
7e10e72a27814d67b77fe05e5914613a3d5f77073ad0cf800000000100000fa9
 not set.
	"nvim -u NORC" can be used to skip these initializations without
	reading a file.  "nvim -u NONE" also skips plugins and syntax
	highlighting.  |-u|

	If Nvim was started with |-es| or |-Es| or |-l| all initializations until 8.
	are skipped.
						*system-vimrc* *sysinit.vim*
     a. The system vimrc file is read for initializations.  If
	nvim/sysinit.vim file exists in one of $XDG_CONFIG_DIRS, it will be
	used.  Otherwise the system vimrc file is used. The path of this file
	is given by the |:version| command.  Usually it's "$VIM/sysinit.vim".

						*VIMINIT* *EXINIT* *$MYVIMRC*
     b. Locations searched for initializations, in order of preference:
	-  $VIMINIT environment variable (Ex command line).
	-  User |config|: $XDG_CONFIG_HOME/nvim/init.vim (or init.lua).
	-  Other config: {dir}/nvim/init.vim (or init.lua) where {dir} is any
	   directory in $XDG_CONFIG_DIRS.
	-  $EXINIT environment variable (Ex command line).
	|$MYVIMRC| is set to the first valid location unless it was already
	set or when using $VIMINIT.

     c. If the 'exrc' option is on (which is NOT the default), the current
	directory is searched for the following files, in order of precedence:
	- ".nvim.lua"
	- ".nvimrc"
	- ".exrc"
	The first that exists is used, the others are ignored.

8. Enable filetype detection.
	This does the same as the command: >
		:runtime! filetype.lua
<	Skipped if ":filetype off" was called or if the "-u NONE" command line
	argument was given.

9. Enable syntax highlighting.
	This does the same as the command: >
		:runtime! syntax/syntax.vim
<	Skipped if ":syntax off" was called or if the "-u NONE" command
	line argument was given.

10. Load the plugin scripts.					*load-plugins*
	This does the same as the command: >
		:runtime! plugin/**/*.{vim,lua}
<	The result is that all directories in 'runtimepath' will be searched
	for the "plugin" sub-directory and all files ending in ".vim" or
	".lua" will be sourced (in alphabetical order per directory),
	also in subdirectories. First "*.vim" are sourced, then "*.lua" files,
	per directory.

	However, directories in 'runtimepath' ending in "after" are skipped
	here and only loaded after packages, see below.
	Loading plugins won't be done when:
	- The |'loadplugins'| option was reset in a vimrc file.
	- The |--noplugin| command line argument is used.
	- The |--clean| command line argument is used.
	- The "-u NONE" command line argument is used |-u|.
	Note that using `-c 'set noloadplugins'` doesn't work, because the
	commands from the command line have not been executed yet.  You can
	use `--cmd 'set noloadplugins'` or `--cmd 'set loadplugins'` |--cmd|.

	Packages are loaded.  These are plugins, as above, but found in the
	"start" directory of each entry in 'packpath'.  Every plugin directory
	found is added in 'runtimepath' and then the plugins are sourced.  See
	|packages|.

	The plugins scripts are loaded, as above, but now only the directories
	ending in "after" are used.  Note that 'runtimepath' will have changed
	if packages have been found, but that should not add a directory
	ending in "after".

11. Set 'shellpipe' and 'shellredir'
	The 'shellpipe' and 'shellredir' options are set according to the
	value of the 'shell' option, unless they have been set before.
	This means that Nvim will figure out the values of 'shellpipe' and
	'shellredir' for you, unless you have set them yourself.

12. Set 'updatecount' to zero, if "-n" command argument used.

13. Set binary options if the |-b| flag was given.

14. Read the |shada-file|.

15. Read the quickfix file if the |-q| flag was given, or exit on failure.

16. Open all windows
	When the |-o| flag was given, windows will be opened (but not
	displayed yet).
	When the |-p| flag was given, tab pages will be created (but not
	displayed yet).
	When switching screens, it happens now.  Redrawing starts.
	If the |-q| flag was given, the first error is jumped to.
	Buffers for all windows will be loaded, without triggering |BufAdd|
	autocommands.

Title: Nvim Initialization: System Vimrc, Filetype Detection, Syntax Highlighting, and Plugin Loading
Summary
This section continues detailing the Nvim initialization process, focusing on the loading of system vimrc files, enabling filetype detection and syntax highlighting, and loading plugin scripts from the 'runtimepath'. It describes how Nvim searches for initialization files and the order of preference for loading configurations. It also covers how plugins are loaded, including the handling of 'packpath' and 'after' directories. Finally, it describes loading shada-file, quickfix file, and the effect of several flags: -o, -p, -q, -n, -b.