summaryrefslogtreecommitdiffstats
path: root/bitbake/contrib/vim
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/contrib/vim')
-rw-r--r--bitbake/contrib/vim/ftdetect/bitbake.vim14
-rw-r--r--bitbake/contrib/vim/indent/bitbake.vim6
-rw-r--r--bitbake/contrib/vim/plugin/newbbappend.vim2
-rw-r--r--bitbake/contrib/vim/syntax/bitbake.vim19
4 files changed, 27 insertions, 14 deletions
diff --git a/bitbake/contrib/vim/ftdetect/bitbake.vim b/bitbake/contrib/vim/ftdetect/bitbake.vim
index 09fc4dc74c..427ab5b987 100644
--- a/bitbake/contrib/vim/ftdetect/bitbake.vim
+++ b/bitbake/contrib/vim/ftdetect/bitbake.vim
@@ -11,10 +11,18 @@ if &compatible || version < 600 || exists("b:loaded_bitbake_plugin")
11endif 11endif
12 12
13" .bb, .bbappend and .bbclass 13" .bb, .bbappend and .bbclass
14au BufNewFile,BufRead *.{bb,bbappend,bbclass} set filetype=bitbake 14au BufNewFile,BufRead *.{bb,bbappend,bbclass} setfiletype bitbake
15 15
16" .inc 16" .inc -- meanwhile included upstream
17au BufNewFile,BufRead *.inc set filetype=bitbake 17if !has("patch-9.0.0055")
18 au BufNewFile,BufRead *.inc call s:BBIncDetect()
19 def s:BBIncDetect()
20 l:lines = getline(1) .. getline(2) .. getline(3)
21 if l:lines =~# '\<\%(require\|inherit\)\>' || lines =~# '[A-Z][A-Za-z0-9_:${}]*\s\+\%(??\|[?:+]\)\?= '
22 set filetype bitbake
23 endif
24 enddef
25endif
18 26
19" .conf 27" .conf
20au BufNewFile,BufRead *.conf 28au BufNewFile,BufRead *.conf
diff --git a/bitbake/contrib/vim/indent/bitbake.vim b/bitbake/contrib/vim/indent/bitbake.vim
index 1381034098..7ee9d69938 100644
--- a/bitbake/contrib/vim/indent/bitbake.vim
+++ b/bitbake/contrib/vim/indent/bitbake.vim
@@ -40,7 +40,7 @@ set cpo&vim
40 40
41let s:maxoff = 50 " maximum number of lines to look backwards for () 41let s:maxoff = 50 " maximum number of lines to look backwards for ()
42 42
43function GetPythonIndent(lnum) 43function! GetBBPythonIndent(lnum)
44 44
45 " If this line is explicitly joined: If the previous line was also joined, 45 " If this line is explicitly joined: If the previous line was also joined,
46 " line it up with that one, otherwise add two 'shiftwidth' 46 " line it up with that one, otherwise add two 'shiftwidth'
@@ -257,7 +257,7 @@ let b:did_indent = 1
257setlocal indentkeys+=0\" 257setlocal indentkeys+=0\"
258 258
259 259
260function BitbakeIndent(lnum) 260function! BitbakeIndent(lnum)
261 if !has('syntax_items') 261 if !has('syntax_items')
262 return -1 262 return -1
263 endif 263 endif
@@ -315,7 +315,7 @@ function BitbakeIndent(lnum)
315 endif 315 endif
316 316
317 if index(["bbPyDefRegion", "bbPyFuncRegion"], name) != -1 317 if index(["bbPyDefRegion", "bbPyFuncRegion"], name) != -1
318 let ret = GetPythonIndent(a:lnum) 318 let ret = GetBBPythonIndent(a:lnum)
319 " Should normally always be indented by at least one shiftwidth; but allow 319 " Should normally always be indented by at least one shiftwidth; but allow
320 " return of -1 (defer to autoindent) or -2 (force indent to 0) 320 " return of -1 (defer to autoindent) or -2 (force indent to 0)
321 if ret == 0 321 if ret == 0
diff --git a/bitbake/contrib/vim/plugin/newbbappend.vim b/bitbake/contrib/vim/plugin/newbbappend.vim
index e04174cf62..3f65f79cdc 100644
--- a/bitbake/contrib/vim/plugin/newbbappend.vim
+++ b/bitbake/contrib/vim/plugin/newbbappend.vim
@@ -20,7 +20,7 @@ fun! NewBBAppendTemplate()
20 set nopaste 20 set nopaste
21 21
22 " New bbappend template 22 " New bbappend template
23 0 put ='FILESEXTRAPATHS_prepend := \"${THISDIR}/${PN}:\"' 23 0 put ='FILESEXTRAPATHS:prepend := \"${THISDIR}/${PN}:\"'
24 2 24 2
25 25
26 if paste == 1 26 if paste == 1
diff --git a/bitbake/contrib/vim/syntax/bitbake.vim b/bitbake/contrib/vim/syntax/bitbake.vim
index f964621ae5..8f39b8f951 100644
--- a/bitbake/contrib/vim/syntax/bitbake.vim
+++ b/bitbake/contrib/vim/syntax/bitbake.vim
@@ -51,9 +51,9 @@ syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ end=+'+
51syn match bbExport "^export" nextgroup=bbIdentifier skipwhite 51syn match bbExport "^export" nextgroup=bbIdentifier skipwhite
52syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite 52syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite
53syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained 53syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained
54syn match bbVarDeref "${[a-zA-Z0-9\-_\.\/\+]\+}" contained 54syn match bbVarDeref "${[a-zA-Z0-9\-_:\.\/\+]\+}" contained
55syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue 55syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue
56syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+]\+\(_[${}a-zA-Z0-9\-_\.\/\+]\+\)\?\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq 56syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+][${}a-zA-Z0-9\-_:\.\/\+]*\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbOverrideOperator,bbVarDeref nextgroup=bbVarEq
57syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue 57syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue
58syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python 58syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python
59 59
@@ -63,13 +63,14 @@ syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*
63 63
64" Includes and requires 64" Includes and requires
65syn keyword bbInclude inherit include require contained 65syn keyword bbInclude inherit include require contained
66syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref 66syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue
67syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest 67syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest
68 68
69" Add taks and similar 69" Add taks and similar
70syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained 70syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained
71syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement 71syn match bbStatementRest /[^\\]*$/ skipwhite contained contains=bbStatement,bbVarDeref,bbVarPyValue
72syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest 72syn region bbStatementRestCont start=/.*\\$/ end=/^[^\\]*$/ contained contains=bbStatement,bbVarDeref,bbVarPyValue,bbContinue keepend
73syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest,bbStatementRestCont
73 74
74" OE Important Functions 75" OE Important Functions
75syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained 76syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained
@@ -77,13 +78,15 @@ syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_comp
77" Generic Functions 78" Generic Functions
78syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions 79syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions
79 80
81syn keyword bbOverrideOperator append prepend remove contained
82
80" BitBake shell metadata 83" BitBake shell metadata
81syn include @shell syntax/sh.vim 84syn include @shell syntax/sh.vim
82if exists("b:current_syntax") 85if exists("b:current_syntax")
83 unlet b:current_syntax 86 unlet b:current_syntax
84endif 87endif
85syn keyword bbShFakeRootFlag fakeroot contained 88syn keyword bbShFakeRootFlag fakeroot contained
86syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_${}\-\.]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite 89syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_:${}\-\.]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbOverrideOperator,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite
87syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell 90syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell
88 91
89" Python value inside shell functions 92" Python value inside shell functions
@@ -91,7 +94,7 @@ syn region shDeref start=+${@+ skip=+\\$+ excludenl end=+}+ contained co
91 94
92" BitBake python metadata 95" BitBake python metadata
93syn keyword bbPyFlag python contained 96syn keyword bbPyFlag python contained
94syn match bbPyFuncDef "^\(fakeroot\s*\)\?\(python\)\(\s\+[0-9A-Za-z_${}\-\.]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbPyFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite 97syn match bbPyFuncDef "^\(fakeroot\s*\)\?\(python\)\(\s\+[0-9A-Za-z_:${}\-\.]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbPyFlag,bbFunction,bbOverrideOperator,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite
95syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python 98syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python
96 99
97" BitBake 'def'd python functions 100" BitBake 'def'd python functions
@@ -120,7 +123,9 @@ hi def link bbPyFlag Type
120hi def link bbPyDef Statement 123hi def link bbPyDef Statement
121hi def link bbStatement Statement 124hi def link bbStatement Statement
122hi def link bbStatementRest Identifier 125hi def link bbStatementRest Identifier
126hi def link bbStatementRestCont Identifier
123hi def link bbOEFunctions Special 127hi def link bbOEFunctions Special
124hi def link bbVarPyValue PreProc 128hi def link bbVarPyValue PreProc
129hi def link bbOverrideOperator Operator
125 130
126let b:current_syntax = "bb" 131let b:current_syntax = "bb"