mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
doc/startup: cleanup; assign ENN to "conflicing configs" msg (#14971)
This commit is contained in:
@@ -172,42 +172,34 @@ Using Vim scripts *using-scripts*
|
|||||||
For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||||
|
|
||||||
*:so* *:source* *load-vim-script*
|
*: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.
|
Triggers the |SourcePre| autocommand.
|
||||||
|
|
||||||
Note: Only files ending with `.lua` is sourced as
|
|
||||||
lua file. Anything else is assumed to be vimscript.
|
|
||||||
*:source!*
|
*:source!*
|
||||||
:so[urce]! {file} Read Vim commands from {file}. These are commands
|
:so[urce]! {file} Runs |Normal-mode| commands read from {file}. When
|
||||||
that are executed from Normal mode, like you type
|
used after |:global|, |:argdo|, |:windo|, |:bufdo|, in
|
||||||
them.
|
a loop or when another command follows the display
|
||||||
When used after |:global|, |:argdo|, |:windo|,
|
won't be updated while executing the commands.
|
||||||
|: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|.
|
Cannot be used in the |sandbox|.
|
||||||
|
|
||||||
*:ru* *:runtime*
|
*:ru* *:runtime*
|
||||||
:ru[ntime][!] [where] {file} ..
|
:ru[ntime][!] [where] {file} ..
|
||||||
Source vim/lua {file} in each directory given by
|
Sources |Ex| commands or Lua code (".lua" files) read
|
||||||
'runtimepath' and/or 'packpath'. The vim files are
|
from {file} (a relative path) in each directory given
|
||||||
executed in same mannar as |:source| and lua files
|
by 'runtimepath' and/or 'packpath'.
|
||||||
similarly as |:luafile|. There is no error
|
Ignores non-existing files.
|
||||||
for non-existing files.
|
|
||||||
|
|
||||||
Example: >
|
Example: >
|
||||||
:runtime syntax/c.vim
|
:runtime syntax/c.vim
|
||||||
|
:runtime syntax/c.lua
|
||||||
|
|
||||||
< There can be multiple {file} arguments, separated by
|
< There can be multiple space-separated {file}
|
||||||
spaces. Each {file} is searched for in the first
|
arguments. Each {file} is searched for in the first
|
||||||
directory from 'runtimepath', then in the second
|
directory from 'runtimepath', then in the second
|
||||||
directory, etc. Use a backslash to include a space
|
directory, etc.
|
||||||
inside {file} (although it's better not to use spaces
|
|
||||||
in file names, it causes trouble).
|
|
||||||
|
|
||||||
When [!] is included, all found files are sourced.
|
When [!] is included, all found files are sourced.
|
||||||
When it is not included only the first found file is
|
Else only the first found file is sourced.
|
||||||
sourced.
|
|
||||||
|
|
||||||
When [where] is omitted only 'runtimepath' is used.
|
When [where] is omitted only 'runtimepath' is used.
|
||||||
Other values:
|
Other values:
|
||||||
|
@@ -407,20 +407,18 @@ accordingly. Vim proceeds in this order:
|
|||||||
proceeding to load user configuration.
|
proceeding to load user configuration.
|
||||||
|
|
||||||
4. Load user config (execute Ex commands from files, environment, …).
|
4. Load user config (execute Ex commands from files, environment, …).
|
||||||
An environment variable (e.g. $VIMINIT) is read as one Ex command
|
$VIMINIT environment variable is read as one Ex command line (separate
|
||||||
line, where multiple commands must be separated with '|' or <NL>.
|
multiple commands with '|' or <NL>).
|
||||||
*config* *init.vim* *init.lua* *vimrc* *exrc*
|
*config* *init.vim* *init.lua* *vimrc* *exrc*
|
||||||
A file that contains initialization commands is generically called
|
A file containing initialization commands is generically called
|
||||||
a "vimrc" or config file. It can be a Vimscript or Lua file named
|
a "vimrc" or config file. It can be either Vimscript ("init.vim") or
|
||||||
"init.vim" or "init.lua" respectively. It is an error to use both at
|
Lua ("init.lua"), but not both. *E5422*
|
||||||
the same time. Each line in a "init.vim" is executed as an Ex command
|
See also |vimrc-intro| and |base-directories|.
|
||||||
line. See also |vimrc-intro| and |base-directories|.
|
|
||||||
|
|
||||||
The config file is located at:
|
The config file is located at:
|
||||||
Unix ~/.config/nvim/init.vim (or init.lua)
|
Unix ~/.config/nvim/init.vim (or init.lua)
|
||||||
Windows ~/AppData/Local/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| $XDG_CONFIG_HOME/nvim/init.vim (or init.lua)
|
||||||
$XDG_CONFIG_HOME/nvim/init.vim (or init.lua)
|
|
||||||
|
|
||||||
If Nvim was started with "-u {file}" then {file} is used as the config
|
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.
|
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: >
|
This does the same as the command: >
|
||||||
:runtime! plugin/**/*.vim
|
:runtime! plugin/**/*.vim
|
||||||
:runtime! plugin/**/*.lua
|
:runtime! plugin/**/*.lua
|
||||||
< The result is that all directories in the 'runtimepath' option will be
|
< The result is that all directories in 'runtimepath' will be searched
|
||||||
searched for the "plugin" sub-directory and all files ending in ".vim"
|
for the "plugin" sub-directory and all files ending in ".vim" or
|
||||||
and ".lua" will be sourced (in alphabetical order per directory),
|
".lua" will be sourced (in alphabetical order per directory),
|
||||||
also in subdirectories. First all the "*.vim" files will be sourced and
|
also in subdirectories. First "*.vim" are sourced, then "*.lua" files.
|
||||||
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.
|
|
||||||
However, directories in 'runtimepath' ending in "after" are skipped
|
However, directories in 'runtimepath' ending in "after" are skipped
|
||||||
here and only loaded after packages, see below.
|
here and only loaded after packages, see below.
|
||||||
Loading plugins won't be done when:
|
Loading plugins won't be done when:
|
||||||
|
@@ -1816,7 +1816,8 @@ static bool do_user_initialization(void)
|
|||||||
char_u *vimrc_path = (char_u *)stdpaths_user_conf_subpath("init.vim");
|
char_u *vimrc_path = (char_u *)stdpaths_user_conf_subpath("init.vim");
|
||||||
|
|
||||||
if (os_path_exists(vimrc_path)) {
|
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);
|
xfree(vimrc_path);
|
||||||
|
@@ -487,7 +487,7 @@ describe('user config init', function()
|
|||||||
clear{ args_rm={'-u'}, env={ XDG_CONFIG_HOME=xconfig }}
|
clear{ args_rm={'-u'}, env={ XDG_CONFIG_HOME=xconfig }}
|
||||||
feed('<cr>') -- TODO check this, test execution is blocked without it
|
feed('<cr>') -- TODO check this, test execution is blocked without it
|
||||||
eq(1, eval('g:lua_rc'))
|
eq(1, eval('g:lua_rc'))
|
||||||
matches('Conflicting configs', meths.exec('messages', true))
|
matches('^E5422: Conflicting configs', meths.exec('messages', true))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user