summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist/ft.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-05 19:50:34 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-05 19:50:34 +0000
commite5b7897585eccec84431d8b23df5cde2e283828c (patch)
tree83d97fce5b5fb6f39342e0a3868a51072b6fae16 /runtime/autoload/dist/ft.vim
parent00eb99528edc9ee1d14241d6914168fc33331ded (diff)
patch 8.2.4305: tex filetype detection failsv8.2.4305
Problem: Tex filetype detection fails. Solution: Check value to be positive. (closes #9704)
Diffstat (limited to 'runtime/autoload/dist/ft.vim')
-rw-r--r--runtime/autoload/dist/ft.vim7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index d4e7be44b0..a8ca90080e 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -3,7 +3,7 @@ vim9script
# Vim functions for file type detection
#
# Maintainer: Bram Moolenaar <Bram@vim.org>
-# Last Change: 2022 Feb 04
+# Last Change: 2022 Feb 05
# These functions are moved here from runtime/filetype.vim to make startup
# faster.
@@ -722,7 +722,7 @@ export def FTperl(): number
endif
var save_cursor = getpos('.')
call cursor(1, 1)
- var has_use = search('^use\s\s*\k', 'c', 30)
+ var has_use = search('^use\s\s*\k', 'c', 30) > 0
call setpos('.', save_cursor)
if has_use
setf perl
@@ -755,7 +755,8 @@ export def FTtex()
var save_cursor = getpos('.')
call cursor(1, 1)
var firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
- if firstNC # Check the next thousand lines for a LaTeX or ConTeXt keyword.
+ if firstNC > 0
+ # Check the next thousand lines for a LaTeX or ConTeXt keyword.
var lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
var cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
var kwline = search('^\s*\\\%(' .. lpat .. '\)\|^\s*\\\(' .. cpat .. '\)',