summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorFederico Mengozzi <19249682+fedemengo@users.noreply.github.com>2023-04-17 22:31:38 +0100
committerBram Moolenaar <Bram@vim.org>2023-04-17 22:31:38 +0100
commit6e5a9f948221b52caaaf106079cb3430c4dd7c77 (patch)
treee22fbc7d41e12e87de97afdaff9dc24f34f04ad5 /runtime
parent4c42c7eef43ff0f58fa574f7a900c8a3313f372e (diff)
downloadvim-git-6e5a9f948221b52caaaf106079cb3430c4dd7c77.tar.gz
patch 9.0.1464: strace filetype detection is expensivev9.0.1464
Problem: Strace filetype detection is expensive. Solution: Match with a cheap pattern first. (Federico Mengozzi, closes #12220)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/dist/script.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim
index f86c42898..e95c633fc 100644
--- a/runtime/autoload/dist/script.vim
+++ b/runtime/autoload/dist/script.vim
@@ -338,7 +338,9 @@ def DetectFromText(line1: string)
set ft=virata
# Strace
- elseif line1 =~ '[0-9:.]* *execve(' || line1 =~ '^__libc_start_main'
+ # inaccurate fast match first, then use accurate slow match
+ elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(')
+ || line1 =~ '^__libc_start_main'
set ft=strace
# VSE JCL