summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist/ft.vim
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2021-11-26 13:01:41 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-26 13:01:41 +0000
commit7329cfab36356c48edab7ed68f6244eb9e20a5b1 (patch)
tree37ab0d73609d20da0d46922056272c1299473dda /runtime/autoload/dist/ft.vim
parent85be8563fe5aff686e9e30d6afff401ccd976f2a (diff)
patch 8.2.3679: objc file detected as Octavev8.2.3679
Problem: objc file detected as Octave. (Antony Lee) Solution: Detect objc by preprocessor lines. (Doug Kearns, closes #9223, closes #9220)
Diffstat (limited to 'runtime/autoload/dist/ft.vim')
-rw-r--r--runtime/autoload/dist/ft.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 7484149a26..344889249b 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -272,6 +272,8 @@ func dist#ft#FTm()
" excluding end(for|function|if|switch|while) common to Murphi
let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
+ let objc_preprocessor = '^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>'
+
let n = 1
let saw_comment = 0 " Whether we've seen a multiline comment leader.
while n < 100
@@ -282,7 +284,7 @@ func dist#ft#FTm()
" anything more definitive.
let saw_comment = 1
endif
- if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|//\)'
+ if line =~ '^\s*//' || line =~ '^\s*@import\>' || line =~ objc_preprocessor
setf objc
return
endif