doc/startup: cleanup; assign ENN to "conflicing configs" msg (#14971)

This commit is contained in:
Justin M. Keyes
2021-07-03 06:31:00 -07:00
committed by GitHub
parent 7918072f99
commit 05330ba508
4 changed files with 32 additions and 44 deletions

View File

@@ -172,42 +172,34 @@ Using Vim scripts *using-scripts*
For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
*:so* *:source* *load-vim-script*
:so[urce] {file} Runs vim or lua {file}
:so[urce] {file} Runs |Ex| commands or Lua code (".lua" files) read
from {file}.
Triggers the |SourcePre| autocommand.
Note: Only files ending with `.lua` is sourced as
lua file. Anything else is assumed to be vimscript.
*:source!*
:so[urce]! {file} Read Vim commands from {file}. These are commands
that are executed from Normal mode, like you type
them.
When used after |:global|, |:argdo|, |:windo|,
|:bufdo|, in a loop or when another command follows
the display won't be updated while executing the
commands.
:so[urce]! {file} Runs |Normal-mode| commands read from {file}. When
used after |:global|, |:argdo|, |:windo|, |:bufdo|, in
a loop or when another command follows the display
won't be updated while executing the commands.
Cannot be used in the |sandbox|.
*:ru* *:runtime*
:ru[ntime][!] [where] {file} ..
Source vim/lua {file} in each directory given by
'runtimepath' and/or 'packpath'. The vim files are
executed in same mannar as |:source| and lua files
similarly as |:luafile|. There is no error
for non-existing files.
Sources |Ex| commands or Lua code (".lua" files) read
from {file} (a relative path) in each directory given
by 'runtimepath' and/or 'packpath'.
Ignores non-existing files.
Example: >
:runtime syntax/c.vim
:runtime syntax/c.lua
< There can be multiple {file} arguments, separated by
spaces. Each {file} is searched for in the first
< There can be multiple space-separated {file}
arguments. Each {file} is searched for in the first
directory from 'runtimepath', then in the second
directory, etc. Use a backslash to include a space
inside {file} (although it's better not to use spaces
in file names, it causes trouble).
directory, etc.
When [!] is included, all found files are sourced.
When it is not included only the first found file is
sourced.
Else only the first found file is sourced.
When [where] is omitted only 'runtimepath' is used.
Other values:

View File

@@ -407,20 +407,18 @@ accordingly. Vim proceeds in this order:
proceeding to load user configuration.
4. Load user config (execute Ex commands from files, environment, …).
An environment variable (e.g. $VIMINIT) is read as one Ex command
line, where multiple commands must be separated with '|' or <NL>.
$VIMINIT environment variable is read as one Ex command line (separate
multiple commands with '|' or <NL>).
*config* *init.vim* *init.lua* *vimrc* *exrc*
A file that contains initialization commands is generically called
a "vimrc" or config file. It can be a Vimscript or Lua file named
"init.vim" or "init.lua" respectively. It is an error to use both at
the same time. Each line in a "init.vim" is executed as an Ex command
line. See also |vimrc-intro| and |base-directories|.
A file containing initialization commands is generically called
a "vimrc" or config file. It can be either Vimscript ("init.vim") or
Lua ("init.lua"), but not both. *E5422*
See also |vimrc-intro| and |base-directories|.
The config file is located at:
Unix ~/.config/nvim/init.vim (or init.lua)
Windows ~/AppData/Local/nvim/init.vim (or init.lua)
or if |$XDG_CONFIG_HOME| is defined:
$XDG_CONFIG_HOME/nvim/init.vim (or init.lua)
|$XDG_CONFIG_HOME| $XDG_CONFIG_HOME/nvim/init.vim (or init.lua)
If Nvim was started with "-u {file}" then {file} is used as the config
and all initializations until 5. are skipped. $MYVIMRC is not set.
@@ -470,14 +468,11 @@ accordingly. Vim proceeds in this order:
This does the same as the command: >
:runtime! plugin/**/*.vim
:runtime! plugin/**/*.lua
< The result is that all directories in the 'runtimepath' option will be
searched for the "plugin" sub-directory and all files ending in ".vim"
and ".lua" will be sourced (in alphabetical order per directory),
also in subdirectories. First all the "*.vim" files will be sourced and
then all the "*.lua" files will be sourced. If two files with same
name but different extensions exists they will be treated in same
manner. For example when both "foo.vim" and "foo.lua" exists then
first "foo.vim" will be sourced then "foo.lua" will be sourced.
< 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.
However, directories in 'runtimepath' ending in "after" are skipped
here and only loaded after packages, see below.
Loading plugins won't be done when:

View File

@@ -1816,7 +1816,8 @@ static bool do_user_initialization(void)
char_u *vimrc_path = (char_u *)stdpaths_user_conf_subpath("init.vim");
if (os_path_exists(vimrc_path)) {
EMSG3(_("Conflicting configs: \"%s\" \"%s\""), init_lua_path, vimrc_path);
EMSG3(_("E5422: Conflicting configs: \"%s\" \"%s\""), init_lua_path,
vimrc_path);
}
xfree(vimrc_path);

View File

@@ -487,7 +487,7 @@ describe('user config init', function()
clear{ args_rm={'-u'}, env={ XDG_CONFIG_HOME=xconfig }}
feed('<cr>') -- TODO check this, test execution is blocked without it
eq(1, eval('g:lua_rc'))
matches('Conflicting configs', meths.exec('messages', true))
matches('^E5422: Conflicting configs', meths.exec('messages', true))
end)
end)
end)