diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2021-09-10 07:05:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 07:05:11 -0700 |
commit | 7b822d4b4b71ef0e9ed6a39ef50a5a2cbf8660c5 (patch) | |
tree | 1e58317059af6850e9f06289f33fbb3f61d8cf63 /runtime/autoload | |
parent | c7ccb26260e763cd5fde5f635da6889c736262fd (diff) | |
parent | 329047b3dbd09f7d77cdc07002c532c230e44ddb (diff) | |
download | rneovim-7b822d4b4b71ef0e9ed6a39ef50a5a2cbf8660c5.tar.gz rneovim-7b822d4b4b71ef0e9ed6a39ef50a5a2cbf8660c5.tar.bz2 rneovim-7b822d4b4b71ef0e9ed6a39ef50a5a2cbf8660c5.zip |
Merge branch 'master' into histfile
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/dist/ft.vim | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index ac80659113..48a9657cf5 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -264,6 +264,13 @@ func dist#ft#ProtoCheck(default) endfunc func dist#ft#FTm() + if exists("g:filetype_m") + exe "setf " . g:filetype_m + return + endif + + let octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|for\|function\|if\|methods\|parfor\|properties\|switch\|while\)\>' + let n = 1 let saw_comment = 0 " Whether we've seen a multiline comment leader. while n < 100 @@ -278,6 +285,13 @@ func dist#ft#FTm() setf objc return endif + if line =~ '^\s*\%(#\|%!\|[#%]{\=\s*$\)' || + \ line =~ '^\s*unwind_protect\>' || + \ line =~ '\%(^\|;\)\s*' .. octave_block_terminators + setf octave + return + endif + " TODO: could be Matlab or Octave if line =~ '^\s*%' setf matlab return @@ -298,11 +312,8 @@ func dist#ft#FTm() " or Murphi based on the comment leader. Assume the former as it is more " common. setf objc - elseif exists("g:filetype_m") - " Use user specified default filetype for .m - exe "setf " . g:filetype_m else - " Default is matlab + " Default is Matlab setf matlab endif endfunc |