mirror of
https://github.com/neovim/neovim.git
synced 2025-10-04 17:06:30 +00:00
defaults: Enable syntax and filetype plugins.
This commit is contained in:

committed by
Justin M. Keyes

parent
75f6817a51
commit
50e129f5a7
@@ -9299,6 +9299,24 @@ static void ex_filetype(exarg_T *eap)
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
}
|
||||
|
||||
/// Same as :filetype plugin indent enable
|
||||
/// Updates the state used for :filetype without args.
|
||||
void force_enable_filetype(void)
|
||||
{
|
||||
if (!filetype_detect) {
|
||||
source_runtime((char_u *)FILETYPE_FILE, true);
|
||||
filetype_detect = true;
|
||||
}
|
||||
if (!filetype_plugin) {
|
||||
source_runtime((char_u *)FTPLUGIN_FILE, true);
|
||||
filetype_plugin = true;
|
||||
}
|
||||
if (!filetype_indent) {
|
||||
source_runtime((char_u *)INDENT_FILE, true);
|
||||
filetype_indent = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ":setfiletype {name}"
|
||||
*/
|
||||
|
@@ -92,6 +92,10 @@
|
||||
# define SYNTAX_FNAME "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "%s.vim"
|
||||
#endif
|
||||
|
||||
#ifndef SYNTAX_FILE
|
||||
# define SYNTAX_FILE "$VIMRUNTIME" _PATHSEPSTR "syntax" _PATHSEPSTR "syntax.vim"
|
||||
#endif
|
||||
|
||||
#ifndef EXRC_FILE
|
||||
# define EXRC_FILE ".exrc"
|
||||
#endif
|
||||
|
@@ -332,6 +332,14 @@ int main(int argc, char **argv)
|
||||
/* Source startup scripts. */
|
||||
source_startup_scripts(¶ms);
|
||||
|
||||
// If using the runtime (-u is not NONE), enable syntax and filetype plugins
|
||||
if (params.use_vimrc != NULL && strcmp(params.use_vimrc, "NONE") != 0) {
|
||||
// Do this before syntax/syntax.vim (which calls `:filetype on`).
|
||||
force_enable_filetype();
|
||||
// Enable syntax highlighting.
|
||||
do_source((char_u *)SYNTAX_FILE, false, DOSO_NONE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read all the plugin files.
|
||||
* Only when compiled with +eval, since most plugins need it.
|
||||
|
Reference in New Issue
Block a user