hc
2023-05-26 a23f51ed7a39e452c1037343a84d7db1ca2c5bd7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
" Vim plugin file
" Purpose:    Create a template for new bbappend file
" Author:    Joshua Watt <JPEWhacker@gmail.com>
" Copyright:    Copyright (C) 2017 Joshua Watt <JPEWhacker@gmail.com>
"
" This file is licensed under the MIT license, see COPYING.MIT in
" this source distribution for the terms.
"
 
if &compatible || v:version < 600 || exists("b:loaded_bitbake_plugin")
    finish
endif
 
fun! NewBBAppendTemplate()
    if line2byte(line('$') + 1) != -1
        return
    endif
 
    let l:paste = &paste
    set nopaste
 
    " New bbappend template
    0 put ='FILESEXTRAPATHS:prepend := \"${THISDIR}/${PN}:\"'
    2
 
    if paste == 1
        set paste
    endif
endfun
 
if !exists("g:bb_create_on_empty")
    let g:bb_create_on_empty = 1
endif
 
" disable in case of vimdiff
if v:progname =~ "vimdiff"
    let g:bb_create_on_empty = 0
endif
 
augroup NewBBAppend
    au BufNewFile,BufReadPost *.bbappend
                \ if g:bb_create_on_empty |
                \    call NewBBAppendTemplate() |
                \ endif
augroup END