From 501be5fdfebd912e94d0d62297d2ce023be43377 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Mon, 6 Sep 2021 18:58:58 +0200 Subject: [PATCH] Use configured indent values if `detectindent` can't detect them --- data/plugins/detectindent.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/data/plugins/detectindent.lua b/data/plugins/detectindent.lua index e2bcaed2..d75f05f2 100644 --- a/data/plugins/detectindent.lua +++ b/data/plugins/detectindent.lua @@ -102,6 +102,11 @@ end local function update_cache(doc) local type, size, score = detect_indent_stat(doc) local score_threshold = 4 + if score < score_threshold then + -- use default values + type = config.tab_type + size = config.indent_size + end cache[doc] = { type = type, size = size, confirmed = (score >= score_threshold) } doc.indent_info = cache[doc] end