blob: e04174cf6234d66e2e6cf51a677aabe12b269ad3 [file] [log] [blame]
Andrew Geissler475cb722020-07-10 16:00:51 -05001" 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