diff options
| author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
|---|---|---|
| committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
| commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
| tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /bitbake/contrib/vim | |
| download | poky-daisy-140929.tar.gz | |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'bitbake/contrib/vim')
| -rw-r--r-- | bitbake/contrib/vim/ftdetect/bitbake.vim | 24 | ||||
| -rw-r--r-- | bitbake/contrib/vim/ftplugin/bitbake.vim | 2 | ||||
| -rwxr-xr-x | bitbake/contrib/vim/plugin/newbb.vim | 85 | ||||
| -rw-r--r-- | bitbake/contrib/vim/syntax/bitbake.vim | 126 |
4 files changed, 237 insertions, 0 deletions
diff --git a/bitbake/contrib/vim/ftdetect/bitbake.vim b/bitbake/contrib/vim/ftdetect/bitbake.vim new file mode 100644 index 0000000000..200f8ae49b --- /dev/null +++ b/bitbake/contrib/vim/ftdetect/bitbake.vim | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | " Vim filetype detection file | ||
| 2 | " Language: BitBake | ||
| 3 | " Author: Ricardo Salveti <rsalveti@rsalveti.net> | ||
| 4 | " Copyright: Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net> | ||
| 5 | " Licence: You may redistribute this under the same terms as Vim itself | ||
| 6 | " | ||
| 7 | " This sets up the syntax highlighting for BitBake files, like .bb, .bbclass and .inc | ||
| 8 | |||
| 9 | if &compatible || version < 600 | ||
| 10 | finish | ||
| 11 | endif | ||
| 12 | |||
| 13 | " .bb, .bbappend and .bbclass | ||
| 14 | au BufNewFile,BufRead *.{bb,bbappend,bbclass} set filetype=bitbake | ||
| 15 | |||
| 16 | " .inc | ||
| 17 | au BufNewFile,BufRead *.inc set filetype=bitbake | ||
| 18 | |||
| 19 | " .conf | ||
| 20 | au BufNewFile,BufRead *.conf | ||
| 21 | \ if (match(expand("%:p:h"), "conf") > 0) | | ||
| 22 | \ set filetype=bitbake | | ||
| 23 | \ endif | ||
| 24 | |||
diff --git a/bitbake/contrib/vim/ftplugin/bitbake.vim b/bitbake/contrib/vim/ftplugin/bitbake.vim new file mode 100644 index 0000000000..db0d75319a --- /dev/null +++ b/bitbake/contrib/vim/ftplugin/bitbake.vim | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | set sts=4 sw=4 et | ||
| 2 | set cms=#%s | ||
diff --git a/bitbake/contrib/vim/plugin/newbb.vim b/bitbake/contrib/vim/plugin/newbb.vim new file mode 100755 index 0000000000..3019c855c0 --- /dev/null +++ b/bitbake/contrib/vim/plugin/newbb.vim | |||
| @@ -0,0 +1,85 @@ | |||
| 1 | " Vim plugin file | ||
| 2 | " Purpose: Create a template for new bb files | ||
| 3 | " Author: Ricardo Salveti <rsalveti@gmail.com> | ||
| 4 | " Copyright: Copyright (C) 2008 Ricardo Salveti <rsalveti@gmail.com> | ||
| 5 | " | ||
| 6 | " This file is licensed under the MIT license, see COPYING.MIT in | ||
| 7 | " this source distribution for the terms. | ||
| 8 | " | ||
| 9 | " Based on the gentoo-syntax package | ||
| 10 | " | ||
| 11 | " Will try to use git to find the user name and email | ||
| 12 | |||
| 13 | if &compatible || v:version < 600 | ||
| 14 | finish | ||
| 15 | endif | ||
| 16 | |||
| 17 | fun! <SID>GetUserName() | ||
| 18 | let l:user_name = system("git config --get user.name") | ||
| 19 | if v:shell_error | ||
| 20 | return "Unknown User" | ||
| 21 | else | ||
| 22 | return substitute(l:user_name, "\n", "", "") | ||
| 23 | endfun | ||
| 24 | |||
| 25 | fun! <SID>GetUserEmail() | ||
| 26 | let l:user_email = system("git config --get user.email") | ||
| 27 | if v:shell_error | ||
| 28 | return "unknow@user.org" | ||
| 29 | else | ||
| 30 | return substitute(l:user_email, "\n", "", "") | ||
| 31 | endfun | ||
| 32 | |||
| 33 | fun! BBHeader() | ||
| 34 | let l:current_year = strftime("%Y") | ||
| 35 | let l:user_name = <SID>GetUserName() | ||
| 36 | let l:user_email = <SID>GetUserEmail() | ||
| 37 | 0 put ='# Copyright (C) ' . l:current_year . | ||
| 38 | \ ' ' . l:user_name . ' <' . l:user_email . '>' | ||
| 39 | put ='# Released under the MIT license (see COPYING.MIT for the terms)' | ||
| 40 | $ | ||
| 41 | endfun | ||
| 42 | |||
| 43 | fun! NewBBTemplate() | ||
| 44 | let l:paste = &paste | ||
| 45 | set nopaste | ||
| 46 | |||
| 47 | " Get the header | ||
| 48 | call BBHeader() | ||
| 49 | |||
| 50 | " New the bb template | ||
| 51 | put ='DESCRIPTION = \"\"' | ||
| 52 | put ='HOMEPAGE = \"\"' | ||
| 53 | put ='LICENSE = \"\"' | ||
| 54 | put ='SECTION = \"\"' | ||
| 55 | put ='DEPENDS = \"\"' | ||
| 56 | put ='PR = \"r0\"' | ||
| 57 | put ='' | ||
| 58 | put ='SRC_URI = \"\"' | ||
| 59 | |||
| 60 | " Go to the first place to edit | ||
| 61 | 0 | ||
| 62 | /^DESCRIPTION =/ | ||
| 63 | exec "normal 2f\"" | ||
| 64 | |||
| 65 | if paste == 1 | ||
| 66 | set paste | ||
| 67 | endif | ||
| 68 | endfun | ||
| 69 | |||
| 70 | if !exists("g:bb_create_on_empty") | ||
| 71 | let g:bb_create_on_empty = 1 | ||
| 72 | endif | ||
| 73 | |||
| 74 | " disable in case of vimdiff | ||
| 75 | if v:progname =~ "vimdiff" | ||
| 76 | let g:bb_create_on_empty = 0 | ||
| 77 | endif | ||
| 78 | |||
| 79 | augroup NewBB | ||
| 80 | au BufNewFile *.bb | ||
| 81 | \ if g:bb_create_on_empty | | ||
| 82 | \ call NewBBTemplate() | | ||
| 83 | \ endif | ||
| 84 | augroup END | ||
| 85 | |||
diff --git a/bitbake/contrib/vim/syntax/bitbake.vim b/bitbake/contrib/vim/syntax/bitbake.vim new file mode 100644 index 0000000000..fb55f91022 --- /dev/null +++ b/bitbake/contrib/vim/syntax/bitbake.vim | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | " Vim syntax file | ||
| 2 | " Language: BitBake bb/bbclasses/inc | ||
| 3 | " Author: Chris Larson <kergoth@handhelds.org> | ||
| 4 | " Ricardo Salveti <rsalveti@rsalveti.net> | ||
| 5 | " Copyright: Copyright (C) 2004 Chris Larson <kergoth@handhelds.org> | ||
| 6 | " Copyright (C) 2008 Ricardo Salveti <rsalveti@rsalveti.net> | ||
| 7 | " | ||
| 8 | " This file is licensed under the MIT license, see COPYING.MIT in | ||
| 9 | " this source distribution for the terms. | ||
| 10 | " | ||
| 11 | " Syntax highlighting for bb, bbclasses and inc files. | ||
| 12 | " | ||
| 13 | " It's an entirely new type, just has specific syntax in shell and python code | ||
| 14 | |||
| 15 | if &compatible || v:version < 600 | ||
| 16 | finish | ||
| 17 | endif | ||
| 18 | if exists("b:current_syntax") | ||
| 19 | finish | ||
| 20 | endif | ||
| 21 | |||
| 22 | syn include @python syntax/python.vim | ||
| 23 | if exists("b:current_syntax") | ||
| 24 | unlet b:current_syntax | ||
| 25 | endif | ||
| 26 | |||
| 27 | " BitBake syntax | ||
| 28 | |||
| 29 | " Matching case | ||
| 30 | syn case match | ||
| 31 | |||
| 32 | " Indicates the error when nothing is matched | ||
| 33 | syn match bbUnmatched "." | ||
| 34 | |||
| 35 | " Comments | ||
| 36 | syn cluster bbCommentGroup contains=bbTodo,@Spell | ||
| 37 | syn keyword bbTodo COMBAK FIXME TODO XXX contained | ||
| 38 | syn match bbComment "#.*$" contains=@bbCommentGroup | ||
| 39 | |||
| 40 | " String helpers | ||
| 41 | syn match bbQuote +['"]+ contained | ||
| 42 | syn match bbDelimiter "[(){}=]" contained | ||
| 43 | syn match bbArrayBrackets "[\[\]]" contained | ||
| 44 | |||
| 45 | " BitBake strings | ||
| 46 | syn match bbContinue "\\$" | ||
| 47 | syn region bbString matchgroup=bbQuote start=+"+ skip=+\\$+ end=+"+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell | ||
| 48 | syn region bbString matchgroup=bbQuote start=+'+ skip=+\\$+ end=+'+ contained contains=bbTodo,bbContinue,bbVarDeref,bbVarPyValue,@Spell | ||
| 49 | |||
| 50 | " Vars definition | ||
| 51 | syn match bbExport "^export" nextgroup=bbIdentifier skipwhite | ||
| 52 | syn keyword bbExportFlag export contained nextgroup=bbIdentifier skipwhite | ||
| 53 | syn match bbIdentifier "[a-zA-Z0-9\-_\.\/\+]\+" display contained | ||
| 54 | syn match bbVarDeref "${[a-zA-Z0-9\-_\.\/\+]\+}" contained | ||
| 55 | syn match bbVarEq "\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)" contained nextgroup=bbVarValue | ||
| 56 | syn match bbVarDef "^\(export\s*\)\?\([a-zA-Z0-9\-_\.\/\+]\+\(_[${}a-zA-Z0-9\-_\.\/\+]\+\)\?\)\s*\(:=\|+=\|=+\|\.=\|=\.\|?=\|??=\|=\)\@=" contains=bbExportFlag,bbIdentifier,bbVarDeref nextgroup=bbVarEq | ||
| 57 | syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbVarPyValue | ||
| 58 | syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python | ||
| 59 | |||
| 60 | " Vars metadata flags | ||
| 61 | syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag | ||
| 62 | syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq | ||
| 63 | |||
| 64 | " Includes and requires | ||
| 65 | syn keyword bbInclude inherit include require contained | ||
| 66 | syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref | ||
| 67 | syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest | ||
| 68 | |||
| 69 | " Add taks and similar | ||
| 70 | syn keyword bbStatement addtask addhandler after before EXPORT_FUNCTIONS contained | ||
| 71 | syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement | ||
| 72 | syn match bbStatementLine "^\(addtask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest | ||
| 73 | |||
| 74 | " OE Important Functions | ||
| 75 | syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained | ||
| 76 | |||
| 77 | " Generic Functions | ||
| 78 | syn match bbFunction "\h[0-9A-Za-z_-]*" display contained contains=bbOEFunctions | ||
| 79 | |||
| 80 | " BitBake shell metadata | ||
| 81 | syn include @shell syntax/sh.vim | ||
| 82 | if exists("b:current_syntax") | ||
| 83 | unlet b:current_syntax | ||
| 84 | endif | ||
| 85 | syn keyword bbShFakeRootFlag fakeroot contained | ||
| 86 | syn match bbShFuncDef "^\(fakeroot\s*\)\?\([0-9A-Za-z_${}-]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite | ||
| 87 | syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell | ||
| 88 | |||
| 89 | " Python value inside shell functions | ||
| 90 | syn region shDeref start=+${@+ skip=+\\$+ excludenl end=+}+ contained contains=@python | ||
| 91 | |||
| 92 | " BitBake python metadata | ||
| 93 | syn keyword bbPyFlag python contained | ||
| 94 | syn match bbPyFuncDef "^\(python\s\+\)\([0-9A-Za-z_${}-]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPyFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite | ||
| 95 | syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python | ||
| 96 | |||
| 97 | " BitBake 'def'd python functions | ||
| 98 | syn keyword bbPyDef def contained | ||
| 99 | syn region bbPyDefRegion start='^\(def\s\+\)\([0-9A-Za-z_-]\+\)\(\s*(.*)\s*\):\s*$' end='^\(\s\|$\)\@!' contains=@python | ||
| 100 | |||
| 101 | " Highlighting Definitions | ||
| 102 | hi def link bbUnmatched Error | ||
| 103 | hi def link bbInclude Include | ||
| 104 | hi def link bbTodo Todo | ||
| 105 | hi def link bbComment Comment | ||
| 106 | hi def link bbQuote String | ||
| 107 | hi def link bbString String | ||
| 108 | hi def link bbDelimiter Keyword | ||
| 109 | hi def link bbArrayBrackets Statement | ||
| 110 | hi def link bbContinue Special | ||
| 111 | hi def link bbExport Type | ||
| 112 | hi def link bbExportFlag Type | ||
| 113 | hi def link bbIdentifier Identifier | ||
| 114 | hi def link bbVarDeref PreProc | ||
| 115 | hi def link bbVarDef Identifier | ||
| 116 | hi def link bbVarValue String | ||
| 117 | hi def link bbShFakeRootFlag Type | ||
| 118 | hi def link bbFunction Function | ||
| 119 | hi def link bbPyFlag Type | ||
| 120 | hi def link bbPyDef Statement | ||
| 121 | hi def link bbStatement Statement | ||
| 122 | hi def link bbStatementRest Identifier | ||
| 123 | hi def link bbOEFunctions Special | ||
| 124 | hi def link bbVarPyValue PreProc | ||
| 125 | |||
| 126 | let b:current_syntax = "bb" | ||
