diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-06 23:37:24 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-06 23:37:24 +0200 |
commit | 46040f3ffd35c4a981ca1f3713934f55b58bb525 (patch) | |
tree | a562dbf2edce5657e648f6c6a69856ea30985d27 /autoload | |
parent | 48254ec7adc9cbbc2ff15c606faf062d23d7f200 (diff) | |
download | vim-polyglot-46040f3ffd35c4a981ca1f3713934f55b58bb525.tar.gz vim-polyglot-46040f3ffd35c4a981ca1f3713934f55b58bb525.zip |
Add heuristics for .h extension
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/polyglot.vim | 19 | ||||
-rw-r--r-- | autoload/sleuth.vim | 10 |
2 files changed, 24 insertions, 5 deletions
diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim index ffb3c43f..1ed71826 100644 --- a/autoload/polyglot.vim +++ b/autoload/polyglot.vim @@ -154,6 +154,25 @@ func! polyglot#DetectAspFiletype() setf aspvbs | return endfunc +func! polyglot#DetectHFiletype() + for lnum in range(1, min([line("$"), 200])) + let line = getline(lnum) + if line =~# '^\s*\(@\(interface\|class\|protocol\|property\|end\|synchronised\|selector\|implementation\)\(\<\|\>\)\|#import\s\+.\+\.h[">]\)' + if exists("g:c_syntax_for_h") + setf objc | return + endif + setf objcpp | return + endif + endfor + if exists("g:c_syntax_for_h") + setf c | return + endif + if exists("g:ch_syntax_for_h") + setf ch | return + endif + setf cpp | return +endfunc + func! polyglot#DetectMFiletype() let saw_comment = 0 for lnum in range(1, min([line("$"), 100])) diff --git a/autoload/sleuth.vim b/autoload/sleuth.vim index 0460a46e..2eb95a63 100644 --- a/autoload/sleuth.vim +++ b/autoload/sleuth.vim @@ -10,7 +10,7 @@ let s:globs = { \ 'abc': '*.abc', \ 'abel': '*.abl', \ 'acedb': '*.wrm', - \ 'ada': '*.adb,*.ads,*.ada,*.gpr', + \ 'ada': '*.adb,*.ads,*.ada,*.adc,*.gpr,*.ada_m', \ 'ahdl': '*.tdf', \ 'aidl': '*.aidl', \ 'alsaconf': '', @@ -34,17 +34,17 @@ let s:globs = { \ 'autoit': '*.au3', \ 'automake': '[Mm]akefile.am,GNUmakefile.am', \ 'ave': '*.ave', - \ 'awk': '*.awk', + \ 'awk': '*.awk,*.gawk', \ 'basic': '*.basic', \ 'blade': '*.blade,*.blade.php', \ 'brewfile': 'Brewfile', - \ 'c': '*.c,*.cats,*.h,*.idc', + \ 'c': '*.c,*.cats,*.h,*.idc,*.qc', \ 'caddyfile': 'Caddyfile', \ 'carp': '*.carp', \ 'clojure': '*.clj,*.boot,*.cl2,*.cljc,*.cljs,*.cljs.hl,*.cljscm,*.cljx,*.hic,*.edn,riemann.config,build.boot,profile.boot', \ 'cmake': '*.cmake,*.cmake.in,CMakeLists.txt', \ 'coffee': '*.coffee,*._coffee,*.cake,*.cjsx,*.iced,*.coffeekup,Cakefile', - \ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.tcc,*.tpp', + \ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.tcc,*.tpp,*.moc', \ 'cql': '*.cql', \ 'cryptol': '*.cry,*.cyl,*.lcry,*.lcyl', \ 'crystal': '*.cr,Projectfile', @@ -52,7 +52,7 @@ let s:globs = { \ 'cucumber': '*.feature,*.story', \ 'cuesheet': '*.cue', \ 'd': '*.d,*.di', - \ 'dart': '*.dart', + \ 'dart': '*.dart,*.drt', \ 'dcov': '*.lst', \ 'dd': '*.dd', \ 'ddoc': '*.ddoc', |