diff options
| author | Josh Rahm <rahm@google.com> | 2022-08-19 12:26:08 -0600 |
|---|---|---|
| committer | Josh Rahm <rahm@google.com> | 2022-08-19 13:06:41 -0600 |
| commit | a7237662f96933efe29eed8212464571e3778cd0 (patch) | |
| tree | 27930202726b4251437c8cfa53069f65b4db90dc /runtime/lua/vim/filetype | |
| parent | 02292344929069ea63c0bb872cc22d552d86b67f (diff) | |
| parent | b2f979b30beac67906b2dd717fcb6a34f46f5e54 (diff) | |
| download | rneovim-tmp.tar.gz rneovim-tmp.tar.bz2 rneovim-tmp.zip | |
Merge branch 'master' of https://github.com/neovim/neovim into rahmtmp
Diffstat (limited to 'runtime/lua/vim/filetype')
| -rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 14f076717f..2be9dcff88 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -930,7 +930,7 @@ function M.progress_pascal(bufnr) return 'progress' end --- Distinguish between "default" and Cproto prototype file. +-- Distinguish between "default", Prolog and Cproto prototype file. function M.proto(bufnr, default) -- 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 @@ -940,7 +940,18 @@ function M.proto(bufnr, default) if getlines(bufnr, 2):find('.;$') then return 'cpp' else - return default + -- Recognize Prolog by specific text in the first non-empty line; + -- require a blank after the '%' because Perl uses "%list" and "%translate" + local line = nextnonblank(bufnr, 1) + if + line and line:find(':%-') + or matchregex(line, [[\c\<prolog\>]]) + or findany(line, { '^%s*%%+%s', '^%s*%%+$', '^%s*/%*' }) + then + return 'prolog' + else + return default + end end end |