aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-02-03 11:58:44 +0100
committerJustin M. Keyes <justinkz@gmail.com>2018-02-11 19:03:26 +0100
commit16a416836464d64f3054aeb727c773ebe5ac7124 (patch)
treed7e864311f02ed253e46a796bca4cb45036866b2 /src/nvim/ex_docmd.c
parenta1ee06a0993ef8959cdcec61759b17aa68ee28bd (diff)
downloadrneovim-16a416836464d64f3054aeb727c773ebe5ac7124.tar.gz
rneovim-16a416836464d64f3054aeb727c773ebe5ac7124.tar.bz2
rneovim-16a416836464d64f3054aeb727c773ebe5ac7124.zip
vim-patch:8.0.0613: the conf filetype is used before ftdetect from packages
Problem: The conf filetype detection is done before ftdetect scripts from packages that are added later. Solution: Add the FALLBACK argument to :setfiletype. (closes vim/vim#1679, closes vim/vim#1693) https://github.com/vim/vim/commit/3e54569b17683318e0cb6693ab0024c2ad1e3e8f
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index bd46c65c15..aebc395f56 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -9743,13 +9743,20 @@ void filetype_maybe_enable(void)
}
}
-/*
- * ":setfiletype {name}"
- */
+/// ":setfiletype [FALLBACK] {name}"
static void ex_setfiletype(exarg_T *eap)
{
if (!did_filetype) {
- set_option_value("filetype", 0L, (char *)eap->arg, OPT_LOCAL);
+ char_u *arg = eap->arg;
+
+ if (STRNCMP(arg, "FALLBACK ", 9) == 0) {
+ arg += 9;
+ }
+
+ set_option_value("filetype", 0L, (char *)arg, OPT_LOCAL);
+ if (arg != eap->arg) {
+ did_filetype = false;
+ }
}
}