Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 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 |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 23 | 0 put ='FILESEXTRAPATHS:prepend := \"${THISDIR}/${PN}:\"' |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 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 | |