diff options
Diffstat (limited to 'bitbake/contrib/vim')
-rw-r--r-- | bitbake/contrib/vim/LICENSE.txt | 18 | ||||
-rw-r--r-- | bitbake/contrib/vim/ftdetect/bitbake.vim | 4 | ||||
-rw-r--r-- | bitbake/contrib/vim/ftplugin/bitbake.vim | 15 | ||||
-rw-r--r--[-rwxr-xr-x] | bitbake/contrib/vim/plugin/newbb.vim | 14 | ||||
-rw-r--r-- | bitbake/contrib/vim/plugin/newbbappend.vim | 46 | ||||
-rw-r--r-- | bitbake/contrib/vim/syntax/bitbake.vim | 16 |
6 files changed, 96 insertions, 17 deletions
diff --git a/bitbake/contrib/vim/LICENSE.txt b/bitbake/contrib/vim/LICENSE.txt new file mode 100644 index 0000000000..c7d915024d --- /dev/null +++ b/bitbake/contrib/vim/LICENSE.txt | |||
@@ -0,0 +1,18 @@ | |||
1 | The MIT License (MIT) | ||
2 | |||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
4 | this software and associated documentation files (the "Software"), to deal in | ||
5 | the Software without restriction, including without limitation the rights to | ||
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
7 | the Software, and to permit persons to whom the Software is furnished to do so, | ||
8 | subject to the following conditions: | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in all | ||
11 | copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
diff --git a/bitbake/contrib/vim/ftdetect/bitbake.vim b/bitbake/contrib/vim/ftdetect/bitbake.vim index 200f8ae49b..09fc4dc74c 100644 --- a/bitbake/contrib/vim/ftdetect/bitbake.vim +++ b/bitbake/contrib/vim/ftdetect/bitbake.vim | |||
@@ -6,12 +6,12 @@ | |||
6 | " | 6 | " |
7 | " This sets up the syntax highlighting for BitBake files, like .bb, .bbclass and .inc | 7 | " This sets up the syntax highlighting for BitBake files, like .bb, .bbclass and .inc |
8 | 8 | ||
9 | if &compatible || version < 600 | 9 | if &compatible || version < 600 || exists("b:loaded_bitbake_plugin") |
10 | finish | 10 | finish |
11 | endif | 11 | endif |
12 | 12 | ||
13 | " .bb, .bbappend and .bbclass | 13 | " .bb, .bbappend and .bbclass |
14 | au BufNewFile,BufRead *.{bb,bbappend,bbclass} set filetype=bitbake | 14 | au BufNewFile,BufRead *.{bb,bbappend,bbclass} set filetype=bitbake |
15 | 15 | ||
16 | " .inc | 16 | " .inc |
17 | au BufNewFile,BufRead *.inc set filetype=bitbake | 17 | au BufNewFile,BufRead *.inc set filetype=bitbake |
diff --git a/bitbake/contrib/vim/ftplugin/bitbake.vim b/bitbake/contrib/vim/ftplugin/bitbake.vim index db0d75319a..9e8d3e13ce 100644 --- a/bitbake/contrib/vim/ftplugin/bitbake.vim +++ b/bitbake/contrib/vim/ftplugin/bitbake.vim | |||
@@ -1,2 +1,13 @@ | |||
1 | set sts=4 sw=4 et | 1 | " Only do this when not done yet for this buffer |
2 | set cms=#%s | 2 | if exists("b:did_ftplugin") |
3 | finish | ||
4 | endif | ||
5 | |||
6 | " Don't load another plugin for this buffer | ||
7 | let b:did_ftplugin = 1 | ||
8 | |||
9 | let b:undo_ftplugin = "setl cms< sts< sw< et< sua<" | ||
10 | |||
11 | setlocal commentstring=#\ %s | ||
12 | setlocal softtabstop=4 shiftwidth=4 expandtab | ||
13 | setlocal suffixesadd+=.bb,.bbclass | ||
diff --git a/bitbake/contrib/vim/plugin/newbb.vim b/bitbake/contrib/vim/plugin/newbb.vim index 874e338059..3a42027361 100755..100644 --- a/bitbake/contrib/vim/plugin/newbb.vim +++ b/bitbake/contrib/vim/plugin/newbb.vim | |||
@@ -10,7 +10,7 @@ | |||
10 | " | 10 | " |
11 | " Will try to use git to find the user name and email | 11 | " Will try to use git to find the user name and email |
12 | 12 | ||
13 | if &compatible || v:version < 600 | 13 | if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin") |
14 | finish | 14 | finish |
15 | endif | 15 | endif |
16 | 16 | ||
@@ -25,7 +25,7 @@ endfun | |||
25 | fun! <SID>GetUserEmail() | 25 | fun! <SID>GetUserEmail() |
26 | let l:user_email = system("git config --get user.email") | 26 | let l:user_email = system("git config --get user.email") |
27 | if v:shell_error | 27 | if v:shell_error |
28 | return "unknow@user.org" | 28 | return "unknown@user.org" |
29 | else | 29 | else |
30 | return substitute(l:user_email, "\n", "", "") | 30 | return substitute(l:user_email, "\n", "", "") |
31 | endfun | 31 | endfun |
@@ -41,6 +41,10 @@ fun! BBHeader() | |||
41 | endfun | 41 | endfun |
42 | 42 | ||
43 | fun! NewBBTemplate() | 43 | fun! NewBBTemplate() |
44 | if line2byte(line('$') + 1) != -1 | ||
45 | return | ||
46 | endif | ||
47 | |||
44 | let l:paste = &paste | 48 | let l:paste = &paste |
45 | set nopaste | 49 | set nopaste |
46 | 50 | ||
@@ -48,7 +52,7 @@ fun! NewBBTemplate() | |||
48 | call BBHeader() | 52 | call BBHeader() |
49 | 53 | ||
50 | " New the bb template | 54 | " New the bb template |
51 | put ='DESCRIPTION = \"\"' | 55 | put ='SUMMARY = \"\"' |
52 | put ='HOMEPAGE = \"\"' | 56 | put ='HOMEPAGE = \"\"' |
53 | put ='LICENSE = \"\"' | 57 | put ='LICENSE = \"\"' |
54 | put ='SECTION = \"\"' | 58 | put ='SECTION = \"\"' |
@@ -58,7 +62,7 @@ fun! NewBBTemplate() | |||
58 | 62 | ||
59 | " Go to the first place to edit | 63 | " Go to the first place to edit |
60 | 0 | 64 | 0 |
61 | /^DESCRIPTION =/ | 65 | /^SUMMARY =/ |
62 | exec "normal 2f\"" | 66 | exec "normal 2f\"" |
63 | 67 | ||
64 | if paste == 1 | 68 | if paste == 1 |
@@ -76,7 +80,7 @@ if v:progname =~ "vimdiff" | |||
76 | endif | 80 | endif |
77 | 81 | ||
78 | augroup NewBB | 82 | augroup NewBB |
79 | au BufNewFile *.bb | 83 | au BufNewFile,BufReadPost *.bb |
80 | \ if g:bb_create_on_empty | | 84 | \ if g:bb_create_on_empty | |
81 | \ call NewBBTemplate() | | 85 | \ call NewBBTemplate() | |
82 | \ endif | 86 | \ endif |
diff --git a/bitbake/contrib/vim/plugin/newbbappend.vim b/bitbake/contrib/vim/plugin/newbbappend.vim new file mode 100644 index 0000000000..e04174cf62 --- /dev/null +++ b/bitbake/contrib/vim/plugin/newbbappend.vim | |||
@@ -0,0 +1,46 @@ | |||
1 | " Vim plugin file | ||
2 | " Purpose: Create a template for new bbappend file | ||
3 | " Author: Joshua Watt <JPEWhacker@gmail.com> | ||
4 | " Copyright: Copyright (C) 2017 Joshua Watt <JPEWhacker@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 | |||
10 | if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin") | ||
11 | finish | ||
12 | endif | ||
13 | |||
14 | fun! NewBBAppendTemplate() | ||
15 | if line2byte(line('$') + 1) != -1 | ||
16 | return | ||
17 | endif | ||
18 | |||
19 | let l:paste = &paste | ||
20 | set nopaste | ||
21 | |||
22 | " New bbappend template | ||
23 | 0 put ='FILESEXTRAPATHS_prepend := \"${THISDIR}/${PN}:\"' | ||
24 | 2 | ||
25 | |||
26 | if paste == 1 | ||
27 | set paste | ||
28 | endif | ||
29 | endfun | ||
30 | |||
31 | if !exists("g:bb_create_on_empty") | ||
32 | let g:bb_create_on_empty = 1 | ||
33 | endif | ||
34 | |||
35 | " disable in case of vimdiff | ||
36 | if v:progname =~ "vimdiff" | ||
37 | let g:bb_create_on_empty = 0 | ||
38 | endif | ||
39 | |||
40 | augroup NewBBAppend | ||
41 | au BufNewFile,BufReadPost *.bbappend | ||
42 | \ if g:bb_create_on_empty | | ||
43 | \ call NewBBAppendTemplate() | | ||
44 | \ endif | ||
45 | augroup END | ||
46 | |||
diff --git a/bitbake/contrib/vim/syntax/bitbake.vim b/bitbake/contrib/vim/syntax/bitbake.vim index fb55f91022..f964621ae5 100644 --- a/bitbake/contrib/vim/syntax/bitbake.vim +++ b/bitbake/contrib/vim/syntax/bitbake.vim | |||
@@ -12,7 +12,7 @@ | |||
12 | " | 12 | " |
13 | " It's an entirely new type, just has specific syntax in shell and python code | 13 | " It's an entirely new type, just has specific syntax in shell and python code |
14 | 14 | ||
15 | if &compatible || v:version < 600 | 15 | if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin") |
16 | finish | 16 | finish |
17 | endif | 17 | endif |
18 | if exists("b:current_syntax") | 18 | if exists("b:current_syntax") |
@@ -58,8 +58,8 @@ syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbV | |||
58 | syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python | 58 | syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python |
59 | 59 | ||
60 | " Vars metadata flags | 60 | " Vars metadata flags |
61 | syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag | 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 | 62 | syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq |
63 | 63 | ||
64 | " Includes and requires | 64 | " Includes and requires |
65 | syn keyword bbInclude inherit include require contained | 65 | syn keyword bbInclude inherit include require contained |
@@ -67,15 +67,15 @@ syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref | |||
67 | syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest | 67 | syn match bbIncludeLine "^\(inherit\|include\|require\)\s\+" contains=bbInclude nextgroup=bbIncludeRest |
68 | 68 | ||
69 | " Add taks and similar | 69 | " Add taks and similar |
70 | syn keyword bbStatement addtask addhandler after before EXPORT_FUNCTIONS contained | 70 | syn keyword bbStatement addtask deltask addhandler after before EXPORT_FUNCTIONS contained |
71 | syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement | 71 | syn match bbStatementRest ".*$" skipwhite contained contains=bbStatement |
72 | syn match bbStatementLine "^\(addtask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest | 72 | syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest |
73 | 73 | ||
74 | " OE Important Functions | 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 | 75 | syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained |
76 | 76 | ||
77 | " Generic Functions | 77 | " Generic Functions |
78 | syn match bbFunction "\h[0-9A-Za-z_-]*" display contained contains=bbOEFunctions | 78 | syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions |
79 | 79 | ||
80 | " BitBake shell metadata | 80 | " BitBake shell metadata |
81 | syn include @shell syntax/sh.vim | 81 | syn include @shell syntax/sh.vim |
@@ -83,7 +83,7 @@ if exists("b:current_syntax") | |||
83 | unlet b:current_syntax | 83 | unlet b:current_syntax |
84 | endif | 84 | endif |
85 | syn keyword bbShFakeRootFlag fakeroot contained | 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 | 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 | 87 | syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell |
88 | 88 | ||
89 | " Python value inside shell functions | 89 | " Python value inside shell functions |
@@ -91,7 +91,7 @@ syn region shDeref start=+${@+ skip=+\\$+ excludenl end=+}+ contained co | |||
91 | 91 | ||
92 | " BitBake python metadata | 92 | " BitBake python metadata |
93 | syn keyword bbPyFlag python contained | 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 | 94 | syn match bbPyFuncDef "^\(fakeroot\s*\)\?\(python\)\(\s\+[0-9A-Za-z_${}\-\.]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbPyFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite |
95 | syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python | 95 | syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python |
96 | 96 | ||
97 | " BitBake 'def'd python functions | 97 | " BitBake 'def'd python functions |