Files
poky/bitbake/contrib/vim/ftdetect/bitbake.vim
Joshua Watt 249793af75 bitbake: contrib: vim: Update file detection regex
The regex used to detect bitbake files was improved in patch 9.1.1732.
Update the plugin to match that logic and fix a bug where the wrong
expression was used to set the file type

(Bitbake rev: 7ce0c9b44968f80a6060f9f9ff2cc00823b772cc)

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-11-03 17:43:31 +00:00

33 lines
1.0 KiB
VimL

" Vim filetype detection file
" Language: BitBake
" Author: Ricardo Salveti <rsalveti@rsalveti.net>
" Copyright: Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net>
" Licence: You may redistribute this under the same terms as Vim itself
"
" This sets up the syntax highlighting for BitBake files, like .bb, .bbclass and .inc
if &compatible || version < 600 || exists("b:loaded_bitbake_plugin")
finish
endif
" .bb, .bbappend and .bbclass
au BufNewFile,BufRead *.{bb,bbappend,bbclass} setfiletype bitbake
" .inc -- meanwhile included upstream
if !has("patch-9.1.1732")
au BufNewFile,BufRead *.inc call s:BBIncDetect()
def s:BBIncDetect()
var lines = getline(1) .. getline(2) .. getline(3)
if lines =~# '\<\%(require\|inherit\)\>' || lines =~# '[A-Z][A-Za-z0-9_:${}/]*\s\+\%(??\|[?:+.]\)\?=.\? '
set filetype=bitbake
endif
enddef
endif
" .conf
au BufNewFile,BufRead *.conf
\ if (match(expand("%:p:h"), "conf") > 0) |
\ set filetype=bitbake |
\ endif