aboutsummaryrefslogtreecommitdiff
blob: f11dd0f993f7692901bbfefa103d3828b011dd02 (plain)
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
46
47
48
" Vim plugin
" Purpose:	create content for new init.d scripts
" Author:	Aaron Walker <ka0ttic@gentoo.org>
" Copyright:	Copyright (c) 2005 Aaron Walker
" License:	You may redistribute this under the same terms as Vim itself

if &compatible || v:version < 603 || exists("g:loaded_newinitd")
    finish
endif

let g:loaded_newinitd=1

runtime! plugin/gentoo-common.vim

fun! <SID>MakeNewInitd()
    call GentooHeader('#!/sbin/openrc-run')

    " {{{ variables
    let l:scriptname = expand("%:t:r")
    " }}}
    "
    " {{{ common metadata
    put ='name=\"' . l:scriptname . ' daemon\"'
    put ='description=\"\"'
    put ='command=/usr/bin/' . l:scriptname
    put ='command_args=\"${' . l:scriptname . '_args}\"'
    " }}}

    " {{{ functions
    put =''
    put ='depend() {'
    put =''
    put ='}'
    " }}}

    " Jump back to the first line
    0
endfun

com! -nargs=0 NewInitd call <SID>MakeNewInitd() | set filetype=gentoo-init-d

augroup NewInitd
    au!
    autocmd BufNewFile {/*/files/*.{rc*,init*},/etc/init.d/*}
        \ call <SID>MakeNewInitd() | set filetype=gentoo-init-d
augroup END

" vim: set et foldmethod=marker : "