diff options
author | Felipe Morales <hel.sheep@gmail.com> | 2016-02-12 18:02:42 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-02-14 15:20:32 -0500 |
commit | 9c2c24ec484ececc1869dafa973566f685418757 (patch) | |
tree | 42468003a7933d32c589962ebd68748bce2f8f59 | |
parent | cae090416046bb64326eff06847d4c9bd5d3d5f2 (diff) | |
download | rneovim-9c2c24ec484ececc1869dafa973566f685418757.tar.gz rneovim-9c2c24ec484ececc1869dafa973566f685418757.tar.bz2 rneovim-9c2c24ec484ececc1869dafa973566f685418757.zip |
syntax: don't override user settings
-rw-r--r-- | src/nvim/ex_docmd.c | 10 | ||||
-rw-r--r-- | src/nvim/main.c | 8 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 0387bd1ad7..7655659107 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -9299,19 +9299,15 @@ 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. +/// Do ":filetype plugin indent on" if user did not already do some +/// permutation thereof. void force_enable_filetype(void) { - if (!filetype_detect) { + if (!filetype_detect && !filetype_plugin && !filetype_indent) { 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; } diff --git a/src/nvim/main.c b/src/nvim/main.c index b1f5a6ccad..6f5d40645a 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -332,12 +332,12 @@ 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 using the runtime (-u is not NONE), enable syntax & filetype plugins. if (params.use_vimrc != NULL && strcmp(params.use_vimrc, "NONE") != 0) { - // Do this before syntax/syntax.vim (which calls `:filetype on`). + // Do ":filetype plugin indent on". force_enable_filetype(); - // Enable syntax highlighting. - syn_cmd("syntax"); // sources syntax/syntax.vim + // Enable syntax (sources syntax/syntax.vim, which calls `:filetype on`). + syn_cmd("syntax"); } /* |