Skip to content

Commit fa49eb4

Browse files
gpandersbrammool
authored andcommitted
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)
1 parent c7bd2f0 commit fa49eb4

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

runtime/autoload/dist/ft.vim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,14 @@ export def FTinc()
519519
# headers so assume POV-Ray
520520
elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? ft_pascal_keywords
521521
setf pascal
522+
elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = '
523+
setf bitbake
522524
else
523525
FTasmsyntax()
524526
if exists("b:asmsyntax")
525-
exe "setf " .. fnameescape(b:asmsyntax)
527+
exe "setf " .. fnameescape(b:asmsyntax)
526528
else
527-
setf pov
529+
setf pov
528530
endif
529531
endif
530532
endif

runtime/filetype.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ au BufNewFile,BufRead *.db call dist#ft#BindzoneCheck('')
252252
" Blank
253253
au BufNewFile,BufRead *.bl setf blank
254254

255+
" Bitbake
256+
au BufNewFile,BufRead *.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/conf/*.conf setf bitbake
257+
255258
" Blkid cache file
256259
au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old setf xml
257260

src/testdir/test_filetype.vim

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ let s:filename_checks = {
8383
\ 'bib': ['file.bib'],
8484
\ 'bicep': ['file.bicep'],
8585
\ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'],
86+
\ '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'],
8687
\ 'blank': ['file.bl'],
8788
\ 'bsdl': ['file.bsd', 'file.bsdl', 'bsd', 'some-bsd'],
8889
\ 'bst': ['file.bst'],
@@ -1816,5 +1817,58 @@ func Test_sig_file()
18161817
filetype off
18171818
endfunc
18181819

1820+
func Test_inc_file()
1821+
filetype on
1822+
1823+
call writefile(['this is the fallback'], 'Xfile.inc')
1824+
split Xfile.inc
1825+
call assert_equal('pov', &filetype)
1826+
bwipe!
1827+
1828+
let g:filetype_inc = 'foo'
1829+
split Xfile.inc
1830+
call assert_equal('foo', &filetype)
1831+
bwipe!
1832+
unlet g:filetype_inc
1833+
1834+
" aspperl
1835+
call writefile(['perlscript'], 'Xfile.inc')
1836+
split Xfile.inc
1837+
call assert_equal('aspperl', &filetype)
1838+
bwipe!
1839+
1840+
" aspvbs
1841+
call writefile(['<% something'], 'Xfile.inc')
1842+
split Xfile.inc
1843+
call assert_equal('aspvbs', &filetype)
1844+
bwipe!
1845+
1846+
" php
1847+
call writefile(['<?php'], 'Xfile.inc')
1848+
split Xfile.inc
1849+
call assert_equal('php', &filetype)
1850+
bwipe!
1851+
1852+
" pascal
1853+
call writefile(['program'], 'Xfile.inc')
1854+
split Xfile.inc
1855+
call assert_equal('pascal', &filetype)
1856+
bwipe!
1857+
1858+
" bitbake
1859+
call writefile(['require foo'], 'Xfile.inc')
1860+
split Xfile.inc
1861+
call assert_equal('bitbake', &filetype)
1862+
bwipe!
1863+
1864+
" asm
1865+
call writefile(['asmsyntax=foo'], 'Xfile.inc')
1866+
split Xfile.inc
1867+
call assert_equal('foo', &filetype)
1868+
bwipe!
1869+
1870+
call delete('Xfile.inc')
1871+
filetype off
1872+
endfunc
18191873

18201874
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
55,
738740
/**/
739741
54,
740742
/**/

0 commit comments

Comments
 (0)