summaryrefslogtreecommitdiffstats
path: root/autoload/polyglot
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-09-09 12:05:33 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2021-09-09 12:05:33 +0200
commit7f98e949d4922ba2109304bd4cabe9578a8062fb (patch)
treee1b08f862397c14ab799e8f277c6fc39ec48b3b6 /autoload/polyglot
parentce31cd1d2f4e8eee9fd91325e4599f15cb9566fd (diff)
downloadvim-polyglot-7f98e949d4922ba2109304bd4cabe9578a8062fb.tar.gz
vim-polyglot-7f98e949d4922ba2109304bd4cabe9578a8062fb.zip
Update
Diffstat (limited to 'autoload/polyglot')
-rw-r--r--autoload/polyglot/ft.vim19
-rw-r--r--autoload/polyglot/init.vim2
-rw-r--r--autoload/polyglot/sleuth.vim2
3 files changed, 17 insertions, 6 deletions
diff --git a/autoload/polyglot/ft.vim b/autoload/polyglot/ft.vim
index 2e4c1f69..e4c32415 100644
--- a/autoload/polyglot/ft.vim
+++ b/autoload/polyglot/ft.vim
@@ -264,6 +264,13 @@ func polyglot#ft#ProtoCheck(default)
endfunc
func polyglot#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 polyglot#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 polyglot#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
diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim
index 04353964..d739ae7b 100644
--- a/autoload/polyglot/init.vim
+++ b/autoload/polyglot/init.vim
@@ -2265,7 +2265,7 @@ if !has_key(g:polyglot_is_disabled, 'jsonnet')
endif
if !has_key(g:polyglot_is_disabled, 'json')
- au BufNewFile,BufRead *.JSON-tmLanguage,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.json,*.jsonl,*.jsonp,*.mcmeta,*.template,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,{.,}arcconfig,{.,}htmlhintrc,{.,}imgbotconfig,{.,}tern-config,{.,}tern-project,{.,}watchmanconfig,Pipfile.lock,composer.lock,mcmod.info setf json
+ au BufNewFile,BufRead *.JSON-tmLanguage,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.json,*.jsonl,*.jsonp,*.mcmeta,*.template,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,{.,}arcconfig,{.,}auto-changelog,{.,}c8rc,{.,}htmlhintrc,{.,}imgbotconfig,{.,}nycrc,{.,}tern-config,{.,}tern-project,{.,}watchmanconfig,Pipfile.lock,composer.lock,mcmod.info setf json
endif
if !has_key(g:polyglot_is_disabled, 'json5')
diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim
index bf3166a4..a7a5b86a 100644
--- a/autoload/polyglot/sleuth.vim
+++ b/autoload/polyglot/sleuth.vim
@@ -264,7 +264,7 @@ let s:globs = {
\ 'jovial': '*.jov,*.j73,*.jovial',
\ 'jproperties': '*.properties,*.properties_??,*.properties_??_??,*.properties_??_??_*',
\ 'jq': '*.jq,.jqrc,.jqrc*',
- \ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.htmlhintrc,.imgbotconfig,.tern-config,.tern-project,.watchmanconfig,Pipfile.lock,composer.lock,mcmod.info',
+ \ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.auto-changelog,.c8rc,.htmlhintrc,.imgbotconfig,.nycrc,.tern-config,.tern-project,.watchmanconfig,Pipfile.lock,composer.lock,mcmod.info',
\ 'json5': '*.json5',
\ 'jsonc': '*.cjson,*.jsonc,coc-settings.json,.eslintrc.json,.babelrc,.jshintrc,.jslintrc,.mocharc.json,coffeelint.json,tsconfig.json,jsconfig.json',
\ 'jsonnet': '*.jsonnet,*.libsonnet',