# HG changeset patch # User Bram Moolenaar # Date 1657990807 -7200 # Node ID 2830faa3e1003d4062b38e461c1ff783e833b9f2 # Parent da62efc02e4fa0cb07b757668921fa6799d392af patch 9.0.0055: bitbake files are not detected Commit: https://github.com/vim/vim/commit/fa49eb482729a5fe7da9c9a5ed8d14f68afa55c7 Author: Gregory Anders Date: Sat Jul 16 17:46:47 2022 +0100 patch 9.0.0055: bitbake files are not detected Problem: Bitbake files are not detected. Solution: Add bitbake filetype detection by file name and contents. (Gregory Anders, closes #10697) diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -519,12 +519,14 @@ export def FTinc() # headers so assume POV-Ray elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? ft_pascal_keywords setf pascal + elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = ' + setf bitbake else FTasmsyntax() if exists("b:asmsyntax") - exe "setf " .. fnameescape(b:asmsyntax) + exe "setf " .. fnameescape(b:asmsyntax) else - setf pov + setf pov endif endif endif diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -252,6 +252,9 @@ au BufNewFile,BufRead *.db call dist#f " Blank au BufNewFile,BufRead *.bl setf blank +" Bitbake +au BufNewFile,BufRead *.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/conf/*.conf setf bitbake + " Blkid cache file au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -83,6 +83,7 @@ let s:filename_checks = { \ 'bib': ['file.bib'], \ 'bicep': ['file.bicep'], \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'], + \ 'bitbake': ['file.bb', 'file.bbappend', 'file.bbclass', 'build/conf/local.conf', 'meta/conf/layer.conf', 'build/conf/bbappend.conf', 'meta-layer/conf/distro/foo.conf'], \ 'blank': ['file.bl'], \ 'bsdl': ['file.bsd', 'file.bsdl', 'bsd', 'some-bsd'], \ 'bst': ['file.bst'], @@ -1816,5 +1817,58 @@ func Test_sig_file() filetype off endfunc +func Test_inc_file() + filetype on + + call writefile(['this is the fallback'], 'Xfile.inc') + split Xfile.inc + call assert_equal('pov', &filetype) + bwipe! + + let g:filetype_inc = 'foo' + split Xfile.inc + call assert_equal('foo', &filetype) + bwipe! + unlet g:filetype_inc + + " aspperl + call writefile(['perlscript'], 'Xfile.inc') + split Xfile.inc + call assert_equal('aspperl', &filetype) + bwipe! + + " aspvbs + call writefile(['<% something'], 'Xfile.inc') + split Xfile.inc + call assert_equal('aspvbs', &filetype) + bwipe! + + " php + call writefile(['