summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/dist/ft.vim8
-rw-r--r--runtime/filetype.vim9
2 files changed, 14 insertions, 3 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 4e7d517931..dd4fd30636 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -406,14 +406,18 @@ export def FTidl()
setf idl
enddef
-# Distinguish between "default", Prolog and Cproto prototype file.
+# Distinguish between "default", Prolog, zsh module's C and Cproto prototype file.
export def ProtoCheck(default: string)
+ # zsh modules use '#include "*.pro"'
+ # https://github.com/zsh-users/zsh/blob/63f086d167960a27ecdbcb762179e2c2bf8a29f5/Src/Modules/example.c#L31
+ if getline(1) =~ '/* Generated automatically */'
+ setf c
# Cproto files have a comment in the first line and a function prototype in
# the second line, it always ends in ";". Indent files may also have
# comments, thus we can't match comments to see the difference.
# IDL files can have a single ';' in the second line, require at least one
# chacter before the ';'.
- if getline(2) =~ '.;$'
+ elseif getline(2) =~ '.;$'
setf cpp
else
# recognize Prolog by specific text in the first non-empty line
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index f45866cb82..bc3a488ea6 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1072,7 +1072,7 @@ au BufNewFile,BufRead */.icewm/menu setf icemenu
au BufNewFile,BufRead .indent.pro setf indent
au BufNewFile,BufRead indent.pro call dist#ft#ProtoCheck('indent')
-" IDL (Interactive Data Language)
+" IDL (Interactive Data Language), Prolog, Cproto or zsh module C
au BufNewFile,BufRead *.pro call dist#ft#ProtoCheck('idlang')
" Indent RC
@@ -3093,6 +3093,13 @@ au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini')
au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh')
au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh')
+" Zsh module
+" *.mdd will generate *.mdh, *.pro and *.epro.
+" module's *.c will #include *.mdh containing module dependency information and
+" *.pro containing all static declarations of *.c
+" *.epro contains all external declarations of *.c
+au BufNewFile,BufRead *.mdh,*.epro setf c
+au BufNewFile,BufRead *.mdd setf zsh
" Help files match *.txt but should have a last line that is a modeline.
au BufNewFile,BufRead *.txt