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