summaryrefslogtreecommitdiffstats
path: root/bitbake/contrib/vim
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/contrib/vim')
-rw-r--r--bitbake/contrib/vim/LICENSE.txt18
-rw-r--r--bitbake/contrib/vim/ftdetect/bitbake.vim4
-rw-r--r--bitbake/contrib/vim/ftplugin/bitbake.vim15
-rw-r--r--[-rwxr-xr-x]bitbake/contrib/vim/plugin/newbb.vim14
-rw-r--r--bitbake/contrib/vim/plugin/newbbappend.vim46
-rw-r--r--bitbake/contrib/vim/syntax/bitbake.vim16
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 @@
1The MIT License (MIT)
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in
5the Software without restriction, including without limitation the rights to
6use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7the Software, and to permit persons to whom the Software is furnished to do so,
8subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18CONNECTION 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
9if &compatible || version < 600 9if &compatible || version < 600 || exists("b:loaded_bitbake_plugin")
10 finish 10 finish
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} set filetype=bitbake
15 15
16" .inc 16" .inc
17au BufNewFile,BufRead *.inc set filetype=bitbake 17au 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 @@
1set sts=4 sw=4 et 1" Only do this when not done yet for this buffer
2set cms=#%s 2if exists("b:did_ftplugin")
3 finish
4endif
5
6" Don't load another plugin for this buffer
7let b:did_ftplugin = 1
8
9let b:undo_ftplugin = "setl cms< sts< sw< et< sua<"
10
11setlocal commentstring=#\ %s
12setlocal softtabstop=4 shiftwidth=4 expandtab
13setlocal 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
13if &compatible || v:version < 600 13if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin")
14 finish 14 finish
15endif 15endif
16 16
@@ -25,7 +25,7 @@ endfun
25fun! <SID>GetUserEmail() 25fun! <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", "", "")
31endfun 31endfun
@@ -41,6 +41,10 @@ fun! BBHeader()
41endfun 41endfun
42 42
43fun! NewBBTemplate() 43fun! 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"
76endif 80endif
77 81
78augroup NewBB 82augroup 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
10if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin")
11 finish
12endif
13
14fun! 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
29endfun
30
31if !exists("g:bb_create_on_empty")
32 let g:bb_create_on_empty = 1
33endif
34
35" disable in case of vimdiff
36if v:progname =~ "vimdiff"
37 let g:bb_create_on_empty = 0
38endif
39
40augroup NewBBAppend
41 au BufNewFile,BufReadPost *.bbappend
42 \ if g:bb_create_on_empty |
43 \ call NewBBAppendTemplate() |
44 \ endif
45augroup 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
15if &compatible || v:version < 600 15if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin")
16 finish 16 finish
17endif 17endif
18if exists("b:current_syntax") 18if exists("b:current_syntax")
@@ -58,8 +58,8 @@ syn match bbVarValue ".*$" contained contains=bbString,bbVarDeref,bbV
58syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python 58syn region bbVarPyValue start=+${@+ skip=+\\$+ end=+}+ contained contains=@python
59 59
60" Vars metadata flags 60" Vars metadata flags
61syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag 61syn match bbVarFlagDef "^\([a-zA-Z0-9\-_\.]\+\)\(\[[a-zA-Z0-9\-_\.+]\+\]\)\@=" contains=bbIdentifier nextgroup=bbVarFlagFlag
62syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(=\|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq 62syn region bbVarFlagFlag matchgroup=bbArrayBrackets start="\[" end="\]\s*\(:=\|=\|.=\|=.|+=\|=+\|?=\)\@=" contained contains=bbIdentifier nextgroup=bbVarEq
63 63
64" Includes and requires 64" Includes and requires
65syn keyword bbInclude inherit include require contained 65syn keyword bbInclude inherit include require contained
@@ -67,15 +67,15 @@ syn match bbIncludeRest ".*$" contained contains=bbString,bbVarDeref
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 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
72syn match bbStatementLine "^\(addtask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest 72syn match bbStatementLine "^\(addtask\|deltask\|addhandler\|after\|before\|EXPORT_FUNCTIONS\)\s\+" contains=bbStatement nextgroup=bbStatementRest
73 73
74" OE Important Functions 74" OE Important Functions
75syn keyword bbOEFunctions do_fetch do_unpack do_patch do_configure do_compile do_stage do_install do_package contained 75syn 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
78syn match bbFunction "\h[0-9A-Za-z_-]*" display contained contains=bbOEFunctions 78syn match bbFunction "\h[0-9A-Za-z_\-\.]*" display contained contains=bbOEFunctions
79 79
80" BitBake shell metadata 80" BitBake shell metadata
81syn include @shell syntax/sh.vim 81syn include @shell syntax/sh.vim
@@ -83,7 +83,7 @@ if exists("b:current_syntax")
83 unlet b:current_syntax 83 unlet b:current_syntax
84endif 84endif
85syn keyword bbShFakeRootFlag fakeroot contained 85syn keyword bbShFakeRootFlag fakeroot contained
86syn match bbShFuncDef "^\(fakeroot\s*\)\?\([0-9A-Za-z_${}-]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite 86syn match bbShFuncDef "^\(fakeroot\s*\)\?\([\.0-9A-Za-z_${}\-\.]\+\)\(python\)\@<!\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbShFuncRegion skipwhite
87syn region bbShFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@shell 87syn 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
93syn keyword bbPyFlag python contained 93syn keyword bbPyFlag python contained
94syn match bbPyFuncDef "^\(python\s\+\)\([0-9A-Za-z_${}-]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbPyFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite 94syn match bbPyFuncDef "^\(fakeroot\s*\)\?\(python\)\(\s\+[0-9A-Za-z_${}\-\.]\+\)\?\(\s*()\s*\)\({\)\@=" contains=bbShFakeRootFlag,bbPyFlag,bbFunction,bbVarDeref,bbDelimiter nextgroup=bbPyFuncRegion skipwhite
95syn region bbPyFuncRegion matchgroup=bbDelimiter start="{\s*$" end="^}\s*$" contained contains=@python 95syn 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